:root {
    --vyc-surface: #ffffff;
    --vyc-border: #dce3ef;
    --vyc-ink: #132133;
    --vyc-muted: #5b677a;
    --vyc-primary: #1f9b84;
    --vyc-primary-dark: #187c68;
    --vyc-amber: #f4a259;
    --vyc-background: #eff3f9;
}

/* =============================================================================
   Login Modal Styles (Matched to Free Analysis Modal)
   ============================================================================= */

.login-modal {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 9, 20, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(10px);
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.login-modal.open {
    opacity: 1;
    visibility: visible;
}

.login-modal-content {
    background: #ffffff;
    border-radius: 24px;
    border: 1px solid rgba(19, 33, 51, 0.08);
    box-shadow: 0 30px 80px rgba(6, 12, 24, 0.35);
    max-width: 520px;
    width: min(520px, 100%);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.login-modal.open .login-modal-content {
    transform: translateY(0);
}

.login-modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(19, 33, 51, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
    color: inherit;
}

.login-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--vyc-ink, #132133);
    font-weight: 600;
}

.login-modal-close {
    font-size: 2rem;
    color: var(--vyc-muted, #5b677a);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
    background: transparent;
    border: none;
    padding: 0;
}

.login-modal-close:hover {
    color: var(--vyc-ink, #132133);
    opacity: 1;
}

.login-modal-body {
    padding: 1.5rem;
}

.login-modal-description {
    color: var(--vyc-muted, #5b677a);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.login-form .form-group {
    margin-bottom: 1rem;
}

.login-form label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    color: var(--vyc-ink, #132133);
    font-size: 1rem;
}

.login-form input[type="email"],
.login-form input[type="text"] {
    width: 100%;
    padding: 0.75rem 0.8rem;
    border: 1px solid var(--vyc-border, #dce3ef);
    border-radius: 10px;
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.login-form input:focus {
    outline: none;
    border-color: var(--vyc-primary, #1f9b84);
    box-shadow: 0 0 0 4px rgba(31, 155, 132, 0.1);
}

.login-form .form-hint {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.85rem;
    color: var(--vyc-muted, #5b677a);
}

.login-modal-actions {
    display: flex;
    gap: 0.8rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.login-modal-actions .btn {
    flex: 1;
    justify-content: center;
    white-space: nowrap;
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.login-modal-actions .btn-primary {
    background: var(--vyc-primary, #1f9b84);
    color: white;
    box-shadow: 0 4px 12px rgba(31, 155, 132, 0.25);
}

.login-modal-actions .btn-primary:hover {
    background: var(--vyc-primary-dark, #187c68);
    transform: translateY(-1px);
}

.login-modal-actions .btn-secondary {
    background: #fff;
    color: var(--vyc-ink, #132133);
    border: 1px solid var(--vyc-border, #dce3ef);
}

.login-modal-actions .btn-secondary:hover {
    border-color: var(--vyc-muted, #5b677a);
    background: #f8fbff;
}

.login-modal-actions .btn-tertiary {
    background: transparent;
    color: var(--vyc-muted, #5b677a);
    border: 1px solid transparent;
}

.login-modal-actions .btn-tertiary:hover {
    color: var(--vyc-ink, #132133);
    background: rgba(19, 33, 51, 0.03);
}

/* Checkbox styles */
.checkbox-group {
    margin-bottom: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--vyc-ink, #132133);
    gap: 0.6rem;
}

.checkbox-label input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--vyc-primary, #1f9b84);
    cursor: pointer;
}

.login-error {
    background: #fee2e2;
    color: #dc2626;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    border: 1px solid #fecaca;
}

/* =============================================================================
   Global Sidebar Styles
   ============================================================================= */

.saved-cars-sidebar {
    position: fixed;
    top: 56px; /* Below topbar */
    right: -360px;
    width: 340px;
    height: calc(100vh - 56px);
    background: #ffffff;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 1500;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
}

.saved-cars-sidebar.open {
    right: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--primary-color, #00563f);
    color: white;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header h3 svg {
    stroke: white;
}

.sidebar-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.sidebar-close:hover {
    opacity: 1;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.sidebar-footer .btn {
    flex: 1;
    text-align: center;
    padding: 10px 16px;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 6px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sidebar-footer .btn-danger {
    background-color: #ffffff;
    color: var(--danger-color, #dc3545);
    border: 1px solid var(--danger-color, #dc3545);
}

.sidebar-footer .btn-danger:hover {
    background-color: var(--danger-color, #dc3545);
    color: #ffffff;
}

.sidebar-footer .btn-primary {
    background-color: var(--primary-color, #00563f);
    color: #ffffff;
    border: 1px solid var(--primary-color, #00563f);
}

.sidebar-footer .btn-primary:hover {
    background-color: var(--accent-color, #c47e5a);
    border-color: var(--accent-color, #c47e5a);
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    position: fixed;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    background: var(--primary-color, #00563f);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 86, 63, 0.3);
    z-index: 1400;
    transition: transform 0.2s, box-shadow 0.2s;
}

.sidebar-toggle:hover {
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 86, 63, 0.4);
}

.sidebar-toggle svg {
    stroke: white;
}

.sidebar-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #dc2626;
    color: white;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.sidebar-badge:empty,
.sidebar-badge[data-count="0"] {
    display: none;
}

/* Saved Cars List in Sidebar */
.saved-cars-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.saved-cars-empty {
    text-align: center;
    color: #666;
    padding: 40px 20px;
}

.saved-cars-empty svg {
    width: 64px;
    height: 64px;
    stroke: #ccc;
    margin-bottom: 16px;
}

.saved-cars-empty p {
    margin: 0;
    font-size: 0.95rem;
}

/* Saved Car Card in Sidebar */
.sidebar-car-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.sidebar-car-card:hover {
    border-color: var(--primary-color, #00563f);
    box-shadow: 0 2px 8px rgba(0, 86, 63, 0.1);
}

.sidebar-car-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #333;
    margin-bottom: 8px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sidebar-car-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.sidebar-car-tag {
    font-size: 0.75rem;
    background: #e5e7eb;
    color: #555;
    padding: 3px 8px;
    border-radius: 4px;
}

.sidebar-car-tag.price {
    background: #dcfce7;
    color: #166534;
    font-weight: 600;
}

.sidebar-car-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.sidebar-car-actions .btn-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: #e5e7eb;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.sidebar-car-actions .btn-icon:hover {
    background: #d1d5db;
}

.sidebar-car-actions .btn-icon.btn-danger:hover {
    background: #fee2e2;
    color: #dc2626;
}

.sidebar-car-actions .btn-icon svg {
    width: 16px;
    height: 16px;
}

/* =============================================================================
   Overlay Enhancement
   ============================================================================= */

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1450;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* =============================================================================
   Button Variants
   ============================================================================= */

.btn-secondary {
    background: #e5e7eb;
    color: #374151;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-secondary:hover {
    background: #d1d5db;
    text-decoration: none;
}

.btn-danger {
    background: #dc2626;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 0.85rem;
}

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

@media (max-width: 768px) {
    .saved-cars-sidebar {
        width: 100%;
        right: -100%;
    }
    
    .sidebar-toggle {
        bottom: 80px;
        top: auto;
        right: 16px;
        transform: none;
    }
    
    .sidebar-toggle:hover {
        transform: scale(1.05);
    }
    
    .login-modal-content {
        width: 95%;
        margin: 20px;
    }
}

/* =============================================================================
   Profile Dropdown Button Updates
   ============================================================================= */

.profile-dropdown-actions .btn-secondary {
    text-decoration: none;
}

.profile-dropdown-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
}

.profile-dropdown-actions .btn {
    flex: 1 1 calc(50% - 5px);
    min-width: 0;
    text-align: center;
    box-sizing: border-box;
}

/* For authenticated view with 3 buttons: first two share row, third is full width */
.profile-dropdown-actions .btn-danger {
    flex: 1 1 100%;
    margin-top: 4px;
}
