/* 
   PREMIUM LUXURY THEME
   Aesthetic: Geometric Sans (Outfit), Solid Colors, Generous Whitespace
*/

:root {
    /* --- LIGHT THEME (Default) --- */
    --bg-body: #ffffff;
    --bg-card: #ffffff;
    --bg-subtle: #f9f9f9;

    --text-main: #000000;
    --text-secondary: #555555;
    --text-tertiary: #999999;

    --accent-primary: #000000;
    --accent-hover: #222222;
    --accent-fg: #ffffff;

    --border-color: #f0f0f0;
    --border-hover: #000000;

    --focus-ring: 0 0 0 3px rgba(0, 0, 0, 0.05);

    /* Refined Shadows - More diffuse */
    --shadow-card: 0 0 0 1px rgba(0, 0, 0, 0.03), 0 8px 30px rgba(0, 0, 0, 0.04);
    --shadow-hover: 0 0 0 1px rgba(0, 0, 0, 0.04), 0 20px 40px rgba(0, 0, 0, 0.06);

    /* Typography */
    --font-heading: 'Outfit', sans-serif;
    /* Geometric, Premium */
    --font-sans: 'Inter', -apple-system, sans-serif;
    --font-mono: 'SF Mono', 'Monaco', monospace;
}

[data-theme="dark"] {
    /* --- DARK THEME overrides --- */
    --bg-body: #050505;
    --bg-card: #0a0a0a;
    --bg-subtle: #111111;

    --text-main: #ffffff;
    --text-secondary: #999999;
    --text-tertiary: #444444;

    --accent-primary: #ffffff;
    --accent-hover: #e0e0e0;
    --accent-fg: #000000;

    --border-color: #222222;
    --border-hover: #ffffff;

    --focus-ring: 0 0 0 3px rgba(255, 255, 255, 0.1);

    --shadow-card: 0 0 0 1px #222222;
    --shadow-hover: 0 0 0 1px #333333;
}

/* Base Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 4rem 6rem;
    /* Huge padding */
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* Typography Polish */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-main);
}

p {
    color: var(--text-secondary);
    font-size: 1.05rem;
}

/* --- LAYOUT --- */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.header {
    border-bottom: none;
    margin-bottom: 4rem;
    padding-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-gradient {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: none;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: unset;
    color: var(--text-main);
    margin: 0;
}

.badge-live {
    font-family: var(--font-sans);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    padding: 6px 12px;
    border-radius: 99px;
    background: var(--bg-subtle);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.badge-live::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

/* Main Grid */
.main-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4rem;
    align-items: start;
    max-width: 900px;
    margin: 0 auto;
}

/* --- CARDS --- */
.card {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 3.5rem;
    box-shadow: var(--shadow-card);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    border: none;
}

.detector-card {
    align-items: center;
    text-align: center;
    min-height: 600px;
}

.history-card {
    min-height: 600px;
}

/* --- COMPONENTS --- */

/* Tabs */
.tabs {
    background: var(--bg-subtle);
    padding: 6px;
    border-radius: 12px;
    display: inline-flex;
    margin-bottom: 3rem;
}

.tab-btn {
    padding: 8px 24px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: var(--font-heading);
    font-weight: 500;
    color: var(--text-secondary);
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    background: var(--bg-card);
    color: var(--text-main);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    font-family: var(--font-heading);
    font-weight: 600;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-pill {
    height: 48px;
    padding: 0 32px;
    border-radius: 999px;
    background: var(--accent-primary);
    color: var(--accent-fg);
    font-size: 1rem;
    letter-spacing: 0.02em;
}

.btn-pill:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Inputs */
input[type="text"] {
    background: var(--bg-subtle);
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 0 16px;
    height: 48px;
    font-family: var(--font-sans);
    font-size: 1rem;
    color: var(--text-main);
    transition: all 0.2s;
}

input[type="text"]:focus {
    outline: none;
    background: var(--bg-card);
    border-color: var(--border-hover);
    box-shadow: var(--focus-ring);
}

/* --- DETECTOR UI --- */
.note-display {
    font-family: var(--font-heading);
    font-size: 9rem;
    font-weight: 700;
    margin: 2rem 0;
    color: var(--text-main);
}

.status-label {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--text-tertiary);
    font-weight: 600;
    margin-bottom: 2rem;
}

.staff-container {
    margin: 2rem 0;
    opacity: 0.8;
}

/* --- HISTORY UI --- */
.history-card h2 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    margin-bottom: 2rem;
    font-weight: 600;
}

.history-list {
    list-style: none;
    overflow-y: auto;
    flex: 1;
    padding-right: 8px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 1rem;
}

.history-note {
    font-family: var(--font-heading);
    font-weight: 600;
}

.history-freq {
    font-family: var(--font-mono);
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 60%;
    color: var(--text-tertiary);
}

.empty-state div {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 2rem;
}

.confidence-bar-container {
    width: 60px;
    height: 4px;
    background: var(--border-color);
    border-radius: 99px;
    margin: 1.5rem auto;
    overflow: hidden;
}

.confidence-bar-fill {
    height: 100%;
    background: var(--text-main);
    width: 0%;
    transition: width 0.15s ease-out;
}

/* Luxury Toggle */
.theme-toggle-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.theme-toggle-btn:hover {
    border-color: var(--text-main);
}

.theme-toggle-btn svg {
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    position: absolute;
}

.theme-toggle-btn:hover svg {
    transform: rotate(12deg);
}

/* Upload Area */
.upload-area {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 4rem 2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-subtle);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    text-align: center;
}

.upload-area:hover {
    border-color: var(--text-main);
    background: var(--bg-card);
    transform: scale(1.005);
    box-shadow: var(--shadow-hover);
}

.upload-area p {
    font-family: var(--font-heading);
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 1rem;
}

.upload-icon {
    font-size: 2rem;
    color: var(--text-tertiary);
    transition: color 0.2s;
}

.upload-area:hover .upload-icon {
    color: var(--text-main);
}

/* Responsive */
@media (max-width: 1024px) {
    body {
        padding: 2rem;
    }

    .main-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* --- FOOTER --- */
.footer {
    margin-top: 6rem;
    padding: 4rem 0 2rem;
    border-top: 1px solid var(--border-color-subtle);
    text-align: center;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.footer-name {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.footer-link {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s, transform 0.2s;
}

.footer-link:hover {
    color: var(--text-main);
    transform: translateY(-1px);
}

.footer-divider {
    color: var(--border-color);
    font-size: 0.8rem;
}