/**
 * Zazen Auth & Surfy Magic Link Auth - Frontend Stylesheet
 * Congress Machine Integration
 */

/* ==========================================================================
   1. Navigation Controls (Top Nav & Mobile Drawer)
   ========================================================================== */

.auth-nav-container {
    display: flex;
    align-items: center;
    position: relative;
}

/* Logged Out: Sign In Button */
.auth-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
    text-decoration: none;
    font-family: inherit;
}

.auth-nav-btn .material-symbols-rounded {
    font-size: 18px;
    color: var(--accent-blue);
    transition: transform 0.18s ease;
}

.auth-nav-btn:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.auth-nav-btn:hover .material-symbols-rounded {
    transform: scale(1.1);
}

/* Logged In: User Dropdown Trigger */
.auth-user-dropdown {
    position: relative;
}

.auth-user-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 12px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
    font-family: inherit;
}

.auth-user-btn .user-avatar-icon {
    font-size: 20px;
    color: var(--accent-blue);
}

.auth-user-email {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.auth-user-btn .arrow-icon {
    font-size: 18px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.auth-user-btn[aria-expanded="true"] .arrow-icon {
    transform: rotate(180deg);
}

.auth-user-btn:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

/* User Account Dropdown Menu */
.auth-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 250px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    z-index: 1000;
    display: none;
    flex-direction: column;
    animation: authFadeSlideDown 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.auth-dropdown-menu.show {
    display: flex;
}

@keyframes authFadeSlideDown {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-dropdown-header {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.auth-dropdown-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.auth-dropdown-full-email {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-all;
}

.auth-dropdown-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--accent-green);
    margin-top: 4px;
}

.auth-dropdown-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.auth-dropdown-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 4px 0;
}

.auth-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}

.auth-dropdown-item .material-symbols-rounded {
    font-size: 18px;
    color: inherit;
}

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

.auth-dropdown-item.auth-logout-btn:hover {
    background: var(--accent-red-subtle);
    color: var(--accent-red);
}

/* Mobile Drawer Auth Row */
.mobile-nav-auth-container {
    padding: 12px 14px;
    border-top: 1px solid var(--border-subtle);
    margin-top: 6px;
}

.mobile-auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    border-radius: var(--radius-md);
    background: var(--accent-blue-subtle);
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}

.mobile-auth-btn:hover {
    background: var(--accent-blue);
    color: #ffffff;
}

.mobile-user-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mobile-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.mobile-user-info .material-symbols-rounded {
    font-size: 20px;
    color: var(--accent-blue);
}

.mobile-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--accent-red);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}

.mobile-logout-btn:hover {
    background: var(--accent-red-subtle);
    border-color: var(--accent-red);
}


/* ==========================================================================
   2. Accessible Auth Modal Dialog
   ========================================================================== */

.auth-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(9, 13, 22, 0.78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-modal-overlay.active {
    display: flex;
    opacity: 1;
}

.auth-modal-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 100%;
    max-width: 440px;
    padding: 34px 28px 28px;
    box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    text-align: center;
    transform: scale(0.96) translateY(8px);
    transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-modal-overlay.active .auth-modal-card {
    transform: scale(1) translateY(0);
}

.auth-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.18s ease;
    padding: 0;
}

.auth-modal-close:hover {
    background: var(--border-color);
    color: var(--text-primary);
    transform: rotate(90deg);
}

.auth-modal-close .material-symbols-rounded {
    font-size: 19px;
}

.auth-badge-icon {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(0, 245, 212, 0.15) 0%, rgba(56, 189, 248, 0.15) 100%);
    border: 1px solid rgba(0, 245, 212, 0.35);
    color: #00f5d4;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px auto;
    box-shadow: 0 8px 20px rgba(0, 245, 212, 0.15);
}

:root:not([data-theme="dark"]) .auth-badge-icon {
    background: var(--accent-blue-subtle);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.15);
}

.auth-badge-icon .material-symbols-rounded {
    font-size: 30px;
}

.auth-modal-title {
    color: var(--text-primary);
    font-size: 22px;
    font-weight: 800;
    margin: 0 0 8px 0;
    letter-spacing: -0.02em;
}

.auth-modal-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 24px 0;
}

/* Modal Form Controls */
.auth-form-group {
    margin-bottom: 16px;
    text-align: left;
}

.auth-input-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.auth-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input-icon {
    position: absolute;
    left: 14px;
    font-size: 19px;
    color: var(--text-muted);
    pointer-events: none;
    transition: color 0.15s ease;
}

.auth-input {
    width: 100%;
    box-sizing: border-box;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 13px 16px 13px 44px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: all 0.18s ease;
    font-family: inherit;
}

.auth-input:focus {
    border-color: var(--accent-blue);
    box-shadow: var(--shadow-glow-blue);
}

.auth-input:focus + .auth-input-icon,
.auth-input-wrapper:focus-within .auth-input-icon {
    color: var(--accent-blue);
}

.auth-input[aria-invalid="true"] {
    border-color: var(--accent-red) !important;
    box-shadow: 0 0 0 3px var(--accent-red-subtle) !important;
}

/* Submit Button */
.auth-submit-btn {
    width: 100%;
    height: 48px;
    border-radius: var(--radius-md);
    border: none;
    background: linear-gradient(135deg, #00f5d4 0%, #38bdf8 100%);
    color: #090d16;
    font-weight: 800;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 6px 18px rgba(0, 245, 212, 0.25);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: inherit;
    margin-top: 18px;
}

:root:not([data-theme="dark"]) .auth-submit-btn {
    background: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
    color: #ffffff;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.25);
}

.auth-submit-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(0, 245, 212, 0.4);
}

:root:not([data-theme="dark"]) .auth-submit-btn:hover:not(:disabled) {
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.4);
}

.auth-submit-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

/* Modal Alerts */
.auth-alert {
    padding: 13px 15px;
    border-radius: var(--radius-md);
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 18px;
    text-align: left;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: authFadeIn 0.2s ease forwards;
}

@keyframes authFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-alert.error {
    background: rgba(220, 38, 38, 0.12);
    border: 1px solid rgba(220, 38, 38, 0.3);
    color: var(--accent-red);
}

.auth-alert.success {
    background: rgba(22, 163, 74, 0.12);
    border: 1px solid rgba(22, 163, 74, 0.3);
    color: var(--accent-green);
}

.auth-alert .material-symbols-rounded {
    font-size: 19px;
    flex-shrink: 0;
    margin-top: 1px;
}

.auth-modal-footer {
    margin-top: 20px;
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.auth-modal-footer .material-symbols-rounded {
    font-size: 16px;
}

/* ==========================================================================
   3. Floating Toast Notifications
   ========================================================================== */

.auth-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.auth-toast {
    pointer-events: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 380px;
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-primary);
    animation: authToastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: all 0.2s ease;
}

.auth-toast.closing {
    opacity: 0;
    transform: translateY(12px) scale(0.95);
}

@keyframes authToastIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.92);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-toast-icon {
    font-size: 22px;
    flex-shrink: 0;
}

.auth-toast.success .auth-toast-icon {
    color: var(--accent-green);
}

.auth-toast.error .auth-toast-icon {
    color: var(--accent-red);
}

.auth-toast.info .auth-toast-icon {
    color: var(--accent-blue);
}

.auth-toast-content {
    flex: 1;
}

.auth-toast-title {
    font-weight: 700;
    margin-bottom: 2px;
    font-size: 13px;
}

.auth-toast-message {
    color: var(--text-secondary);
    font-size: 12px;
}

.auth-toast-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease;
}

.auth-toast-close:hover {
    color: var(--text-primary);
}

.auth-toast-close .material-symbols-rounded {
    font-size: 16px;
}

@media (max-width: 600px) {
    .auth-toast-container {
        left: 16px;
        right: 16px;
        bottom: 16px;
    }
    .auth-toast {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .auth-nav-btn {
        padding: 0 9px;
    }
    .auth-nav-btn span:not(.material-symbols-rounded) {
        display: none;
    }
    .auth-user-btn {
        padding: 0 8px;
    }
    .auth-user-email {
        max-width: 80px;
    }
    .auth-modal-card {
        padding: 28px 20px 22px;
    }
}
