/**
 * Session State Styling
 * Styles for logout button and session management UI
 */

/* Favourites container in top bar - appears first (left) */
.top-bar .favourites-container {
    position: relative;
    margin-right: 0.5rem; /* Small spacing to the right */
    z-index: 100;
}

/* Fixed auth container - always visible in top bar - appears second (right) */
.auth-container {
    position: relative;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 35px; /* Minimum width to ensure container doesn't collapse */
    min-height: 32px; /* Match button height to maintain consistent layout */
}

/* The auth container holds both login and logout buttons, but only one is visible at a time.
 * Container width adapts to content: ~32px for logout icon, ~150px for login text.
 * This gives natural spacing while preventing complete collapse.
 * HTML order matches visual order (no CSS order property needed). */

/* Top-bar auth button styling - scoped to prevent conflicts with subscription popup */
.top-bar-logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid #cbd5e0;
    border-radius: 20px;
    padding: 0.4rem 0.7rem;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.85;
    height: 36.55px; /* Match favourites counter height exactly */
    width: auto;
    color: #94a3b8 !important;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.8rem;
    white-space: nowrap;
}

/* Top-bar login button - Text link styling */
.top-bar-login-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid #cbd5e0;
    border-radius: 20px;
    padding: 0.4rem 0.7rem;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.85;
    height: auto;
    width: auto;
    color: #64748b;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.8rem;
    white-space: nowrap;
}

.top-bar-logout-btn:hover {
    opacity: 1;
    background: #dc2626;
    border-color: #dc2626;
    color: #ffffff !important;
}

.top-bar-login-btn:hover {
    opacity: 1;
    background: var(--primary, #5fc73e);
    border-color: var(--primary, #5fc73e);
    color: #ffffff;
}

.top-bar-logout-btn:active,
.top-bar-login-btn:active {
    transform: scale(0.98);
}

/* Invisible counter to match bookmark button structure exactly */
.login-invisible-counter {
    display: none; /* Completely remove from layout - don't take up any space */
    font-weight: 600;
    color: var(--dashboard-text);
    min-width: 0;
    text-align: center;
    opacity: 0;
    pointer-events: none;
}

/* Logout success message */
.logout-success-message {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 9999;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: 1px solid #c3e6cb;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    transform: translateX(100px) scale(0.9);
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    pointer-events: none;
}

.logout-success-message.show {
    opacity: 1;
    transform: translateX(0) scale(1);
}

.logout-message-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #155724;
    font-weight: 600;
    font-size: 0.95rem;
}

.logout-message-content i {
    color: #28a745;
    font-size: 1.1rem;
}

/* Responsive design */
@media (max-width: 768px) {
    /* Maintain flexbox container architecture on mobile:
     * - top-bar keeps display: flex
     * - favourites-container (first) and auth-container (second) stay aligned
     * - No absolute positioning to ensure vertical alignment
     * - HTML order matches visual order naturally */
    .auth-container {
        min-width: 30px; /* Smaller minimum on mobile */
    }
    
    .top-bar-logout-btn {
        height: 32px; /* Match favourites counter height on mobile */
        padding: 0 0.6rem;
        font-size: 0.75rem;
    }
    
    .top-bar-login-btn {
        height: 32px; /* Match favourites counter height */
        padding: 0 0.6rem;
        font-size: 0.75rem;
    }
    
    .logout-success-message {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        padding: 0.8rem 1rem;
    }
    
    .logout-message-content {
        font-size: 0.9rem;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    /* Keep flexbox layout on small screens - no absolute positioning */
    .auth-container {
        min-width: 28px; /* Even smaller minimum on very small screens */
    }
    
    .top-bar-logout-btn {
        height: 30px; /* Match favourites counter height on small mobile */
        padding: 0 0.55rem;
        font-size: 0.7rem;
    }
    
    .top-bar-login-btn {
        height: 30px; /* Match favourites counter height */
        padding: 0 0.55rem;
        font-size: 0.7rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .top-bar-logout-btn {
        background: transparent;
        border-color: #cbd5e0;
        color: #f9fafb;
    }
    
    .top-bar-login-btn {
        background: transparent;
        border-color: var(--primary, #5fc73e);
        color: var(--primary, #5fc73e);
    }
    
    .top-bar-logout-btn:hover {
        background: #dc2626;
        border-color: #dc2626;
        color: #ffffff;
    }
    
    .top-bar-login-btn:hover {
        background: var(--primary, #5fc73e);
        border-color: var(--primary, #5fc73e);
        color: #fff;
    }
    
    .logout-success-message {
        background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
        border-color: #059669;
    }
    
    .logout-message-content {
        color: #d1fae5;
    }
    
    .logout-message-content i {
        color: #34d399;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .top-bar-logout-btn {
        border: 3px solid #000;
        background: transparent;
        color: #000;
    }
    
    .top-bar-logout-btn:hover {
        background: #dc2626;
        border-color: #dc2626;
        color: #ffffff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .top-bar-logout-btn,
    .top-bar-login-btn,
    .logout-success-message {
        transition: none;
    }
    
    .top-bar-logout-btn:hover,
    .top-bar-login-btn:hover {
        transform: none;
    }
    
    .top-bar-logout-btn:hover i {
        transform: none;
    }
}


