/* Authentication UI Styles */

/* Auth Button in Header */
#authButton {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #8B4513 0%, #A0522D 100%);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.25);
}

#authButton:hover {
    background: linear-gradient(135deg, #A0522D 0%, #8B4513 100%);
    box-shadow: 0 6px 16px rgba(139, 69, 19, 0.35);
    transform: translateY(-2px);
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* When user is logged in - different styling */
#authButton.logged-in {
    background: linear-gradient(135deg, #8B4513 0%, #A0522D 100%) !important;
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.25) !important;
}

#authButton.logged-in:hover {
    background: linear-gradient(135deg, #A0522D 0%, #8B4513 100%) !important;
    box-shadow: 0 6px 16px rgba(139, 69, 19, 0.35) !important;
}

/* User Menu Dropdown */
.user-menu {
    position: absolute;
    top: 70px;
    right: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 250px;
    z-index: 1000;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: auto;
}

.user-menu.hidden {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    display: none; /* Completely hide when not visible */
}

.user-menu-header {
    padding: 16px;
    border-bottom: 1px solid #eee;
}

.user-menu-username {
    font-weight: 600;
    font-size: 16px;
    color: #333;
    margin-bottom: 4px;
}

.user-menu-email {
    font-size: 13px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 6px;
}

.verification-badge {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    cursor: help;
}

.verification-badge.verified {
    background: #e8f5e9;
    color: #2e7d32;
}

.verification-badge.unverified {
    background: #fff3e0;
    color: #e65100;
}

.verification-item {
    font-size: 13px;
    color: #666;
}

.verification-item:hover {
    background: #fff3e0;
    color: #e65100;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 14px;
    color: #333;
    position: relative;
    z-index: 1;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
}

.user-menu-item:hover {
    background: #f5f5f5;
}

.user-menu-logout {
    color: #f44336;
}

.user-menu-logout:hover {
    background: #ffebee;
    color: #d32f2f;
}

.user-menu-divider {
    height: 1px;
    background: #eee;
    margin: 8px 0;
}

/* Auth Modal */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.auth-modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.auth-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s, color 0.2s;
}

.auth-modal-close:hover {
    background: #f5f5f5;
    color: #333;
}

/* Auth Tabs */
.auth-tabs {
    display: flex;
    gap: 0;
    padding: 24px 24px 0;
    border-bottom: 2px solid #eee;
}

.auth-tab {
    flex: 1;
    padding: 12px 16px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 16px;
    font-weight: 500;
    color: #999;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    margin-bottom: -2px;
}

.auth-tab.active {
    color: #333;
    border-bottom-color: #333;
}

.auth-tab:hover {
    color: #666;
}

/* Auth Forms */
.auth-form-container {
    padding: 32px 24px 24px;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.auth-form h2 {
    margin: 0 0 24px 0;
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #333;
}

/* Password Requirements */
.password-requirements {
    margin-top: 8px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 13px;
}

.requirement-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    transition: all 0.2s ease;
}

.requirement-item:last-child {
    margin-bottom: 0;
}

.requirement-icon {
    font-size: 14px;
    font-weight: bold;
    min-width: 16px;
    transition: all 0.2s ease;
}

.requirement-text {
    color: #666;
    transition: color 0.2s ease;
}

.requirement-item.valid .requirement-text {
    color: #10b981;
}

.requirement-item.invalid .requirement-text {
    color: #ef4444;
}

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

.password-input-wrapper input {
    width: 100%;
    padding-right: 4.5rem;
}

.password-toggle-btn {
    position: absolute;
    right: 0.5rem;
    background: none;
    border: none;
    color: #667eea;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
}

.password-toggle-btn:hover {
    color: #8B4513;
    background: rgba(139, 69, 19, 0.08);
}

.field-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #888;
    line-height: 1.4;
}

.form-group input.input-invalid {
    border-color: #ef4444;
}

.form-group input.input-invalid:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.form-error {
    color: #f44336;
    font-size: 13px;
    margin-bottom: 16px;
    padding: 8px 12px;
    background: #ffebee;
    border-radius: 6px;
    display: none;
    line-height: 1.5;
    white-space: normal;
    word-wrap: break-word;
}

.form-error:not(:empty) {
    display: block;
}

.auth-submit-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #8B4513 0%, #A0522D 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.25);
}

.auth-submit-btn:hover {
    background: linear-gradient(135deg, #A0522D 0%, #8B4513 100%);
    box-shadow: 0 6px 16px rgba(139, 69, 19, 0.35);
    transform: translateY(-2px);
}

.auth-submit-btn:active {
    transform: translateY(0) scale(0.98);
}

.auth-submit-btn:disabled {
    background: #999;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Toast Messages */
.toast-message {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 16px 24px;
    background: #333;
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 3000;
    font-size: 14px;
    font-weight: 500;
    transform: translateY(100px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.toast-message.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-success {
    background: #4caf50;
}

.toast-error {
    background: #f44336;
}

.toast-info {
    background: #2196f3;
}

/* Dark mode styles for toast messages */
body.dark-mode .toast-message {
    background: #2a2a2a;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

body.dark-mode .toast-success {
    background: #4caf50;
}

body.dark-mode .toast-error {
    background: #f44336;
}

body.dark-mode .toast-info {
    background: #2196f3;
}

/* Responsive Design */
@media (max-width: 768px) {
    .auth-modal-content {
        width: 95%;
        max-width: none;
        border-radius: 12px;
    }

    .user-menu {
        right: 10px;
        left: 10px;
        min-width: auto;
    }

    #authButton {
        padding: 6px 12px;
        font-size: 13px;
    }

    .auth-tabs {
        padding: 16px 16px 0;
    }

    .auth-form-container {
        padding: 24px 16px 16px;
    }

    .auth-form h2 {
        font-size: 20px;
    }
}

/* Header Integration */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    flex-wrap: wrap;
    gap: 20px;
}

header .header-left {
    flex: 1;
    min-width: 0;
}

header .header-title h1 {
    margin: 0;
}

header .header-title p {
    margin: 5px 0 0 0;
}

header .auth-container {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.auth-button {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 10px 20px !important;
    background: linear-gradient(135deg, #8B4513 0%, #A0522D 100%) !important;
    color: white !important;
    border: none !important;
    border-radius: 25px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
    white-space: nowrap !important;
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.25) !important;
}

.auth-button:hover {
    background: linear-gradient(135deg, #A0522D 0%, #8B4513 100%) !important;
    box-shadow: 0 6px 16px rgba(139, 69, 19, 0.35) !important;
    transform: translateY(-2px) !important;
}

/* Favorites Button Styling */
.favorite-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #FF5252 0%, #E91E63 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(255, 82, 82, 0.3);
}

.favorite-btn:hover {
    background: linear-gradient(135deg, #E91E63 0%, #C2185B 100%);
    box-shadow: 0 6px 16px rgba(255, 82, 82, 0.4);
    transform: translateY(-2px);
}

.favorite-btn:active {
    transform: translateY(0) scale(0.98);
}

.favorite-btn svg {
    transition: fill 0.3s ease;
}

.favorite-btn:hover svg {
    fill: white;
}

@media (max-width: 768px) {
    header {
        padding: 15px 20px;
        flex-direction: column;
        align-items: stretch;
    }
    
    header .auth-container {
        justify-content: center;
    }
    
    .auth-button span {
        display: inline;
    }
}

/* Dark Mode Styles */
body.dark-mode .user-menu {
    background: #1e1e1e;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

body.dark-mode .user-menu-header {
    border-bottom-color: #333333;
}

body.dark-mode .user-menu-username {
    color: #e0e0e0;
}

body.dark-mode .user-menu-email {
    color: #a0a0a0;
}

body.dark-mode .user-menu-item {
    color: #e0e0e0;
}

body.dark-mode .user-menu-item:hover {
    background: #242424;
}

body.dark-mode .auth-modal {
    background: rgba(0, 0, 0, 0.7);
}

body.dark-mode .auth-modal-content {
    background: #1e1e1e;
}

body.dark-mode .auth-modal-close {
    color: #a0a0a0;
}

body.dark-mode .auth-modal-close:hover {
    background: #242424;
    color: #e0e0e0;
}

body.dark-mode .auth-tabs {
    border-bottom-color: #333333;
}

body.dark-mode .auth-tab {
    color: #a0a0a0;
}

body.dark-mode .auth-tab.active {
    color: #e0e0e0;
    border-bottom-color: #cd853f;
}

body.dark-mode .auth-tab:hover {
    color: #e0e0e0;
}

body.dark-mode .auth-form h2 {
    color: #e0e0e0;
}

body.dark-mode .form-group label {
    color: #e0e0e0;
}

body.dark-mode .form-group input {
    background: #242424;
    border-color: #333333;
    color: #e0e0e0;
}

body.dark-mode .form-group input:focus {
    border-color: #cd853f;
    background: #2a2a2a;
}

body.dark-mode .form-group input::placeholder {
    color: #666;
}

/* Dark mode password requirements */
body.dark-mode .password-requirements {
    background: #1e1e1e;
    border: 1px solid #333;
}

body.dark-mode .requirement-text {
    color: #999;
}

body.dark-mode .requirement-item.valid .requirement-text {
    color: #10b981;
}

body.dark-mode .requirement-item.invalid .requirement-text {
    color: #ef4444;
}

body.dark-mode .password-toggle-btn {
    color: #cd853f;
}

body.dark-mode .password-toggle-btn:hover {
    color: #deb887;
    background: rgba(205, 133, 63, 0.15);
}

body.dark-mode .field-hint {
    color: #888;
}

body.dark-mode .form-group input.input-invalid {
    border-color: #ef4444;
}

body.dark-mode .form-error {
    background: #5a1a1a;
    color: #ff6b6b;
    border-color: #7a2a2a;
}

body.dark-mode .verification-badge.verified {
    background: #1e3a1e;
    color: #4caf50;
}

body.dark-mode .verification-badge.unverified {
    background: #3a2a1a;
    color: #ff9800;
}

body.dark-mode .verification-item:hover {
    background: #3a2a1a;
    color: #ff9800;
}

