/* ==========================================================================
   Authentication Premium Design
   ========================================================================== */

/* Importing variables from the main premium design system */
@import url('finance/finance-variables.css');

/* ==========================================================================
   1. Base & Page Layout
   ========================================================================== */
body {
    background-color: var(--section-bg, #f8f9fa);
    font-family: var(--font-primary, 'Inter', sans-serif);
    min-height: 100vh;
    margin: 0;
    color: var(--text-primary);
}

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-container-premium {
    width: 100%;
    max-width: 420px;
    padding: var(--spacing-lg, 1.5rem);
}

.auth-container-premium--large {
    max-width: 600px;
}

/* ==========================================================================
   2. Authentication Card
   ========================================================================== */
.auth-card {
    background: var(--card-bg, #ffffff);
    border-radius: var(--radius-xl, 20px);
    border: 1px solid var(--border-color, #e0e0e0);
    box-shadow: var(--shadow-strong, 0 8px 32px rgba(0, 0, 0, 0.1));
    padding: var(--spacing-xl, 2rem) var(--spacing-lg, 1.5rem);
    animation: fadeIn 0.5s ease-out;
}

.auth-card--centered {
    text-align: center;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   3. Typography
   ========================================================================== */
.auth-card h1 {
    font-family: var(--font-headings, 'Manrope', sans-serif);
    font-size: 2rem;
    font-weight: var(--fw-bold, 700);
    text-align: center;
    margin-top: 0;
    margin-bottom: var(--spacing-lg, 1.5rem);
    letter-spacing: var(--ls-tight, -0.025em);
}

.auth-card h2 {
    margin-top: 2rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.auth-card .auth-card-intro {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.auth-card .text-secondary {
    color: var(--text-secondary);
}

/* ==========================================================================
   4. Forms & Inputs
   ========================================================================== */
.auth-card form .form-group {
    margin-bottom: 1rem;
}

.auth-card form label {
    display: none; /* Hidden by default for a cleaner look, but kept for accessibility */
}

.auth-card form input[type="text"],
.auth-card form input[type="password"],
.auth-card form input[type="email"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md, 12px);
    border: 1px solid var(--border-light, #ccc);
    background-color: var(--section-bg, #f8f9fa);
    color: var(--text-primary);
    font-family: var(--font-primary, 'Inter', sans-serif);
    transition: all var(--transition-fast, 0.2s);
}

.auth-card form input[type="text"]:focus,
.auth-card form input[type="password"]:focus,
.auth-card form input[type="email"]:focus {
    outline: none;
    border-color: var(--primary-color, #007F81);
    box-shadow: 0 0 0 3px rgba(0, 127, 129, 0.2);
}

.error-message {
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* ==========================================================================
   5. Buttons
   ========================================================================== */
.auth-card .btn-primary {
    width: 100%;
    padding: 0.85rem 1rem;
    border: none;
    border-radius: var(--radius-md, 12px);
    background: var(--gradient-primary, linear-gradient(135deg, #007F81, #4db6ac));
    color: var(--text-white, #fff);
    font-size: 1rem;
    font-weight: var(--fw-bold, 700);
    cursor: pointer;
    transition: all var(--transition-normal, 0.3s);
    box-shadow: var(--shadow-light, 0 2px 8px rgba(0, 127, 129, 0.1));
    margin-top: 1rem;
}

.auth-card .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover, 0 16px 48px rgba(0, 127, 129, 0.2));
}

/* ==========================================================================
   6. Links & Options
   ========================================================================== */
.auth-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg, 1.5rem);
    margin-top: var(--spacing-sm, 0.5rem);
}

.auth-options .form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auth-options .form-check-label {
    display: block; /* Overrides the default hidden label style */
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.terms-agreement {
    margin: 1rem 0;
}

.terms-agreement .form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.terms-agreement .form-check-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.terms-agreement a {
    color: var(--primary-color);
    font-weight: var(--fw-semibold, 600);
    text-decoration: none;
}

.terms-agreement a:hover {
    text-decoration: underline;
}

.form-check-input {
    width: 1.1rem;
    height: 1.1rem;
    margin-top: 0.1rem;
    accent-color: var(--primary-color);
    cursor: pointer;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-light);
    transition: all var(--transition-fast, 0.2s);
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3e%3c/svg%3e");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 70%;
}

.form-check-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.25);
}

.form-check-label {
    user-select: none;
}

.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

[data-theme="dark"] .form-check-input {
    background-color: #2a2d3a;
    border-color: rgba(76, 175, 80, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

[data-theme="dark"] .form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.4);
}

[data-theme="dark"] .terms-agreement a {
    color: #4CAF50;
}

[data-theme="dark"] .terms-agreement a:hover {
    color: #5fd365;
}

.auth-options a,
.auth-links a {
    font-size: 0.9rem;
    color: var(--primary-color, #007F81);
    text-decoration: none;
    transition: color var(--transition-fast, 0.2s);
}

.auth-options a:hover,
.auth-links a:hover {
    text-decoration: underline;
    color: var(--primary-dark, #004f51);
}

.signup-link-premium {
    text-align: center;
    margin-top: var(--spacing-lg, 1.5rem);
    color: var(--text-muted, #6c757d);
}

.signup-link-premium a {
    color: var(--primary-color, #007F81);
    font-weight: var(--fw-semibold, 600);
    text-decoration: none;
}

.signup-link-premium a:hover {
    text-decoration: underline;
    color: var(--primary-dark, #004f51);
}

.auth-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--spacing-md, 1rem);
}

.auth-links--centered {
    justify-content: center;
    margin-top: 1.5rem;
}

/* ==========================================================================
   7. Email Management Page Specifics
   ========================================================================== */
.email-list-premium .ctrl-group {
    padding: var(--spacing-md, 1rem);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg, 16px);
    margin-bottom: var(--spacing-md, 1rem);
    display: flex;
    align-items: center;
    transition: all var(--transition-fast, 0.2s);
}

.email-list-premium .ctrl-group:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 127, 129, 0.2);
}

.email-list-premium label {
    display: flex; /* Overrides the default hidden label style */
    align-items: center;
    gap: 1rem;
    width: 100%;
    cursor: pointer;
    font-weight: var(--fw-semibold, 600);
}

.email-list-premium .tag {
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
    border-radius: 1rem;
    font-weight: var(--fw-bold, 700);
    text-transform: uppercase;
    border: 1px solid transparent;
}

.email-list-premium .verified {
    background-color: var(--success-bg);
    color: var(--success-color);
    border-color: var(--success-color);
}
.email-list-premium .unverified {
    background-color: var(--warning-bg);
    color: var(--warning-color);
    border-color: var(--warning-color);
}
.email-list-premium .primary {
    background-color: var(--primary-light-bg);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

[data-theme="dark"] .email-list-premium .verified { background-color: rgba(74, 222, 128, 0.2); color: #a7f3d0; }
[data-theme="dark"] .email-list-premium .unverified { background-color: rgba(251, 191, 36, 0.2); color: #fde68a; }
[data-theme="dark"] .email-list-premium .primary { background-color: rgba(77, 182, 172, 0.2); color: #4db6ac; }

.email-button-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm, 0.5rem);
    margin-top: var(--spacing-md, 1rem);
}

.email-button-group button {
    flex-grow: 1;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md, 12px);
    font-size: 0.875rem;
    font-weight: var(--fw-semibold, 600);
    transition: all var(--transition-fast, 0.2s);
    border: 1px solid var(--border-light);
}

.email-button-group .btn-secondary {
    background-color: var(--button-secondary-bg);
    color: var(--button-secondary-text);
}
.email-button-group .btn-secondary:hover {
    background-color: var(--button-secondary-hover-bg);
    border-color: var(--primary-color);
}

.email-button-group .btn-info {
    background-color: var(--info-bg);
    color: var(--info-color);
    border-color: var(--info-color);
}
.email-button-group .btn-info:hover {
    background: var(--info-color);
    color: var(--card-bg);
}

.email-button-group .btn-danger {
    background-color: var(--danger-bg);
    color: var(--danger-color);
    border-color: var(--danger-color);
}
.email-button-group .btn-danger:hover {
    background: var(--danger-color);
    color: var(--card-bg);
}

/* ==========================================================================
   8. Add Email Form Specifics
   ========================================================================== */
form.add_email {
    margin-top: var(--spacing-xl, 2rem);
    border-top: 1px solid var(--border-color);
    padding-top: var(--spacing-lg, 1.5rem);
}

form.add_email .form-group {
    position: relative;
}

/* Icon inside the email input */
form.add_email .form-group::before {
    content: '✉️';
    position: absolute;
    left: 1rem;
    top: 0.8rem;
    color: var(--text-muted);
    pointer-events: none;
    font-size: 1.1rem;
    z-index: 2;
}

form.add_email input[type="email"] {
    padding-left: 3.2rem; /* Make space for the icon */
}

/* Style for the input when it's invalid */
form.add_email input[aria-invalid="true"] {
    border-color: var(--danger-color);
    background-color: var(--danger-bg);
}

form.add_email input[aria-invalid="true"]:focus {
    border-color: var(--danger-color);
    box-shadow: 0 0 0 3px var(--danger-shadow);
}

/* Styling the error message */
form.add_email .error-message {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: var(--spacing-sm) var(--spacing-md);
    margin-top: var(--spacing-sm);
    background-color: var(--danger-bg);
    border-left: 4px solid var(--danger-color);
    border-radius: var(--radius-sm);
    color: var(--danger-text);
    font-weight: var(--fw-semibold);
}

form.add_email .error-message::before {
    content: "⚠️";
    font-size: 1.1rem;
    line-height: 1;
}

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    padding-right: 40px !important; /* Обеспечивает место для иконки */
    width: 100%; /* Убедимся, что поле ввода занимает всю ширину */
}

.toggle-password {
    position: absolute;
    right: 1px; /* Сдвигаем немного левее от края */
    top: 1px; /* Сдвигаем немного ниже от края */
    bottom: 1px; /* Сдвигаем немного выше от края */
    width: 38px; /* Фиксированная ширина для кнопки */
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    padding: 0;
}

.toggle-password .eye-icon {
    font-size: 1.2rem;
    color: #6c757d;
    transition: color 0.2s ease-in-out;
}

.password-input-wrapper input:focus + .toggle-password .eye-icon {
    color: #007bff;
}

.toggle-password:focus {
    outline: none;
}

.social-login-container {
    margin-top: 1.5rem;
    text-align: center;
}

.social-login-divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: #6c757d;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.social-login-divider::before,
.social-login-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #dee2e6;
}

.social-login-divider:not(:empty)::before {
    margin-right: .5em;
}

.social-login-divider:not(:empty)::after {
    margin-left: .5em;
}

.social-login-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.social-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid #dee2e6;
    background-color: #fff;
    color: #fff;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.social-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.yandex-btn {
    background-color: #ff3333;
    border-color: #cc0000;
}

.yandex-btn:hover {
    background-color: #e60000;
}

.yandex-btn svg {
    width: 24px;
    height: 24px;
}

/* ==========================================================================
   9. Responsive Design
   ========================================================================== */
@media (max-width: 768px) {
    .auth-container-premium {
        max-width: 100%;
        padding: var(--spacing-md, 1rem);
    }
}

@media (max-width: 480px) {
    .auth-card h1 {
        font-size: 1.75rem;
    }
    
    .email-list-premium label {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
}

/* ==========================================================================
   10. New Email Management Styles
   ========================================================================== */
.email-list-new {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.email-item {
    background-color: var(--section-bg);
    padding: 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    transition: all 0.2s ease-in-out;
}

.email-item input[type="radio"]:checked + .email-address {
    color: var(--primary-color);
    font-weight: var(--fw-bold);
}

.email-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-light);
}

.email-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-grow: 1;
}

.email-management-form .email-address {
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.email-item input[type="radio"] {
    accent-color: var(--primary-color);
    width: 1.2rem;
    height: 1.2rem;
}

.email-address {
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.icon-email {
    /* Placeholder for an icon if you want to add one */
}

.email-tags {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 1rem;
}

.email-actions {
    display: flex;
    gap: 0.5rem;
}

/* Responsive adjustments for new email styles */
@media (max-width: 640px) {
    .email-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .email-actions {
        width: 100%;
        justify-content: flex-start;
        border-top: 1px solid var(--border-light);
        padding-top: 1rem;
        margin-top: 0.5rem;
    }

    .email-tags {
        margin-left: 0;
        margin-top: 0.5rem;
        width: 100%;
    }
}

.form-group-premium input {
     width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md, 12px);
    border: 1px solid var(--border-light, #ccc);
    background-color: var(--section-bg, #f8f9fa);
    color: var(--text-primary);
    font-family: var(--font-primary, 'Inter', sans-serif);
    transition: all var(--transition-fast, 0.2s);
}

/* ==========================================================================
   Auth Header & Enhanced Elements
   ========================================================================== */
.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.auth-header .auth-card-intro {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 0;
}

/* ==========================================================================
   Alert Styles
   ========================================================================== */
.alert {
    padding: 1rem;
    border-radius: var(--radius-lg, 16px);
    border-left: 4px solid;
    margin-bottom: 1.5rem;
    background-color: var(--card-bg);
}

.alert-danger {
    border-left-color: var(--danger-color, #dc3545);
    background-color: var(--danger-bg, #fff5f5);
    color: var(--danger-text, #b91c1c);
}

.alert-heading {
    font-weight: var(--fw-bold, 700);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

[data-theme="dark"] .alert-danger {
    background-color: rgba(220, 53, 69, 0.1);
    color: #fca5a5;
}

/* ==========================================================================
   Password Input Wrapper with Toggle
   ========================================================================== */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    padding-right: 3rem !important;
}

.toggle-password {
    position: absolute;
    right: 1rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-size: 1.2rem;
    color: var(--text-secondary);
    transition: color var(--transition-fast, 0.2s);
    z-index: 2;
}

.toggle-password:hover {
    color: var(--primary-color);
}

.toggle-password:focus {
    outline: none;
    color: var(--primary-color);
}

.eye-icon {
    font-size: 1.1rem;
    user-select: none;
}

/* ==========================================================================
   Enhanced Form Elements
   ========================================================================== */
.form-group label {
    display: block !important; /* Show labels with icons */
    font-weight: var(--fw-semibold, 600);
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.help-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    line-height: 1.4;
}

.error-message {
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* ==========================================================================
   Enhanced Button Styles
   ========================================================================== */
.btn-outline-primary {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.7rem 1.5rem;
    border-radius: var(--radius-md, 12px);
    font-weight: var(--fw-semibold, 600);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all var(--transition-normal, 0.3s);
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover, 0 8px 24px rgba(0, 127, 129, 0.3));
    text-decoration: none;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-color);
    text-decoration: none;
    padding: 0.5rem 1rem;
    font-weight: var(--fw-medium, 500);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: color var(--transition-fast, 0.2s);
}

.btn-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ==========================================================================
   Icon Integration
   ========================================================================== */
.fas {
    font-size: 0.9em;
}

/* ==========================================================================
   Dark Theme Support
   ========================================================================== */
[data-theme="dark"] .auth-header h1 {
    color: var(--primary-color-dark, #4db6ac);
}

[data-theme="dark"] .toggle-password {
    color: var(--text-secondary-dark);
}

[data-theme="dark"] .toggle-password:hover {
    color: var(--primary-color-dark, #4db6ac);
} 