/* ==========================================================================
   FACERATE.AI // STYLE SHEET v2.4 (Strict 3-File Standard)
   ========================================================================== */

:root {
    --bg-color: #07040e;
    --card-bg: rgba(22, 27, 34, 0.7);
    --accent-color: #a855f7; /* Purple Neon */
    --accent-glow: rgba(168, 85, 247, 0.45);
    --text-color: #c9d1d9;
    --text-bright: #ffffff;
    --border-color: rgba(255, 255, 255, 0.08);

    /* Tiers Palette */
    --color-below-avg: #ef4444; /* Red */
    --color-ltn: #f59e0b;       /* Amber */
    --color-mtn: #10b981;       /* Green */
    --color-htn: #06b6d4;       /* Cyan */
    --color-chadlite: #3b82f6;  /* Blue */
    --color-chad: #ec4899;      /* Pink / Gold */

    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Outfit', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* Starfield Particle Canvas and Grid */
#bg-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    pointer-events: none;
}

.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-image: 
        linear-gradient(to right, rgba(168, 85, 247, 0.02) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(168, 85, 247, 0.02) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}

/* Glassmorphic Container */
.container {
    max-width: 460px;
    width: 90%;
    background: var(--card-bg);
    backdrop-filter: blur(15px);
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    text-align: center;
    border: 1px solid var(--border-color);
    z-index: 10;
    position: relative;
    transition: all 0.3s ease;
}

h1 {
    font-family: var(--font-heading);
    color: var(--text-bright);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 5px;
    letter-spacing: 0.5px;
}

.subtitle {
    color: #8b949e;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.badge-gravity {
    font-size: 11px;
    background: #eab308;
    color: black;
    padding: 3px 8px;
    border-radius: 20px;
    font-weight: 800;
    text-transform: uppercase;
    vertical-align: middle;
    letter-spacing: 0.5px;
    box-shadow: 0 0 10px rgba(234, 179, 8, 0.4);
    display: inline-block;
    margin-left: 5px;
}

/* Upload Area Grid */
.upload-area {
    border: 2px dashed rgba(168, 85, 247, 0.3);
    padding: 35px 20px;
    border-radius: 12px;
    cursor: pointer;
    background: rgba(7, 4, 14, 0.5);
    margin-bottom: 20px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    position: relative;
    overflow: hidden;
}

.upload-area:hover {
    border-color: var(--accent-color);
    background: rgba(168, 85, 247, 0.05);
    box-shadow: 0 0 20px var(--accent-glow);
}

#uploadText {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.95rem;
    color: #9a92a6;
    transition: color 0.3s ease;
}

.upload-area:hover #uploadText {
    color: var(--text-bright);
}

/* Preview Wrapper with Scanning Overlays */
.preview-wrapper {
    position: relative;
    width: 100%;
    display: none;
    justify-content: center;
    align-items: center;
}

#imagePreview {
    max-width: 100%;
    max-height: 220px;
    border-radius: 8px;
    display: block;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    opacity: 0.85;
}

#scanner-overlay-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 12;
}

.laser-scanner {
    position: absolute;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-color);
    box-shadow: 0 0 12px var(--accent-color), 0 0 4px #fff;
    z-index: 15;
    display: none;
}

.scanning .laser-scanner {
    display: block;
    animation: scan-loop 2s infinite ease-in-out;
}

/* Buttons */
button {
    color: white;
    border: none;
    padding: 12px 20px;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
    transition: all 0.2s ease;
}

#scanBtn {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

#scanBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.45);
}

#resetBtn {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

#resetBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.45);
}

.loading {
    display: none;
    margin-top: 15px;
    font-size: 0.85rem;
    color: var(--accent-color);
    font-weight: bold;
    animation: text-pulse 1s infinite alternate;
}

/* Floating Elements Canvas Area */
#gravityCanvas {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
}

/* Floating Advice & Score Cards */
.floating-card {
    position: absolute;
    padding: 14px 20px;
    background: rgba(22, 27, 34, 0.85);
    border: 1px solid var(--border-color);
    color: var(--text-bright);
    border-radius: 12px;
    font-size: 0.88rem;
    line-height: 1.4;
    cursor: grab;
    user-select: none;
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
    will-change: transform, left, top;
    z-index: 20;
    max-width: 280px;
    backdrop-filter: blur(10px);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.floating-card:hover {
    border-color: var(--accent-color);
    box-shadow: 0 8px 25px var(--accent-glow);
}

.floating-card:active {
    cursor: grabbing;
    z-index: 50;
}

/* Distinct color formatting for the score card badge */
.floating-card.score-card {
    background: linear-gradient(135deg, var(--accent-color), #4f46e5);
    font-weight: 800;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 25px var(--accent-glow);
}

/* Animations */
@keyframes scan-loop {
    0% { top: 0%; }
    50% { top: 98%; }
    100% { top: 0%; }
}

@keyframes text-pulse {
    from { opacity: 0.6; text-shadow: 0 0 5px var(--accent-glow); }
    to { opacity: 1; text-shadow: 0 0 12px var(--accent-color); }
}
