:root {
    /* Light mode colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    
    /* Accent colors */
    --accent-primary: #6366f1;
    --accent-primary-hover: #4f46e5;
    --accent-secondary: #8b5cf6;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --accent-info: #3b82f6;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-success: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-dark: linear-gradient(135deg, #1f2937 0%, #111827 100%);
}

[data-theme="dark"] {
    /* Dark mode colors */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --border-color: #334155;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.25);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Navigation Bar */
.navbar {
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    background-color: rgba(var(--bg-primary-rgb), 0.9);
}

.navbar-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
}

.navbar-brand-icon {
    width: 32px;
    height: 32px;
    background: transparent;/*var(--gradient-primary);*/
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background-color: var(--bg-tertiary);
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent-success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background-color: var(--bg-tertiary);
}

/* Main Container */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* Header Section */
.header-section {
    margin-bottom: 32px;
}

.header-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.header-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    gap: 4px;
    margin-bottom: 32px;
    background-color: var(--bg-tertiary);
    padding: 4px;
    border-radius: 12px;
    overflow-x: auto;
}

.tab-button {
    padding: 10px 20px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-button:hover {
    color: var(--text-primary);
}

.tab-button.active {
    background-color: var(--bg-primary);
    color: var(--accent-primary);
    box-shadow: var(--shadow-sm);
}

.tab-icon {
    font-size: 1.125rem;
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* Cards */
.card {
    background-color: var(--bg-primary);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 4px;
}

/* Grid Layouts */
.grid {
    display: grid;
    gap: 24px;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background-color: var(--accent-primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--accent-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

.btn-success {
    background: var(--gradient-success);
    color: white;
}

.btn-danger {
    background-color: var(--accent-danger);
    color: white;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: var(--bg-secondary);
}

.upload-area:hover {
    border-color: var(--accent-primary);
    background-color: var(--bg-tertiary);
}

.upload-area.dragover {
    border-color: var(--accent-primary);
    background-color: rgba(99, 102, 241, 0.05);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    color: var(--text-tertiary);
}

.upload-text {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.upload-hint {
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

/* Stats Cards */
.stat-card {
    background: var(--gradient-primary);
    border-radius: 12px;
    padding: 20px;
    color: white;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

.stat-change {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 12px;
}

/* Results Section */
.results-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 24px;
}

.result-image-container {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background-color: var(--bg-secondary);
}

.result-image {
    width: 100%;
    height: auto;
    display: block;
}

.detection-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 16px;
    background-color: var(--bg-secondary);
    border-radius: 12px;
}

.detection-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    margin-bottom: 8px;
    background-color: var(--bg-primary);
    border-radius: 8px;
    border-left: 3px solid var(--accent-primary);
}

.detection-label {
    font-weight: 500;
    color: var(--text-primary);
}

.detection-confidence {
    display: flex;
    align-items: center;
    gap: 8px;
}

.confidence-bar {
    width: 60px;
    height: 4px;
    background-color: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: var(--gradient-success);
    transition: width 0.3s ease;
}

.confidence-text {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    min-width: 40px;
    text-align: right;
}

/* Application Cards */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.app-card {
    background-color: var(--bg-primary);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.app-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.app-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.app-card:hover::before {
    transform: scaleX(1);
}

.app-icon {
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 16px;
    color: white;
}

.app-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.app-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.app-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--gradient-success);
    color: white;
    font-size: 0.625rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    text-transform: uppercase;
}

/* Alerts */
.alert {
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--accent-success);
}

.alert-error {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--accent-danger);
}

.alert-info {
    background-color: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: var(--accent-info);
}

/* Loading States */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Slider */
.slider-container {
    margin-bottom: 20px;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-tertiary);
    outline: none;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 0 8px rgba(99, 102, 241, 0.1);
}

.slider-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--accent-primary);
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    transition: width 0.3s ease;
}

/* Bounding Box Styling */
.bbox {
    position: absolute;
    box-sizing: border-box;
    border: 2px solid var(--accent-primary);
    background-color: rgba(99, 102, 241, 0.1);
    border-radius: 4px;
}
.bbox-label {
    position: absolute;
    top: -22px;
    left: -2px;
    background-color: var(--accent-primary);
    color: white;
    padding: 2px 6px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 4px;
    white-space: nowrap;
}
/* Segmentation Canvas*/
.segmentation-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Allows clicking through the canvas to the image */
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar-container {
        padding: 0 16px;
    }
    
    .main-container {
        padding: 16px;
    }
    
    .tab-nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .results-container {
        grid-template-columns: 1fr;
    }
    
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}


/* Model Details */
.detail-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid var(--border-color);
}
.detail-item:last-child {
    border-bottom: none;
}

.detail-key {
    font-weight: 500;
    color: var(--text-secondary);
    padding-right: 16px;
}

.detail-value {
    color: var(--text-primary);
    text-align: right;
    word-break: break-all;
}

.detail-value pre {
    text-align: left;
    margin-top: 8px;
    font-size: 0.75rem;
}
/* Modal Styles */
.modal-overlay {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background-color: var(--bg-primary);
    margin: auto;
    padding: 32px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 90%;
    max-width: 800px;
    box-shadow: var(--shadow-xl);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-close-button {
    position: absolute;
    top: 16px;
    right: 20px;
    color: var(--text-tertiary);
    font-size: 28px;
    font-weight: bold;
    border: none;
    background: none;
    cursor: pointer;
}

.modal-close-button:hover,
.modal-close-button:focus {
    color: var(--text-primary);
}

.modal-header h2 {
    font-size: 1.75rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.modal-header p {
    font-size: 1rem;
    color: var(--text-secondary);
}

.modal-body {
    margin-top: 24px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

@media (min-width: 768px) {
    .modal-body {
        grid-template-columns: 1fr 1fr;
    }
}

.modal-image-container {
    /* Basic Layout */
    position: relative;
    width: 100%;
    max-width: 300px; /* Set a max-width to keep the card shape */
    margin: 0 auto; /* Center the card within its grid column */
    
    /* The "Pokemon Card" aspect ratio (taller than wide) */
    aspect-ratio: 5 / 7; 
    
    /* Visual Flair */
    border-radius: 16px; /* Rounded corners for the card */
    background: var(--bg-tertiary);
    box-shadow: var(--shadow-md);
    padding: 12px; /* A "frame" around the image */
    overflow: hidden; /* Important for the shine effect */
    transition: transform 0.3s ease;
}

.modal-image-container:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: var(--shadow-lg);
}

.modal-image-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 70%;
    height: 100%;
    background: linear-gradient(
        90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.4) 50%, 
        transparent 100%
    );
    transform: skewX(-25deg);
    transition: left 0.5s ease-in-out;
}

.modal-image-container:hover::before {
    left: 150%;
}

#modal-image {
    width: 100%;
    height: 100%;
    border-radius: 8px; /* Slightly smaller radius for the inner image */
    
    /* This ensures the image fills the container without stretching/distorting */
    object-fit: cover; 
}

.modal-details-container h3 {
    margin-bottom: 16px;
}

.modal-details-container h4 {
    margin-top: 12px;
    margin-bottom: 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.modal-details-container pre {
    /* This will now only apply to any raw <pre> tags we might add later,
    but our new formatted details will use the classes above. */
    background-color: var(--bg-secondary);
    padding: 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text-primary);
}

/* --- MODEL LIST CARDS --- */
.model-list-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end; /* Pushes the text content to the bottom */
    width: 100%;
    aspect-ratio: 5 / 7;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    
    /* Background properties are the same */
    background-size: cover;
    background-position: center;
    background-color: #111827; 
    background-image: var(--gradient-dark);
}

/* --- THIS IS THE KEY: The Scrim Gradient --- */
/* This re-introduces the overlay, but as a subtle gradient from the bottom. */
.model-list-card::after {
    content: '';
    position: absolute;
    inset: 0; 
    
    /* The scrim gradient: it's completely transparent for the top 50%
       and gently fades to a dark color at the bottom to create a readable
       background for the text. */
    background: linear-gradient(
        180deg, 
        transparent 50%, 
        rgba(15, 23, 42, 0.6) 75%, 
        rgba(15, 23, 42, 0.85) 100%
    );
    
    /* This ensures a smooth effect if we ever want to change it on hover */
    transition: background 0.3s ease;
}

.model-list-card:hover {
    transform: translateY(-8px) scale(1.03);
    box-shadow: var(--shadow-xl);
}

/* Optional: Make the scrim slightly lighter on hover to reveal more image */
.model-list-card:hover::after {
    background: linear-gradient(
        180deg, 
        transparent 60%, 
        rgba(15, 23, 42, 0.5) 80%, 
        rgba(15, 23, 42, 0.75) 100%
    );
}

/* The holographic shine effect (no changes needed here) */
.model-list-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 70%;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.2) 50%, transparent 100%);
    transform: skewX(-25deg);
    transition: left 0.6s ease-in-out;
    z-index: 2; /* Sits on top of the scrim */
}
.model-list-card:hover::before {
    left: 150%;
}

/* Container for the text content */
.model-card-content {
    position: relative;
    z-index: 2; /* Sits on top of the scrim and shine */
    padding: 20px;
    color: white;
}

/* A slightly less intense text shadow, as the scrim now helps a lot */
.model-card-content h4 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 4px;
    text-shadow: 0px 1px 4px rgba(0, 0, 0, 0.7);
}

.model-card-content p {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0px 1px 3px rgba(0, 0, 0, 0.8);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 12px;
}

.model-card-footer {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* --- READABLE BADGE STYLE --- */
.model-card-badge {
    /* Font and Spacing (same as old badge for consistency) */
    font-size: 0.625rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    text-transform: uppercase;

    /* The "Frosted Glass" Effect */
    background-color: rgba(30, 41, 59, 0.5); /* Semi-transparent dark slate background */
    backdrop-filter: blur(4px); /* This creates the blur effect */
    -webkit-backdrop-filter: blur(4px); /* For Safari compatibility */
    
    /* A subtle border to help it stand out */
    border: 1px solid rgba(255, 255, 255, 0.1);

    /* High-contrast, but soft text color */
    color: var(--text-secondary); /* Uses the soft gray from the dark theme variables */
}

/*FOR DASHBOARD MEMORY SECTION*/
/* Style for the detailed text next to a label */
.label-detail-text {
    font-size: 0.8rem;      /* Make it smaller than the main label */
    font-weight: 400;        /* Make it a lighter font weight */
    color: var(--text-tertiary); /* Use a softer, secondary text color */
    margin-left: 8px;        /* Add a little space between it and the label */
}
/* This is a specific override for labels inside a slider-header */
.slider-header .form-label {
    display: inline;   /* This allows it to sit on the same line as other elements */
    margin-bottom: 0;  /* We don't need the bottom margin in this context */
}

/* User Profile Menu */
.user-profile-wrapper {
    position: relative;
}

.user-profile-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
}

.user-profile-btn:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.user-profile-text {
    display: none;
}

.user-icon {
    min-width: 20px;
}

/* Show text on larger screens */
@media (min-width: 640px) {
    .user-profile-text {
        display: block;
    }
}

/* Dropdown */
.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    min-width: 280px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    margin-top: 8px;
}

.user-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-content {
    padding: 8px;
}

.dropdown-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 8px;
    transition: background-color 0.2s ease;
    font-size: 0.875rem;
    text-align: left;
}

.dropdown-item:hover {
    background-color: var(--bg-tertiary);
}

.dropdown-item.primary {
    background-color: var(--accent-primary);
    color: white;
}

.dropdown-item.primary:hover {
    background-color: var(--accent-primary-hover);
}

.dropdown-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 8px 0;
}

/* User Info Section */
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 8px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1rem;
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.user-email {
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-top: 2px;
}

/* Auth Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.auth-modal {
    background-color: var(--bg-primary);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    border: 1px solid var(--border-color);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-overlay.active .auth-modal {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    z-index: 1;
}

.modal-close:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.auth-form {
    padding: 32px;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
    font-size: 0.875rem;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.auth-submit-btn {
    width: 100%;
    padding: 12px 16px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}

.auth-submit-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.auth-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-loader {
    display: flex;
    align-items: center;
}

.spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.auth-footer {
    text-align: center;
}

.auth-footer p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 8px;
}

.link-btn {
    background: none;
    border: none;
    color: var(--accent-primary);
    font-weight: 500;
    cursor: pointer;
    font-size: 0.875rem;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.link-btn:hover {
    color: var(--accent-primary-hover);
}

/* Mobile responsive */
@media (max-width: 480px) {
    .auth-modal {
        margin: 0;
        border-radius: 16px 16px 0 0;
        max-height: 85vh;
    }
    
    .auth-form {
        padding: 24px;
    }
    
    .modal-overlay {
        align-items: flex-end;
    }
}


/* MODEL MODAL FIX - Add to end of main.css */
#model-modal-overlay {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

#model-modal-overlay.show {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}