/* ========================================
   Learning OS — Auth Component Styles
   ======================================== */

/* --- Login Button (in nav) --- */
.auth-login-btn {
    font-size: 0.8125rem;
    padding: 6px 14px;
    min-height: 32px;
    gap: 5px;
    border: 1px solid transparent;
    background: #6366F1;
    color: #fff;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    font-weight: 600;
}

.auth-login-btn:hover {
    background: #4F46E5;
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.auth-login-btn i {
    font-size: 0.75rem;
    color: #fff;
    line-height: 1;
}

/* --- User Menu (in nav) --- */
.auth-user-menu {
    display: flex;
    align-items: center;
    position: relative;
}

.auth-user-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border-radius: var(--radius-full);
    border: 1.5px solid var(--color-gray-200);
    background: var(--color-white);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.auth-user-trigger:hover {
    border-color: var(--color-primary-200);
    box-shadow: 0 0 0 3px var(--color-primary-50);
}

.auth-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--color-gray-200);
}

.auth-user-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-gray-700);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-dropdown-arrow {
    font-size: 0.625rem;
    color: var(--color-gray-400);
    transition: transform var(--transition-fast);
}

.auth-user-dropdown.open .auth-dropdown-arrow {
    transform: rotate(180deg);
}

/* --- Dropdown --- */
.auth-user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 220px;
    background: var(--color-white);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all var(--transition-fast);
    z-index: calc(var(--z-nav, 1000) + 10);
}

.auth-user-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.auth-dropdown-header {
    padding: 8px 12px;
}

.auth-dropdown-email {
    font-size: 0.75rem;
    color: var(--color-gray-500);
    word-break: break-all;
}

.auth-dropdown-divider {
    height: 1px;
    background: var(--color-gray-100);
    margin: 6px 0;
}

.auth-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    font-size: 0.875rem;
    color: var(--color-gray-700);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    font: inherit;
    text-decoration: none;
}

.auth-dropdown-item:hover {
    background: var(--color-gray-50);
    color: var(--color-primary);
}

.auth-dropdown-item i {
    font-size: 0.8125rem;
    width: 16px;
    text-align: center;
    color: var(--color-gray-400);
}

.auth-dropdown-item:hover i {
    color: var(--color-primary);
}

.auth-dropdown-logout {
    color: var(--color-error, #EF4444);
}

.auth-dropdown-logout i {
    color: var(--color-error, #EF4444);
}

.auth-dropdown-logout:hover {
    background: rgba(239, 68, 68, 0.06);
    color: var(--color-error, #EF4444);
}

.auth-dropdown-logout:hover i {
    color: var(--color-error, #EF4444);
}

/* ========================================
   Login Modal
   ======================================== */
.auth-modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal, 2000);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base, 0.2s ease);
}

.auth-modal.open {
    opacity: 1;
    visibility: visible;
}

.auth-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.auth-modal-content {
    position: relative;
    background: var(--color-white);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-xl, 16px);
    padding: 40px 36px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    transform: translateY(20px) scale(0.97);
    transition: transform var(--transition-base, 0.2s ease);
    margin: 0 16px;
}

.auth-modal.open .auth-modal-content {
    transform: translateY(0) scale(1);
}

.auth-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md, 8px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-gray-400);
    background: none;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast, 0.15s ease);
}

.auth-modal-close:hover {
    background: var(--color-gray-100);
    color: var(--color-gray-600);
}

.auth-modal-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-modal-logo {
    width: 44px;
    height: 44px;
    margin: 0 auto 16px;
    border-radius: 10px;
    overflow: hidden;
}

.auth-modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-gray-900);
    margin-bottom: 6px;
}

.auth-modal-header p {
    font-size: 0.875rem;
    color: var(--color-gray-500);
}

/* --- Provider Buttons --- */
.auth-modal-providers,
.auth-provider-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 24px;
}

.auth-provider-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    border: 1px solid #374151;
    border-radius: var(--radius-md, 8px);
    background: #111827;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: all var(--transition-base, 0.2s ease);
}

.auth-provider-btn:hover {
    background: #1F2937;
    border-color: #4B5563;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.auth-provider-btn:active {
    transform: translateY(0);
}

.auth-provider-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* FontAwesome icons inside provider buttons */
.auth-provider-btn i {
    font-size: 0.875rem;
    color: #fff;
    line-height: 1;
}

/* SVG icons inside provider buttons */
.auth-provider-btn .auth-provider-icon {
    display: block;
}

/* --- Terms Text --- */
.auth-modal-terms,
.auth-modal-note {
    text-align: center;
    font-size: 0.75rem;
    color: var(--color-gray-400);
    line-height: 1.6;
    margin: 0;
}

.auth-modal-terms a {
    color: var(--color-primary);
    text-decoration: underline;
}

/* ========================================
   Toast (error notification)
   ======================================== */
.auth-toast {
    position: fixed;
    top: 84px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: var(--radius-lg, 12px);
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 9999;
    animation: auth-toast-in 0.3s ease;
}

.auth-toast-error {
    background: rgba(239, 68, 68, 0.08);
    color: #EF4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

@keyframes auth-toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ========================================
   Dark Mode Overrides
   ======================================== */
[data-theme="dark"] .auth-login-btn {
    background: #818CF8;
    border-color: transparent;
    color: #fff;
}

[data-theme="dark"] .auth-login-btn:hover {
    background: #6366F1;
    color: #fff;
    box-shadow: 0 4px 14px rgba(129, 140, 248, 0.4);
}

[data-theme="dark"] .auth-login-btn i {
    color: #fff;
}

[data-theme="dark"] .auth-user-trigger {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .auth-user-trigger:hover {
    border-color: rgba(129, 140, 248, 0.35);
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.12);
}

[data-theme="dark"] .auth-user-name {
    color: #E5E7EB;
}

[data-theme="dark"] .auth-avatar {
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .auth-user-dropdown {
    background: #1F2937;
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .auth-dropdown-email {
    color: #9CA3AF;
}

[data-theme="dark"] .auth-dropdown-divider {
    background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .auth-dropdown-item {
    color: #D1D5DB;
}

[data-theme="dark"] .auth-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--color-primary-light, #818CF8);
}

[data-theme="dark"] .auth-dropdown-item i {
    color: #6B7280;
}

[data-theme="dark"] .auth-dropdown-item:hover i {
    color: var(--color-primary-light, #818CF8);
}

[data-theme="dark"] .auth-dropdown-logout:hover {
    background: rgba(239, 68, 68, 0.15);
}

/* Modal dark */
[data-theme="dark"] .auth-modal-backdrop {
    background: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .auth-modal-content {
    background: #111827;
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .auth-modal-close {
    color: #6B7280;
}

[data-theme="dark"] .auth-modal-close:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #9CA3AF;
}

[data-theme="dark"] .auth-modal-header h3 {
    color: #F3F4F6;
}

[data-theme="dark"] .auth-modal-header p {
    color: #9CA3AF;
}

[data-theme="dark"] .auth-provider-btn {
    border-color: rgba(255, 255, 255, 0.12);
    background: #1F2937;
    color: #fff;
}

[data-theme="dark"] .auth-provider-btn:hover {
    background: #374151;
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .auth-provider-btn i {
    color: #fff;
}

[data-theme="dark"] .auth-modal-terms,
[data-theme="dark"] .auth-modal-note {
    color: #6B7280;
}

[data-theme="dark"] .auth-modal-terms a,
[data-theme="dark"] .auth-modal-note a {
    color: var(--color-primary-light, #818CF8);
}

/* ========================================
   Mobile Responsive
   ======================================== */
@media (max-width: 1024px) {
    .auth-user-name {
        display: none;
    }

    .auth-user-trigger {
        padding: 3px;
        border-radius: 50%;
    }

    .auth-dropdown-arrow {
        display: none;
    }
}

@media (max-width: 768px) {
    .auth-user-name {
        display: none;
    }

    .auth-user-trigger {
        padding: 3px;
        border-radius: 50%;
    }

    .auth-dropdown-arrow {
        display: none;
    }

    .auth-user-dropdown {
        width: auto;
        min-width: 200px;
        max-width: calc(100vw - 32px);
        right: 0;
    }

    .auth-modal-content {
        padding: 32px 24px;
        margin: 0 16px;
    }
}

/* ========================================
   Navigation responsive alignment hardening
   Loaded last to override style/dark media rules.
   ======================================== */
@media (max-width: 1024px) {
    #main-nav .nav-container {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 12px;
    }

    #main-nav .nav-logo {
        margin-right: auto !important;
        flex: 0 0 auto;
    }

    #main-nav .nav-links {
        display: none !important;
    }

    #main-nav .nav-links.open {
        display: flex !important;
    }

    #main-nav .nav-actions {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 10px;
        margin-left: 0 !important;
        flex: 0 0 auto;
    }

    #main-nav .nav-actions .btn,
    #main-nav .auth-login-btn,
    #main-nav .site-controls,
    #main-nav .control-btn,
    #main-nav .mobile-menu-btn {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    #main-nav .nav-actions .site-controls {
        display: flex !important;
        margin-left: 0;
    }

    #main-nav .mobile-menu-btn {
        display: flex !important;
        margin-left: 2px !important;
    }
}
