:root {
    --primary: #4ade80;
    --danger: #ef4444;
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 500px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

header {
    text-align: center;
}

h1 {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    background: linear-gradient(135deg, #4ade80 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

p.subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Glassmorphism Card */
.main-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Camera Preview & Uploaded Image area */
.image-wrapper {
    width: 100%;
    aspect-ratio: 1;
    background: #1e293b;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    border: 2px dashed var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
}

#cameraPreview, #savedImage {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.placeholder-text {
    text-align: center;
    color: var(--text-secondary);
}

/* Controls */
.controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

button {
    padding: 1rem 1.5rem;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.primary-btn {
    background: var(--primary);
    color: #064e3b;
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 1px solid var(--glass-border);
}

button:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

button:active {
    transform: scale(0.98);
}

/* Result Section */
.result-section {
    display: none;
    text-align: center;
    animation: fadeIn 0.5s ease;
}

.status-chip {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    border-radius: 100px;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.status-safe {
    background: rgba(74, 222, 128, 0.2);
    color: #4ade80;
    border: 1px solid rgba(74, 222, 128, 0.4);
}

.status-alert {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.probability-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 100px;
    margin: 1rem 0;
    overflow: hidden;
}

.probability-fill {
    width: 0%;
    height: 100%;
    background: var(--primary);
    transition: width 1s cubic-bezier(0.17, 0.67, 0.83, 0.67);
}

.stats {
    display: flex;
    justify-content: space-around;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Utils */
.hidden { display: none; }

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

/* Loading Overlay */
#loader {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 10;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--glass-border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Progress Feedback */
.progress-container {
    display: none;
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 100px;
    height: 6px;
    margin-top: 1rem;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--glass-border);
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4ade80, #3b82f6);
    box-shadow: 0 0 10px rgba(74, 222, 128, 0.5);
    transition: width 0.3s ease;
}

#statusLabel {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    text-align: center;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.analyzing-pulse {
    animation: progressPulse 1.5s ease-in-out infinite;
}

@keyframes progressPulse {
    0% { opacity: 1; }
    50% { opacity: 0.4; }
    100% { opacity: 1; }
}
