:root {
    --bg-color: #05091a;
    --text-main: #e2e8f0;
    --text-muted: #7b92b8;
    --primary: #00c4cc;
    --primary-glow: rgba(0, 196, 204, 0.40);
    --secondary: #818cf8;
    --accent: #818cf8;
    --glass-bg: rgba(14, 26, 51, 0.70);
    --glass-border: #1a2f50;
    --card-bg: rgba(11, 20, 40, 0.65);
    --success: #10b981;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background Animations */
.background-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    filter: blur(80px);
    border-radius: 50%;
    opacity: 0.5;
    animation: float 20s infinite ease-in-out alternate;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
    animation-delay: 0s;
}

.blob-2 {
    bottom: -20%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, var(--secondary) 0%, transparent 70%);
    animation-delay: -5s;
}

.blob-3 {
    top: 40%;
    left: 40%;
    width: 40vw;
    height: 40vw;
    background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
    opacity: 0.3;
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(5%, 10%) scale(1.1); }
    66% { transform: translate(-5%, 5%) scale(0.9); }
    100% { transform: translate(0, 0) scale(1); }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 3rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1.5rem;
}

.header-content h1 {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 0.5rem;
}

.highlight {
    background: linear-gradient(to right, #00c4cc, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-content p {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 600px;
}

.header-badges {
    display: flex;
    gap: 0.75rem;
}

.badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

/* Glass Panels */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-panel h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Upload Section */
.upload-area {
    border: 2px dashed var(--glass-border);
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(0, 0, 0, 0.2);
    margin-bottom: 1.5rem;
}

.upload-area:hover, .upload-area.drag-over {
    border-color: var(--primary);
    background: rgba(0, 196, 204, 0.05);
}

.upload-icon {
    color: var(--primary);
    margin-bottom: 1rem;
}

.browse-link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
}

.sub-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Samples */
.sample-images p {
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.samples-grid {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.samples-grid::-webkit-scrollbar {
    width: 6px;
}

.samples-grid::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 3px;
}

.sample-img-wrapper {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.sample-img-wrapper:hover {
    transform: scale(1.1);
    border-color: var(--primary);
}

.sample-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Results Section */
.results-container {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.results-container.hidden {
    display: none;
    opacity: 0;
}

/* Prediction Panel */
.main-prediction {
    background: linear-gradient(135deg, rgba(0, 196, 204, 0.10), rgba(129, 140, 248, 0.10));
    border: 1px solid var(--primary-glow);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 2rem;
    box-shadow: 0 0 20px var(--primary-glow);
}

.pred-class {
    font-size: 2.5rem;
    font-weight: 700;
    text-transform: capitalize;
    background: linear-gradient(to right, #fff, #67e8f9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.25rem;
}

.pred-conf {
    font-size: 1.25rem;
    color: var(--success);
    font-weight: 600;
}

.prob-bars {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.prob-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.prob-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    text-transform: capitalize;
}

.prob-bar-bg {
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 999px;
    overflow: hidden;
}

.prob-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 999px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.prob-item:nth-child(1) .prob-bar-fill { background: var(--success); }
.prob-item:nth-child(2) .prob-bar-fill { background: var(--primary); }
.prob-item:nth-child(3) .prob-bar-fill { background: var(--secondary); }

/* Visualization Panel */
.vis-desc {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.vis-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.vis-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.highlight-card {
    background: linear-gradient(135deg, rgba(14, 26, 51, 0.85), rgba(11, 20, 40, 0.95));
    border-color: rgba(0, 196, 204, 0.30);
    box-shadow: 0 0 15px rgba(0, 196, 204, 0.10);
}

.vis-card h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-weight: 500;
}

.img-container {
    width: 100%;
    aspect-ratio: 1/1;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    background: #000;
}

.img-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated; /* Good for small CIFAR images */
    transition: transform 0.3s ease;
}

.img-container:hover img {
    transform: scale(1.05);
}

/* Sci-fi scanning effect for overlay */
.overlay-container {
    position: relative;
}

.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent), 0 0 20px var(--accent);
    opacity: 0.7;
    animation: scan 3s infinite linear;
    z-index: 10;
}

@keyframes scan {
    0% { top: -10%; opacity: 0; }
    10% { opacity: 0.7; }
    90% { opacity: 0.7; }
    100% { top: 110%; opacity: 0; }
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 9, 26, 0.85);
    backdrop-filter: blur(8px);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
    display: none;
    opacity: 0;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    border-right-color: var(--secondary);
    border-bottom-color: var(--accent);
    animation: spin 1s infinite linear;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

footer {
    text-align: center;
    margin-top: 3rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 900px) {
    .results-container {
        grid-template-columns: 1fr;
    }
    
    .vis-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .vis-grid .vis-card:last-child {
        grid-column: span 2;
        max-width: 50%;
        margin: 0 auto;
    }
}

@media (max-width: 600px) {
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .vis-grid {
        grid-template-columns: 1fr;
    }
    
    .vis-grid .vis-card:last-child {
        grid-column: span 1;
        max-width: 100%;
    }
}
