/* VARIABLES DE TEMA */
:root {
    --bg: #ffffff;
    --text-main: #000000;
    --text-muted: #8c8c8c;
    --text-light: #cccccc;
    --bg-box: #fafafa;
    --border: #f0f0f0;
    --btn-hover: #000000;
    --btn-text-hover: #ffffff;
    --font-base: 'Manrope', -apple-system, sans-serif;
}

[data-theme="dark"] {
    --bg: #121212;
    --text-main: #ffffff;
    --text-muted: #a0a0a0;
    --text-light: #444444;
    --bg-box: #1e1e1e;
    --border: #2a2a2a;
    --btn-hover: #ffffff;
    --btn-text-hover: #000000;
}

html, body {
    margin: 0; padding: 0;
    width: 100%; height: 100vh;
    overflow: hidden; /* Previene scroll global, los paneles manejan su propio scroll */
    background-color: var(--bg);
    color: var(--text-main);
    font-family: var(--font-base);
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s, color 0.3s;
}

.womi-app {
    position: relative;
    width: 100%;
    max-width: 650px;
    height: 100vh;
    margin: 0 auto;
    overflow: hidden;
}

/* SISTEMA DE PANELES */
.womi-panel {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
    transform: translateX(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    overflow-y: auto;
}

.womi-panel.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

/* PANELES SECUNDARIOS (Cabeceras) */
.sub-panel {
    background-color: var(--bg);
    z-index: 10;
}

.panel-header {
    display: flex;
    align-items: center;
    position: relative; /* Clave para posicionar el botón absolute y centrar el h2 */
    margin-bottom: 2rem;
    padding-top: 0.5rem;
    justify-content: center; /* Centra el título en el medio exacto */
}

.panel-header h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 800;
}

.back-btn {
    position: absolute; /* Saca el botón del flujo para fijarlo a la izquierda */
    left: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    transition: color 0.2s;
}

.back-btn svg { width: 20px; height: 20px; }
.back-btn:hover { color: var(--text-main); }

.panel-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.flex-grow { flex-grow: 1; justify-content: flex-start; }


/* CABECERA HOME */
.womi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}
.logo { font-size: 1rem; font-weight: 700; }
.womi-logo-bold { font-weight: 800; }
.header-actions { display: flex; gap: 12px; }
.icon-btn {
    background: none; border: none;
    color: var(--text-muted);
    cursor: pointer; padding: 4px;
    transition: color 0.2s;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { color: var(--text-main); }


/* DISPLAY HOME */
.womi-center-display {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    margin: 1rem 0 2rem 0;
}
.womi-speed-text {
    font-size: 5.5rem; font-weight: 800;
    line-height: 1; letter-spacing: -0.04em;
    color: var(--text-light);
    margin: 0; transition: color 0.3s;
}
.womi-speed-text.active { color: var(--text-main); }
.womi-unit-text { font-size: 1.2rem; font-weight: 700; color: var(--text-muted); }

/* CONTROLES */
.womi-controls { display: flex; justify-content: center; margin-bottom: 2rem; }
.womi-btn {
    background: transparent; color: var(--text-main);
    border: 2px solid var(--text-main);
    padding: 0.8rem 2rem; font-size: 0.85rem;
    font-weight: 700; font-family: inherit;
    border-radius: 50px; cursor: pointer;
    text-transform: uppercase; letter-spacing: 0.05em;
    transition: all 0.2s;
}
.womi-btn:hover:not(:disabled) { background: var(--btn-hover); color: var(--btn-text-hover); }
.womi-btn:disabled { border-color: var(--text-light); color: var(--text-light); cursor: default; }
.womi-btn.small { padding: 0.6rem 1rem; font-size: 0.75rem; }

/* GRID DE DETALLES */
.womi-details-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem; padding-top: 1rem; border-top: 1px solid var(--border);
}
.womi-extra-grid {
    display: flex; flex-direction: column; gap: 0.8rem;
    margin-top: 0.8rem; opacity: 1;
    transition: opacity 0.5s ease;
}
.womi-extra-grid.hidden { opacity: 0; pointer-events: none; display: none; }
.womi-detail-box {
    display: flex; flex-direction: column; align-items: center;
    background: var(--bg-box); padding: 0.8rem 0.5rem;
    border-radius: 12px; text-align: center;
}
.womi-span-2 { grid-column: span 2; }
.womi-label { font-size: 0.65rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }
.womi-value { font-size: 0.95rem; font-weight: 800; color: var(--text-main); margin-top: 4px;}
.small-unit { font-size: 0.7rem; }

/* CATEGORÍAS */
.womi-categories-container {
    display: flex; justify-content: space-around;
    background: var(--bg-box); padding: 1rem 0.5rem; border-radius: 12px;
}
.category-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.cat-icon { width: 22px; height: 22px; color: var(--text-muted); }
.cat-title { font-size: 0.65rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }
.dots { display: flex; gap: 4px; margin-top: 2px; }
.dot { width: 5px; height: 5px; background: var(--border); border-radius: 50%; transition: background 0.3s; }
.dot.active { background: var(--text-main); }


/* ELEMENTOS DE PANELES SECUNDARIOS */
.setting-group { display: flex; flex-direction: column; gap: 0.5rem; }
.womi-select {
    padding: 0.8rem; border-radius: 8px;
    border: 1px solid var(--border); background: var(--bg-box);
    color: var(--text-main); font-family: inherit; outline: none; font-weight: 700;
}
.history-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; max-height: 70vh; }
.history-item {
    background: var(--bg-box); padding: 1rem; border-radius: 12px;
    display: flex; justify-content: space-between; align-items: center;
}
.history-item div { display: flex; flex-direction: column; gap: 4px; }
.history-date { font-size: 0.7rem; color: var(--text-muted); }
.map-container { width: 100%; height: 350px; background: var(--border); border-radius: 12px; overflow: hidden; }

/* INFO PANEL */
.info-content { text-align: center; align-items: center; padding-top: 2rem; }
.info-logo { font-size: 1.5rem; margin-bottom: 0.2rem; }
.version { font-size: 0.8rem; color: var(--text-muted); font-weight: 700; margin-bottom: 2rem; }
.info-text { font-size: 0.9rem; line-height: 1.6; color: var(--text-muted); margin-bottom: 3rem; max-width: 400px; }
.credits { font-size: 0.8rem; color: var(--text-main); }

@media (max-width: 600px) {
    .womi-panel { padding: 1.2rem; }
    .womi-speed-text { font-size: 4.5rem; }
    .womi-details-grid { grid-template-columns: repeat(2, 1fr); }
    .womi-span-2 { grid-column: span 2; }
}
