:root {
    --bg-color: #050505;
    --card-bg: #111111;
    --accent: #00ff9d;
    --accent-dim: rgba(0, 255, 157, 0.1);
    --text-main: #ffffff;
    --text-muted: #888888;
    --error: #ff5f56;
    --font-mono: 'Fira Code', monospace;
    --font-sans: 'Inter', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--font-mono); }
.blink { animation: blinker 1s linear infinite; }
@keyframes blinker { 50% { opacity: 0; } }

/* HEADER */
header {
    background-color: var(--card-bg);
    border-bottom: 1px solid #222;
    padding: 15px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-content {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
header h1 { font-size: 1.5rem; letter-spacing: -1px; }

/* CONTENEDOR PRINCIPAL */
#app-container {
    max-width: 600px;
    margin: 20px auto;
    padding: 0 15px;
    padding-bottom: 50px;
}

/* TARJETAS */
.card {
    background-color: var(--card-bg);
    border: 1px solid #222;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px;}
.text-muted { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 15px; }

/* LISTAS CHECKBOX */
.check-list { list-style: none; }
.check-list li {
    background: rgba(255,255,255,0.03);
    border: 1px solid #222;
    margin-bottom: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}
.check-list label {
    display: flex;
    align-items: center;
    padding: 15px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
}
.check-list input[type="checkbox"] {
    appearance: none;
    width: 22px; height: 22px;
    border: 2px solid #555;
    border-radius: 4px;
    margin-right: 15px;
    position: relative;
    cursor: pointer;
    transition: 0.2s;
}
.check-list input[type="checkbox"]:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}
.check-list input[type="checkbox"]:checked::after {
    content: "✓";
    position: absolute;
    color: #000;
    font-weight: bold;
    font-size: 14px;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}

#lista-productos li:has(input:checked) {
    border-color: var(--accent);
    background-color: var(--accent-dim);
}

.compras-list input[type="checkbox"]:checked + span {
    text-decoration: line-through;
    color: var(--text-muted);
}
.compras-list li:has(input[type="checkbox"]:checked) {
    opacity: 0.5;
}

/* BOTONES */
button { font-family: var(--font-mono); cursor: pointer; transition: 0.2s; border-radius: 6px; }
.btn-primary { background: var(--text-main); color: #000; border: none; padding: 12px 20px; font-weight: bold; }
.btn-success { background: var(--accent); color: #000; border: none; padding: 12px 20px; font-weight: bold; width: 100%; }
.btn-outline { background: transparent; color: var(--accent); border: 1px dashed var(--accent); padding: 8px 15px; }
.btn-icon { background: transparent; color: var(--text-muted); border: none; font-size: 1.2rem; }
.btn-magic { background: var(--accent); color: #000; width: 100%; padding: 16px; border: none; font-size: 1.1rem; font-weight: bold; margin-top: 15px; text-transform: uppercase; }
button:active { transform: scale(0.98); }

/* VISTAS */
.view { display: block; animation: fadeIn 0.3s ease; }
.hidden { display: none !important; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ESCÁNER Y ESTADOS */
#reader { border-radius: 8px; overflow: hidden; border: 1px solid #333; }
.state-panel { text-align: center; margin-top: 15px; padding: 15px; background: #1a1a1a; border-radius: 8px; border: 1px dashed #333; }
.product-image { max-width: 150px; border-radius: 8px; margin: 15px auto; display: block; }
input[type="text"] { width: 100%; padding: 12px; margin: 10px 0; border-radius: 6px; border: 1px solid #444; background: #0a0a0a; color: #fff; font-family: var(--font-mono); }
input[type="text"]:focus { outline: 1px solid var(--accent); border-color: var(--accent); }

#reader {
    min-height: 350px;
    overflow: hidden;
    border-radius: 12px;
}

#reader video {
    width: 100% !important;
    height: auto !important;
    border-radius: 12px;
}