/* ==========================================================================
   1. BASE DEFAULT (Dark)
   ========================================================================== */
:root {
    --bg-glow: #121212;
    --card-bg: #151515;
    --input-bg: #111111;
    --text-main: #FFFFFF;
    --text-muted: #8A8A8A;
    --border-light: rgba(255, 255, 255, 0.08); 
    --btn-bg: #FFFFFF;
    --btn-text: #000000;
    --btn-shadow: rgba(255, 255, 255, 0.1);
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --mono-font: 'JetBrains Mono', monospace;
}

/* ==========================================================================
   2. EXPLICIT JAVASCRIPT OVERRIDES (Chameleon System)
   ========================================================================== */
:root[data-theme="dark"] {
    --bg-glow: #121212;
    --card-bg: #151515;
    --input-bg: #111111;
    --text-main: #FFFFFF;
    --text-muted: #8A8A8A;
    --border-light: rgba(255, 255, 255, 0.08); 
    --btn-bg: #FFFFFF;
    --btn-text: #000000;
    --btn-shadow: rgba(255, 255, 255, 0.1);
}

:root[data-theme="light"] {
    --bg-glow: #ffffff;
    --card-bg: #ffffff;
    --input-bg: #ffffff;
    --text-main: #212529;
    --text-muted: #6c757d;
    --border-light: #dee2e6;
    --btn-bg: #212529;
    --btn-text: #ffffff;
    --btn-shadow: rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   3. GLOBAL STYLES
   ========================================================================== */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-stack);
    background: var(--bg-glow);
    background-attachment: fixed;
    color: var(--text-main);
    padding: 20px; /* Reduced from 60px 20px */
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    line-height: 1.6;
    transition: background 0.3s ease, color 0.3s ease;
}

.container {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    gap: 16px; /* Reduced from 24px */
}

/* ==========================================================================
   4. COMPONENTS
   ========================================================================== */
.card-block {
    background-color: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 24px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* --- THE UPLOAD ZONE --- */
.upload-zone {
    text-align: center;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    padding: 30px 20px;
    transition: all 0.3s ease;
    /* OVERRIDE: Make it look like a distinct drop zone */
    border: 2px dashed var(--text-muted); 
    background-color: transparent; /* Removes the card background so it looks recessed */
    border-radius: 8px; /* Keeps the soft corners */
}

.upload-zone:hover {
    border-color: var(--text-main);
    color: var(--text-main);
    transform: translateY(-2px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    background-color: var(--card-bg); /* Fills in on hover for tactile feedback */
}

.upload-zone input { display: none; }


/* --- CONTROLS --- */
.controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    text-align: left;
}

@media (max-width: 600px) {
    .controls-grid { grid-template-columns: 1fr; }
}

.control-item {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.control-item label {
    font-size: 14px; 
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--btn-bg); 
    cursor: pointer;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px; 
    cursor: pointer;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 20px;
    letter-spacing: 0.5px;
}

.checkbox-label input {
    accent-color: var(--btn-bg);
    width: 16px;
    height: 16px;
}

/* --- BUTTONS (Unified Ghost Style) --- */
.btn-go, 
.btn-secondary {
    background-color: transparent;
    color: var(--text-main);
    border: 2px solid var(--text-muted); 
    border-radius: 6px;
    padding: 15px 32px; 
    font-size: 14px;
    font-family: var(--font-stack);
    font-weight: 700;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Both buttons get the solid fill and pop-out effect on hover */
.btn-go:hover, 
.btn-secondary:hover {
    border-color: var(--text-main);
    background-color: var(--text-main);
    color: var(--card-bg);
    transform: scale(1.01);
    box-shadow: 0 4px 15px var(--btn-shadow);
}

.btn-go:active, 
.btn-secondary:active {
    transform: scale(0.99);
}

/* --- BUTTON GROUP (Side-by-side layout) --- */
.button-group {
    display: flex;
    gap: 16px;
    width: 100%;
}

.button-group button {
    flex: 1; /* Forces perfectly equal widths */
    margin-top: 0;
}

/* Stack them vertically on mobile so the text doesn't get crushed */
@media (max-width: 600px) {
    .button-group {
        flex-direction: column;
    }
}

/* Stack them vertically on mobile so the text doesn't get crushed */
@media (max-width: 600px) {
    .button-group {
        flex-direction: column;
    }
}

/* --- OUTPUT MATRIX --- */
.output-block {
    background-color: var(--input-bg);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 24px;
    overflow: auto;
    text-align: left;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2); 
}

.matrix-info {
    font-size: 12px; 
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 16px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 12px;
}

#output {
    font-family: var(--mono-font); 
    font-size: 11px;
    line-height: 11px;
    letter-spacing: 0px;
    white-space: pre;
    min-height: 250px;
    max-height: 500px;
    color: var(--text-main);
}

/* ==========================================================================
   5. UTILITIES (Selection & Teardown Modes)
   ========================================================================== */
[data-theme="light"] ::selection { background-color: #000000 !important; color: #FFFFFF !important; }
[data-theme="light"] ::-moz-selection { background-color: #000000 !important; color: #FFFFFF !important; }
[data-theme="dark"] ::selection, [data-theme="black-trans"] ::selection { background-color: #FFFFFF !important; color: #000000 !important; }
[data-theme="dark"] ::-moz-selection, [data-theme="black-trans"] ::-moz-selection { background-color: #FFFFFF !important; color: #000000 !important; }

button, .upload-zone, label {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none; 
}

[data-theme="black-trans"],
[data-theme="black-trans"] body {
    background-color: transparent !important;
    color: #FFFFFF !important; 
}

/* =========================================
   CUSTOM SCROLLBAR STYLING
   ========================================= */

/* For Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-light, #444) transparent;
}

/* For Chrome, Edge, and Safari */
::-webkit-scrollbar {
    width: 8px; /* Makes the scrollbar much slimmer */
}

::-webkit-scrollbar-track {
    background: transparent; /* Hides the ugly background track */
}

::-webkit-scrollbar-thumb {
    background: var(--border-light, rgba(255, 255, 255, 0.15)); /* Soft, translucent gray */
    border-radius: 10px; /* Gives it a modern, rounded pill shape */
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted, rgba(255, 255, 255, 0.3)); /* Gets slightly brighter when hovered */
}
