/* Authentication UI Styles */

/* ============================================
   Account Menu in Header
   ============================================ */

.header .container-fluid {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.account-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.9rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.user-menu-btn:hover {
    background: var(--background-color);
    box-shadow: var(--shadow-sm);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--primary-color);
}

.user-name {
    font-weight: 500;
    color: var(--text-primary);
}

.dropdown-arrow {
    color: var(--text-secondary);
    font-size: 0.75rem;
    transition: transform 0.2s;
}

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

.user-menu {
    position: relative;
}

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 250px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem 0;
    z-index: 1000;
}

.user-menu-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.user-email {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.user-plan-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    background: var(--success-color);
    color: white;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.user-plan-badge.free {
    background: var(--text-secondary);
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    color: var(--text-primary);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
}

.menu-item:hover {
    background: var(--background-color);
}

.menu-item span:first-child {
    font-size: 1.125rem;
}

.menu-divider {
    margin: 0.5rem 0;
    border: none;
    border-top: 1px solid var(--border-color);
}

.upgrade-link {
    color: var(--warning-color);
    font-weight: 500;
}

/* ============================================
   Usage Banners
   ============================================ */

.usage-banner {
    background: var(--warning-color);
    color: white;
    padding: 0.75rem 0;
    box-shadow: var(--shadow-sm);
}

.usage-banner.anonymous-banner {
    background: #4285f4;
}

.usage-banner.limit-warning-banner {
    background: var(--error-color);
}

.usage-banner.verification-banner {
    background: #ff9800;
}

.banner-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: space-between;
}

.banner-icon {
    font-size: 1.5rem;
}

.banner-text {
    flex: 1;
    font-size: 0.9375rem;
}

.remaining-count {
    font-weight: 700;
    font-size: 1.125rem;
}

/* ============================================
   Modal Styles
   ============================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.modal-content {
    position: relative;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

.modal-small {
    max-width: 400px;
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--background-color);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--background-color);
}

.auth-footer-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
    margin: 0;
}

/* ============================================
   Auth Tabs
   ============================================ */

.auth-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.auth-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: -2px;
}

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

.auth-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.auth-tab-content {
    display: none;
}

.auth-tab-content.active {
    display: block;
}

.auth-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* ============================================
   Auth Forms
   ============================================ */

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.password-toggle-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    background: var(--background-color);
    padding: 0.25rem;
    border-radius: var(--border-radius);
}

.toggle-btn {
    flex: 1;
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 500;
    border-radius: calc(var(--border-radius) - 2px);
    cursor: pointer;
    transition: var(--transition);
}

.toggle-btn:hover {
    color: var(--text-primary);
}

.toggle-btn.active {
    background: white;
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.link-button {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 0.875rem;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    margin-bottom: 0.5rem;
    text-align: left;
}

.link-button:hover {
    color: var(--primary-hover);
}

.btn-full {
    width: 100%;
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
}

.btn-google:hover {
    background: var(--background-color);
    border-color: var(--text-secondary);
}

.google-icon {
    width: 20px;
    height: 20px;
}

.auth-message {
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
}

.auth-message.success {
    background: #e6f4ea;
    color: #137333;
    border: 1px solid #0f9d58;
}

.auth-message.error {
    background: #fce8e6;
    color: #c5221f;
    border: 1px solid #ea4335;
}

/* ============================================
   Mobile Responsive
   ============================================ */

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .banner-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .user-name {
        display: none;
    }

    .user-menu-dropdown {
        right: auto;
        left: 0;
    }

    .auth-tabs {
        flex-direction: column;
        gap: 0;
        border-bottom: none;
    }

    .auth-tab {
        border-bottom: 1px solid var(--border-color);
        border-left: 3px solid transparent;
        margin-bottom: 0;
        text-align: left;
    }

    .auth-tab.active {
        border-left-color: var(--primary-color);
        border-bottom-color: var(--border-color);
        background: var(--background-color);
    }
}

/* ============================================
   Usage Meter
   ============================================ */

.usage-meter {
    margin: 1rem 0;
    padding: 1rem;
    background: var(--background-color);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.usage-meter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.usage-meter-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.usage-meter-value {
    font-weight: 600;
    color: var(--text-primary);
}

.usage-meter-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.usage-meter-fill {
    height: 100%;
    background: var(--success-color);
    border-radius: 4px;
    transition: width 0.3s ease, background 0.3s ease;
}

.usage-meter-fill.warning {
    background: var(--warning-color);
}

.usage-meter-fill.danger {
    background: var(--error-color);
}

.usage-meter-text {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ============================================
   Focus and Accessibility
   ============================================ */

.auth-tab:focus,
.toggle-btn:focus,
.user-menu-btn:focus,
.menu-item:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.modal-close:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}
