/**
 * CarSearch.pro - Authentication UI Styles
 * Clean, modern design matching the main viewer
 */

/* ============================================================================
   USER MENU (Logged In State)
   ============================================================================ */

.user-menu {
    position: relative;
    display: inline-block;
}

.user-menu-trigger {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 16px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.user-menu-trigger:hover {
    background: var(--surface-hover);
    border-color: var(--accent);
}

.dropdown-arrow {
    font-size: 10px;
    transition: transform 0.2s ease;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    min-width: 200px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    overflow: hidden;
}

.user-dropdown-item {
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.user-dropdown-item:hover {
    background: var(--surface-hover);
}

/* ============================================================================
   AUTH MODAL
   ============================================================================ */

.auth-modal {
    max-width: 440px !important;
    padding: 40px !important;
}

.auth-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    text-align: center;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 32px;
    line-height: 1.6;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-input {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
    color: var(--text-primary);
    font-size: 15px;
    transition: all 0.2s ease;
    outline: none;
}

.auth-input:focus {
    border-color: var(--accent);
    background: var(--bg-secondary);
}

.auth-input::placeholder {
    color: var(--text-tertiary);
}

.auth-button {
    background: var(--accent);
    border: none;
    border-radius: 8px;
    padding: 14px 24px;
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.auth-button:hover {
    background: #ff8559;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.auth-button:active {
    transform: translateY(0);
}

.auth-button-secondary {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 24px;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-button-secondary:hover {
    background: var(--surface-hover);
    border-color: var(--accent);
}

.auth-divider {
    text-align: center;
    margin: 8px 0;
    color: var(--text-tertiary);
    font-size: 13px;
}

.auth-message {
    margin-top: 16px;
    padding: 12px;
    border-radius: 6px;
    background: var(--surface);
    text-align: center;
    font-size: 14px;
    display: none;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
    .auth-modal {
        max-width: 90vw !important;
        padding: 24px !important;
    }

    .auth-title {
        font-size: 24px;
    }

    .user-menu-trigger {
        padding: 8px 12px;
        font-size: 13px;
    }

    .user-dropdown {
        min-width: 180px;
    }
}

/* ============================================================================
   LOADING STATES
   ============================================================================ */

.auth-button.loading {
    opacity: 0.6;
    cursor: not-allowed;
    position: relative;
}

.auth-button.loading::after {
    content: '';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: translateY(-50%) rotate(360deg); }
}

/* ============================================================================
   USER PORTAL - ENHANCED DASHBOARD
   ============================================================================ */

/* Portal Modal - Full Width */
.portal-modal {
    max-width: 1400px !important;
    width: 95% !important;
    height: 90vh !important;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Portal Header */
.portal-header {
    padding: 24px 32px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.portal-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.portal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    transition: all 0.2s ease;
}

.portal-close-btn:hover {
    color: var(--text-primary);
    transform: scale(1.1);
}

.portal-logout-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.portal-logout-btn:hover {
    background: var(--surface-hover);
    border-color: var(--error);
    color: var(--error);
    transform: translateY(-1px);
}

/* Portal Tabs */
.portal-tabs {
    display: flex;
    gap: 4px;
    padding: 16px 32px 0 32px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.portal-tab {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    padding: 12px 24px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.portal-tab:hover {
    color: var(--text-primary);
    background: var(--surface);
}

.portal-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.portal-tab-icon {
    font-size: 16px;
}

/* Portal Content Area */
.portal-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    background: var(--bg-primary);
}

.portal-tab-content {
    display: none;
}

.portal-tab-content.active {
    display: block;
}

/* Dashboard Stats Row */
.dashboard-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.dashboard-stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.2s ease;
}

.dashboard-stat-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.1);
}

.dashboard-stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.dashboard-stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
}

/* Section Tabs (Active / Past Listings) */
.section-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}

.section-tab {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 600;
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.section-tab:hover {
    color: var(--text-primary);
}

.section-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.section-tab-count {
    display: inline-block;
    background: var(--surface);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    margin-left: 6px;
}

.section-tab.active .section-tab-count {
    background: rgba(255, 107, 53, 0.15);
    color: var(--accent);
}

/* Listings Grid - Enhanced Card Design */
.portal-listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Enhanced Listing Card with Overlay Design (Matching Main Page) */
.portal-listing-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
    cursor: pointer;
}

.portal-listing-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(255, 107, 53, 0.2);
}

/* Image Container with Overlay */
.portal-listing-image-wrapper {
    position: relative;
    width: 100%;
    height: 280px;
    overflow: hidden;
}

.portal-listing-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.portal-listing-card:hover .portal-listing-image {
    transform: scale(1.08);
}

/* Gradient Overlay (Like Landing Page) */
.portal-listing-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.7) 60%, transparent 100%);
    color: white;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.portal-listing-title {
    font-size: 16px;
    font-weight: 600;
    color: white;
    line-height: 1.3;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.portal-listing-price {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.portal-listing-specs {
    font-size: 13px;
    color: rgba(255,255,255,0.9);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Status Badge */
.portal-listing-status-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.status-active {
    background: rgba(0, 217, 165, 0.25);
    color: var(--success);
    border: 1px solid rgba(0, 217, 165, 0.4);
}

.status-sold {
    background: rgba(239, 68, 68, 0.25);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.status-removed {
    background: rgba(160, 160, 160, 0.25);
    color: var(--text-secondary);
    border: 1px solid rgba(160, 160, 160, 0.4);
}

/* AI Score Badge */
.portal-listing-ai-score {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 700;
    border: 2px solid;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Card Actions (Below Image) */
.portal-listing-actions {
    padding: 16px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    background: var(--bg-secondary);
}

.portal-action-btn {
    flex: 1;
    min-width: 120px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.portal-action-btn:hover {
    background: var(--surface-hover);
    border-color: var(--accent);
}

.portal-action-btn.danger {
    color: var(--error);
}

.portal-action-btn.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--error);
}

/* Notes Section */
.portal-listing-notes {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.portal-listing-notes textarea {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
    transition: all 0.2s ease;
}

.portal-listing-notes textarea:focus {
    border-color: var(--accent);
    outline: none;
    background: var(--bg-secondary);
}

.portal-listing-notes textarea::placeholder {
    color: var(--text-tertiary);
}

/* Empty State */
.portal-empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

.portal-empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.portal-empty-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.portal-empty-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.portal-empty-action {
    background: var(--accent);
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.portal-empty-action:hover {
    background: #ff8559;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

/* ============================================================================
   SETTINGS TAB
   ============================================================================ */

.settings-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.settings-section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-section-icon {
    font-size: 20px;
}

/* Intent Selector */
.intent-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.intent-option {
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.intent-option:hover {
    border-color: var(--accent);
    background: var(--surface);
}

.intent-option.selected {
    border-color: var(--accent);
    background: rgba(255, 107, 53, 0.1);
}

.intent-option-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.intent-option-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.intent-option-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Vehicle Interests */
.vehicle-interests-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}

.vehicle-interest-card {
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.vehicle-interest-card:hover {
    border-color: var(--accent);
}

.vehicle-interest-card.selected {
    border-color: var(--accent);
    background: rgba(255, 107, 53, 0.1);
}

.vehicle-interest-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
}

.vehicle-interest-card.selected .vehicle-interest-checkbox {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.vehicle-interest-info {
    flex: 1;
}

.vehicle-interest-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.vehicle-interest-count {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Notification Settings */
.notification-settings {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.notification-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.notification-item:hover {
    background: var(--surface);
}

.notification-item-info {
    flex: 1;
}

.notification-item-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.notification-item-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    background: var(--border);
    border-radius: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-switch.on {
    background: var(--accent);
}

.toggle-switch-handle {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch.on .toggle-switch-handle {
    left: 25px;
}

/* Email Display */
.email-display {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    padding: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.email-display-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.email-display-icon {
    font-size: 24px;
}

.email-display-text {
    flex: 1;
}

.email-display-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.email-display-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.email-verified-badge {
    background: rgba(0, 217, 165, 0.15);
    color: var(--success);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Save Settings Button */
.settings-save-btn {
    background: var(--accent);
    border: none;
    color: white;
    padding: 14px 32px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    margin-top: 24px;
}

.settings-save-btn:hover {
    background: #ff8559;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.settings-save-btn:active {
    transform: translateY(0);
}

/* ============================================================================
   ALERTS TAB (Coming Soon)
   ============================================================================ */

.alerts-coming-soon {
    text-align: center;
    padding: 100px 20px;
}

.alerts-coming-soon-icon {
    font-size: 80px;
    margin-bottom: 24px;
    opacity: 0.6;
}

.alerts-coming-soon-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.alerts-coming-soon-text {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    line-height: 1.6;
}

.alerts-features-list {
    display: inline-block;
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px 32px;
    margin: 0 auto;
}

.alerts-features-list li {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alerts-features-list li::before {
    content: '✓';
    color: var(--success);
    font-weight: 700;
    font-size: 18px;
}

/* ============================================================================
   RESPONSIVE - MOBILE OPTIMIZATIONS
   ============================================================================ */

@media (max-width: 1024px) {
    .portal-listings-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .portal-modal {
        width: 100% !important;
        height: 100vh !important;
        border-radius: 0 !important;
    }

    .portal-header {
        padding: 16px 20px;
    }

    .portal-header h2 {
        font-size: 20px;
    }

    .portal-tabs {
        padding: 12px 20px 0 20px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .portal-tab {
        padding: 10px 16px;
        font-size: 13px;
        white-space: nowrap;
    }

    .portal-content {
        padding: 20px;
    }

    .dashboard-stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-stat-card {
        padding: 16px;
    }

    .dashboard-stat-value {
        font-size: 24px;
    }

    .portal-listings-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .portal-listing-image-wrapper {
        height: 240px;
    }

    .portal-listing-price {
        font-size: 20px;
    }

    .portal-listing-title {
        font-size: 14px;
    }

    .portal-listing-actions {
        flex-direction: column;
    }

    .portal-action-btn {
        min-width: 0;
    }

    .intent-selector {
        grid-template-columns: 1fr;
    }

    .vehicle-interests-grid {
        grid-template-columns: 1fr;
    }

    .section-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .section-tab {
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .portal-listing-overlay {
        padding: 16px;
    }

    .portal-listing-specs {
        font-size: 12px;
        gap: 8px;
    }

    .dashboard-stats-row {
        grid-template-columns: 1fr;
    }
}
