/* style.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4361ee;
    --primary-hover: #3a56d4;
    --text: #1a1a1a;
    --text-light: #555;
    --bg: #ffffff;
    --card-bg: #f8f9fa;
    --border: #e0e0e0;
    --radius: 12px;
    --shadow: 0 2px 8px rgba(0,0,0,0.05);
    --transition: all 0.2s ease;
}

@media (prefers-color-scheme: dark) {
    :root {
        --text: #e0e0e0;
        --text-light: #aaa;
        --bg: #121212;
        --card-bg: #1e1e1e;
        --border: #333;
    }
}

body {
    font-family: 'Inter', -apple system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    transition: var(--transition);
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
}

.header h1 i {
    margin-right: 8px;
}

nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.user {
    margin-right: 15px;
    font-size: 0.95rem;
    color: var(--text-light);
}

.btn {
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-outline {
    border: 1.5px solid var(--border);
    color: var(--text);
    background: transparent;
}

.btn-outline:hover {
    background: var(--card-bg);
    border-color: var(--primary);
    color: var(--primary);
}

.questions-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.question-card {
    background: var(--card-bg);
    padding: 18px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.question-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--primary);
}

.question-card h3 {
    margin: 0 0 10px;
    font-size: 1.2rem;
    font-weight: 600;
}

.question-card h3 a {
    color: var(--text);
    text-decoration: none;
    transition: var(--transition);
}

.question-card h3 a:hover {
    color: var(--primary);
}

.meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 0.875rem;
    color: var(--text-light);
    margin-top: 8px;
}

.meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.meta i {
    font-size: 0.9rem;
    color: var(--text-light);
}

.empty {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
    font-style: italic;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.page-link {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    color: var(--text);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: var(--transition);
    border: 1px solid var(--border);
}

.page-link:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-link.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    font-weight: 600;
}

footer {
    text-align: center;
    margin-top: 50px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Адаптивность */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .header {
        flex-direction: column;
        text-align: center;
    }

    .header h1 {
        font-size: 1.6rem;
    }

    nav {
        justify-content: center;
    }

    .meta {
        font-size: 0.8rem;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .question-card {
        padding: 14px;
    }

    .question-card h3 {
        font-size: 1.1rem;
    }

    .btn {
        padding: 7px 12px;
        font-size: 0.9rem;
    }
}
/* === Страница "Задать вопрос" === */
.ask-form-page {
    display: flex;
    justify-content: center;
    padding: 20px 0;
}

.form-card {
    background: var(--card-bg);
    padding: 28px;
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    width: 100%;
    max-width: 700px;
    box-shadow: var(--shadow);
}

.form-card h2 {
    margin: 0 0 24px;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.ask-form .field {
    margin-bottom: 20px;
}

.ask-form label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text);
    font-size: 1rem;
}

.ask-form input[type="text"],
.ask-form textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    background: var(--bg);
    color: var(--text);
    transition: var(--transition);
}

.ask-form input[type="text"]:focus,
.ask-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}

.ask-form textarea {
    resize: vertical;
    min-height: 120px;
}

.ask-form small {
    display: block;
    margin-top: 6px;
    color: var(--text-light);
    font-size: 0.85rem;
}

.actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.actions .btn {
    flex: 1;
    min-width: 140px;
    justify-content: center;
}

/* === Оповещения === */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert.error {
    background: #fee;
    color: #c00;
    border: 1px solid #fcc;
}

/* Адаптив */
@media (max-width: 768px) {
    .form-card {
        padding: 20px;
    }
    .form-card h2 {
        font-size: 1.35rem;
    }
    .actions {
        flex-direction: column;
    }
    .actions .btn {
        width: 100%;
    }
}
/* === Форма ответа на вопрос === */
.answer-form {
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    margin-top: 24px;
    box-shadow: var(--shadow);
}

.answer-form h3 {
    margin: 0 0 16px;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.answer-form-inner .field {
    margin-bottom: 16px;
}

.answer-form-inner textarea {
    width: 100%;
    padding: 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    background: var(--bg);
    color: var(--text);
    resize: vertical;
    transition: var(--transition);
    min-height: 120px;
}

.answer-form-inner textarea::placeholder {
    color: var(--text-light);
    opacity: 0.8;
}

.answer-form-inner textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}

.answer-form-inner small {
    display: block;
    margin-top: 6px;
    color: var(--text-light);
    font-size: 0.85rem;
    font-style: italic;
}

.answer-form-inner .actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.answer-form-inner .btn {
    min-width: 180px;
    justify-content: center;
}

/* === Если нет авторизации === */
.login-prompt {
    text-align: center;
    padding: 20px;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1.5px dashed var(--border);
    color: var(--text-light);
    font-size: 1rem;
}

.login-prompt .btn {
    margin-top: 8px;
}

/* Адаптив */
@media (max.max-width: 768px) {
    .answer-form {
        padding: 18px;
    }
    .answer-form h3 {
        font-size: 1.2rem;
    }
    .answer-form-inner .btn {
        width: 100%;
    }
}

.alert.error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}
/* === Страницы авторизации === */
.auth-page {
    display: flex;
    justify-content: center;
    padding: 30px 0;
    min-height: 70vh;
}

.form-card {
    background: var(--card-bg);
    padding: 32px;
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow);
}

.form-card h2 {
    margin: 0 0 24px;
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

.auth-form .field {
    margin-bottom: 20px;
}

.auth-form label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text);
    font-size: 1rem;
}

.auth-form input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    background: var(--bg);
    color: var(--text);
    transition: var(--transition);
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}

.auth-form input::placeholder {
    color: var(--text-light);
}

.auth-form small {
    display: block;
    margin-top: 6px;
    color: var(--text-light);
    font-size: 0.85rem;
}

.actions {
    margin-top: 10px;
}

.actions .btn {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 1.1rem;
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
    color: var(--text-light);
    font-size: 0.95rem;
}

.auth-switch a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* Адаптив */
@media (max-width: 768px) {
    .form-card {
        padding: 24px;
        margin: 0 15px;
    }
    .form-card h2 {
        font-size: 1.4rem;
    }
}
/* === Чекбокс "Запомнить меня" === */
.field.checkbox {
    display: flex;
    align-items: center;
    margin: 16px 0;
    font-size: 0.95rem;
}

.field.checkbox label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text);
    margin: 0;
}

.field.checkbox input[type="checkbox"] {
    opacity: 0;
    position: absolute;
    width: 0;
    height: 0;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    transition: var(--transition);
    position: relative;
    flex-shrink: 0;
}

.field.checkbox input:checked ~ .checkmark {
    background: var(--primary);
    border-color: var(--primary);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.field.checkbox input:checked ~ .checkmark:after {
    display: block;
}

/* === Успешное уведомление === */
.alert.success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
}

/* === Адаптив === */
@media (max-width: 480px) {
    .form-card {
        padding: 20px;
    }
    .actions .btn {
        font-size: 1rem;
    }
}

/* === Карточки ответов === */
.answers-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
}

.answer-card {
    background: var(--card-bg);
    padding: 16px;
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.answer-card:hover {
    transform: translateY(-1px);
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.answer-body {
    margin-bottom: 12px;
    line-height: 1.6;
    color: var(--text);
    white-space: pre-wrap;
}

.answer-card .meta {
    font-size: 0.85rem;
    color: var(--text-light);
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

@media (max-width: 480px) {
    .answer-card {
        padding: 14px;
    }
    .answer-card .meta {
        font-size: 0.8rem;
    }
}
/* === Кнопка "Назад" === */
.back-link {
    margin-top: 32px;
    text-align: center;
}

.back-link .btn {
    min-width: 200px;
    justify-content: center;
    font-weight: 500;
}
/* === Действия с ответом === */
.answer-actions {
    padding-top: 8px;
    border-top: 1px dashed var(--border);
    margin-top: 12px;
}

.answer-actions .btn {
    font-size: 0.85rem;
    padding: 6px 10px;
}

/* Адаптив */
@media (max-width: 480px) {
    .answer-actions {
        flex-direction: column;
    }
    .answer-actions .btn {
        width: 100%;
    }
}