/* ============================================================
   ОБЩИЕ СТИЛИ (Премиальная коричневая гамма)
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #F9F7F4 0%, #EBE5DE 100%);
    color: #3E2723;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================================================
   ШАПКА САЙТА (HEADER)
   ============================================================ */
.header {
    background: linear-gradient(135deg, #3E2723 0%, #5D4037 50%, #4E342E 100%);
    background-size: 200% 200%;
    animation: gradientBG 12s ease infinite;
    color: #FFF8E1;
    padding: 35px 0;
    box-shadow: 0 6px 20px rgba(62, 39, 35, 0.25);
    text-align: center;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.header-content h1 {
    font-size: 2.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.4);
}

.header-content .mission {
    font-size: 1.2rem;
    font-weight: 300;
    margin-top: 10px;
    opacity: 0.95;
    color: #D7CCC8;
}

/* ============================================================
   ОСНОВНОЙ КОНТЕНТ (АВТОРИЗАЦИЯ)
   ============================================================ */
.main-content {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 50px 0;
}

.login-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    background: #FFFFFF;
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(62, 39, 35, 0.08);
    padding: 45px;
    width: 100%;
    max-width: 950px;
    margin: 0 auto;
    border: 1px solid #EFEBE9;
}

.login-info {
    flex: 1;
    min-width: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-info h2 {
    font-size: 2rem;
    color: #3E2723;
    margin-bottom: 15px;
    font-weight: 700;
}

.login-info p {
    font-size: 1.05rem;
    color: #5D4037;
    line-height: 1.7;
}

.security-badge {
    margin-top: 30px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #F5EFE6;
    padding: 14px 24px;
    border-radius: 30px;
    border: 1px solid #D7CCC8;
    color: #4E342E;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 2px 8px rgba(62, 39, 35, 0.05);
}

.security-badge i {
    font-size: 1.4rem;
    color: #C5A065;
}

.login-form {
    flex: 1.2;
    min-width: 300px;
    background: #FDFBF9;
    padding: 35px;
    border-radius: 16px;
    border: 1px solid #EFEBE9;
}

.login-form h2 {
    font-size: 1.8rem;
    color: #3E2723;
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 3px solid #C5A065;
    padding-bottom: 12px;
    font-weight: 600;
}

/* ============================================================
   ЭЛЕМЕНТЫ ФОРМЫ (АВТОРИЗАЦИЯ)
   ============================================================ */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #4E342E;
    font-size: 0.95rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper input[type="text"],
.input-wrapper input[type="password"] {
    width: 100%;
    padding: 14px 45px 14px 16px;
    border: 2px solid #D7CCC8;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #FFFFFF;
    color: #3E2723;
}

.input-wrapper input[type="text"]:focus,
.input-wrapper input[type="password"]:focus {
    border-color: #8D6E63;
    outline: none;
    box-shadow: 0 0 0 4px rgba(141, 110, 99, 0.15);
}

/* Валидное/Невалидное состояние */
.input-wrapper input:valid:not(:placeholder-shown) {
    border-color: #558B2F;
}
.input-wrapper input:invalid:not(:placeholder-shown) {
    border-color: #C62828;
}

/* Иконки в авторизации */
.valid-icon,
.invalid-icon {
    position: absolute;
    right: 14px;
    font-size: 1.2rem;
    display: none;
    pointer-events: none;
}
.valid-icon { color: #558B2F; }
.invalid-icon { color: #C62828; }

/* Показ иконок в авторизации */
.input-wrapper input:valid:not(:placeholder-shown) ~ .valid-icon { display: block; }
.input-wrapper input:invalid:not(:placeholder-shown) ~ .invalid-icon { display: block; }

.toggle-password {
    position: absolute;
    right: 45px;
    background: none;
    border: none;
    color: #8D6E63;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 5px;
    transition: color 0.3s, transform 0.2s;
}

.toggle-password:hover {
    color: #3E2723;
    transform: scale(1.1);
}

.hint {
    display: block;
    font-size: 0.78rem;
    color: #8D6E63;
    margin-top: 6px;
    font-style: italic;
}

.error-message {
    display: block;
    font-size: 0.8rem;
    color: #C62828;
    margin-top: 6px;
    min-height: 20px;
    font-weight: 500;
}

/* Чекбокс */
.form-group.checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 25px;
    padding-top: 5px;
}

.form-group.checkbox input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #5D4037;
}

.form-group.checkbox label {
    margin-bottom: 0;
    font-weight: 500;
    cursor: pointer;
    font-size: 0.95rem;
    color: #4E342E;
}

/* ============================================================
   КНОПКИ
   ============================================================ */
.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    margin-top: 10px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, #5D4037 0%, #3E2723 100%);
    color: #FFFFFF;
    box-shadow: 0 4px 15px rgba(62, 39, 35, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #6D4C41 0%, #4E342E 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(62, 39, 35, 0.4);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(62, 39, 35, 0.3);
}

.btn-primary:disabled {
    background: #BCAAA4;
    color: #EFEBE9;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn-secondary {
    background: linear-gradient(135deg, #C5A065 0%, #A67B5B 100%);
    color: #3E2723;
    box-shadow: 0 4px 15px rgba(197, 160, 101, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #D4AF37 0%, #B88A6A 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(197, 160, 101, 0.45);
    color: #2C1E1A;
}

.btn-secondary:active {
    transform: translateY(-1px);
}

.btn i {
    font-size: 1rem;
}

.forgot-password {
    color: #8D6E63;
    font-size: 0.9rem;
    text-decoration: none;
    margin-left: auto;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 6px;
}

.forgot-password:hover {
    color: #3E2723;
    background-color: #EFEBE9;
    text-decoration: none;
}

/* ============================================================
   ПОДВАЛ САЙТА (FOOTER)
   ============================================================ */
.footer {
    background: #3E2723;
    color: #EFEBE9;
    padding: 35px 0;
    margin-top: auto;
    border-top: 4px solid #C5A065;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
}

.footer-content {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.footer-info p {
    margin-bottom: 8px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.footer-info p i {
    width: 20px;
    color: #C5A065;
}

.footer-info p strong {
    color: #D7CCC8;
}

.footer-copy {
    font-size: 0.85rem;
    opacity: 0.7;
    text-align: right;
}

/* ============================================================
   СТРАНИЦА РЕГИСТРАЦИИ
   ============================================================ */
.main-content:not(:has(.login-wrapper)) {
    display: block;
    padding: 50px 0;
}

.main-content:not(:has(.login-wrapper)) .container {
    max-width: 700px;
    margin: 0 auto;
    background: #FFFFFF;
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(62, 39, 35, 0.08);
    padding: 45px;
    border: 1px solid #EFEBE9;
}

.main-content:not(:has(.login-wrapper)) h2 {
    font-size: 1.8rem;
    color: #3E2723;
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 12px;
    border-bottom: 3px solid #C5A065;
    font-weight: 600;
}

fieldset {
    border: 1px solid #EFEBE9;
    border-radius: 16px;
    padding: 30px;
    background: #FDFBF9;
    margin-bottom: 25px;
}

table#form_table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
}

table#form_table td.col1:first-child {
    width: 30%;
    text-align: right;
    padding-right: 20px;
    font-weight: 600;
    color: #4E342E;
    font-size: 0.95rem;
    white-space: nowrap;
    vertical-align: middle;
}

table#form_table td.col1:nth-child(2) {
    width: 65%;
    position: relative; /* Для позиционирования иконок */
}

table#form_table td.col2 {
    width: 5%;
    vertical-align: middle;
    text-align: center;
}

table#form_table input[type="text"],
table#form_table input[type="email"],
table#form_table input[type="password"],
table#form_table input[type="file"] {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #D7CCC8;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    background: #FFFFFF;
    color: #3E2723;
    transition: all 0.3s ease;
}

table#form_table input[type="text"]:focus,
table#form_table input[type="email"]:focus,
table#form_table input[type="password"]:focus,
table#form_table input[type="file"]:focus {
    border-color: #8D6E63;
    outline: none;
    box-shadow: 0 0 0 4px rgba(141, 110, 99, 0.15);
}

table#form_table input:valid:not(:placeholder-shown) {
    border-color: #558B2F;
}

table#form_table input:invalid:not(:placeholder-shown) {
    border-color: #C62828;
}

table#form_table .hint {
    display: block;
    font-size: 0.78rem;
    color: #8D6E63;
    margin-top: 6px;
    font-style: italic;
}

/* Кнопки на странице регистрации */
td.button .button,
input[type="submit"].button,
input[type="reset"].button,
input#submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    margin: 5px;
    background: linear-gradient(135deg, #5D4037 0%, #3E2723 100%);
    color: #FFFFFF;
    box-shadow: 0 4px 15px rgba(62, 39, 35, 0.3);
}

input[type="submit"].button:hover,
input#submit:hover:not(:disabled) {
    background: linear-gradient(135deg, #6D4C41 0%, #4E342E 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(62, 39, 35, 0.4);
}

input[type="reset"].button {
    background: linear-gradient(135deg, #EFEBE9 0%, #D7CCC8 100%);
    color: #4E342E;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

input[type="reset"].button:hover {
    background: linear-gradient(135deg, #D7CCC8 0%, #BCAAA4 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.1);
}

.main-content > .container > p:last-child > a {
    display: inline-block;
    margin-top: 20px;
    color: #8D6E63;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    padding: 5px 10px;
    border-radius: 6px;
}

.main-content > .container > p:last-child > a:hover {
    color: #3E2723;
    background-color: #EFEBE9;
    text-decoration: none;
}

/* ============================================================
   ИКОНКИ ВАЛИДАЦИИ (РАБОТА №6)
   ============================================================ */
/* По умолчанию скрываем все иконки валидации в форме */
.fa-check.valid-icon, 
.fa-times.invalid-icon {
    display: none;
    font-size: 1.2rem;
}

/* Показываем зеленую галочку, если поле заполнено и валидно */
input:valid:not(:placeholder-shown) ~ .valid-icon,
input[type="file"]:valid ~ .valid-icon {
    display: inline-block;
}

/* Показываем красный крестик, если поле заполнено, но невалидно */
input:invalid:not(:placeholder-shown) ~ .invalid-icon,
input[type="file"]:invalid ~ .invalid-icon {
    display: inline-block;
}

/* ============================================================
   ТАБЛИЦЫ НА СТРАНИЦЕ ПОЛЬЗОВАТЕЛЯ
   ============================================================ */
table.head, table.New {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(62, 39, 35, 0.1);
}

table.New td {
    padding: 12px 15px;
    border-bottom: 1px solid #EFEBE9;
}

table.New tr:last-child td {
    border-bottom: none;
}

table.New td:first-child {
    font-weight: bold;
    color: #4E342E;
    width: 30%;
    background-color: #FDFBF9;
}

table.head td {
    padding: 15px;
    vertical-align: top;
}

/* ============================================================
   АДАПТИВНОСТЬ (RESPONSIVE)
   ============================================================ */
@media (max-width: 768px) {
    .header-content h1 {
        font-size: 2rem;
    }

    .login-wrapper {
        flex-direction: column;
        padding: 30px 20px;
        gap: 30px;
    }

    .login-form {
        padding: 25px 20px;
    }

    .form-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .btn {
        width: 100%;
    }

    .forgot-password {
        text-align: center;
        margin-left: 0;
        justify-content: center;
        width: 100%;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }

    .footer-info p {
        justify-content: center;
    }

    .footer-copy {
        text-align: center;
        margin-top: 15px;
    }

    .toggle-password {
        right: 40px;
    }

    .main-content:not(:has(.login-wrapper)) .container {
        padding: 25px 20px;
    }

    table#form_table {
        display: block;
    }

    table#form_table tbody, table#form_table tr, table#form_table td {
        display: block;
        width: 100%;
    }

    table#form_table td.col1:first-child {
        text-align: left;
        padding-right: 0;
        padding-bottom: 5px;
    }

    table#form_table td.col2 {
        text-align: left;
        padding-top: 5px;
    }
}