/* --- VARIABLES --- */
:root {
    /* Light Mode */
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --accent-color: #0f172a; 
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] {
    /* Professional Dark Mode (Deep Charcoal) */
    --bg-body: #0a0a0a;       /* Almost black, but softer */
    --bg-card: #171717;       /* Dark grey card for depth */
    --text-primary: #ededed;  /* Off-white (easier on eyes) */
    --text-secondary: #a1a1aa; /* Muted grey */
    --text-inverse: #ffffff;   /* Keep button text white */
    --border-color: #262626;  /* Subtle borders */
    --accent-color: #2563eb;  /* Bright Blue for buttons (pops on dark) */
    --shadow: 0 0 0 1px #262626;
}

* { box-sizing: border-box; transition: background-color 0.2s, border-color 0.2s; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    margin: 0;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

/* --- LAYOUT GRID --- */
.main-wrapper {
    width: 100%;
    max-width: 1000px;
    display: grid;
    gap: 24px;
}

/* Header Row */
.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 0 4px;
}

h1 {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

/* Theme Toggle */
.theme-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.theme-btn:hover { background: var(--border-color); }

/* --- MAIN ANALYZER CARD --- */
.analyzer-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow);
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    overflow: hidden;
    min-height: 450px;
}

/* Left Column: Input */
.input-col {
    padding: 40px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: block;
    letter-spacing: 0.05em;
}

textarea {
    width: 100%;
    flex-grow: 1;
    padding: 16px;
    background: var(--bg-body);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    resize: none;
    outline: none;
    margin-bottom: 20px;
}
textarea:focus { border-color: var(--accent-color); }

button#analyzeBtn {
    width: 100%;
    padding: 14px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: opacity 0.2s;
}
button#analyzeBtn:hover { opacity: 0.9; }
button:disabled { opacity: 0.5; cursor: wait; }

/* Right Column: Visualization */
.result-col {
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background-color: var(--bg-card);
}

.chart-wrapper {
    position: relative;
    width: 200px;
    height: 200px;
    margin-bottom: 30px;
}

.score-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.score-number {
    font-size: 42px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.score-text {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
    margin-top: 6px;
}

/* Status Pill */
.status-pill {
    margin-bottom: 40px;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 100px;
    background: var(--bg-body);
    color: var(--text-secondary);
    display: inline-block;
    letter-spacing: 0.02em;
}

/* Metric Grid */
.metrics-grid {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    border-top: 1px solid var(--border-color);
    padding-top: 30px;
}

.metric-item { text-align: center; }

.metric-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.metric-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- TECHNICAL FOOTER --- */
.tech-specs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-top: 32px;
}

.spec-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 24px;
    border-radius: 12px;
}

.spec-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-primary);
    margin-bottom: 12px;
    letter-spacing: 0.08em;
    opacity: 0.8;
}

.spec-content {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    font-weight: 400;
}

/* Spinner */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
    display: none;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Mobile Responsive */
@media (max-width: 800px) {
    .analyzer-card { grid-template-columns: 1fr; }
    .input-col { border-right: none; border-bottom: 1px solid var(--border-color); min-height: 300px; }
    .tech-specs { grid-template-columns: 1fr 1fr; }
}