/* /app/css/dashboard.css */

/* TEMA CLARO (Predeterminado) */
:root {
    --bg-main: #f3f4f6;
    --bg-card: #ffffff;
    --bg-header: #ffffff;
    --border-color: #e5e7eb;
    --text-main: #111827;
    --text-muted: #6b7280;
    --accent: #b91c1c;
    --sacrobits: #2563eb;
    --biosafras: #059669;
    --integralis: #7c3aed;
    --toggle-bg: #d1d5db;
    --dropdown-bg: #ffffff;
    --dropdown-hover: #f3f4f6;
    --modal-bg: #ffffff;
}

/* TEMA OSCURO */
[data-theme="dark"] {
    --bg-main: #121214;
    --bg-card: #1a1a1e;
    --bg-header: #1a1a1e;
    --border-color: #2a2a30;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --accent: #7A1720;
    --sacrobits: #3b82f6;
    --biosafras: #10b981;
    --integralis: #a855f7;
    --toggle-bg: #374151;
    --dropdown-bg: #1a1a1e;
    --dropdown-hover: #2a2a30;
    --modal-bg: #1a1a1e;
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; 
}

body { 
    background-color: var(--bg-main); 
    color: var(--text-main); 
    padding-top: 55px; /* Espacio exacto ocupado por la cabecera fija de 48px */
    transition: background-color 0.2s ease, color 0.2s ease;
}

.container { 
    max-width: 700px; 
    margin: 0 auto; 
    padding: 0px;
}
.container-index { 
    max-width: 700px; 
    margin: 0 auto; 
    padding: 10px;
}

/* --- CABECERAS FIJAS SUPERIORES (DASHBOARD Y SPA EN LA MISMA POSICIÓN) --- */
.fixed-header-global {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 48px;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-right: 15px;
}

.btn-header-opciones-pegado {
    background: transparent;
    border: none;
    border-right: 1px solid var(--border-color);
    color: var(--text-main);
    height: 48px;
    width: 48px;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-header-opciones-pegado:hover {
    background: var(--border-color);
}

.header-title-box {
    text-align: center;
    flex: 1;
}

.header-title-box h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
}

.header-title-box p {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.header-right-box {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 48px;
}

/* --- MENÚ DROPDOWN SIN ENCABEZADO (MISMA POSICIÓN) --- */
.dropdown-opciones-container {
    display: none;
    position: fixed;
    top: 48px;
    left: 0;
    background: var(--dropdown-bg);
    border: 1px solid var(--border-color);
    border-radius: 0 0 10px 0;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    min-width: 200px;
    z-index: 2000;
    overflow: hidden;
}

.dropdown-opciones-container.active {
    display: block;
}

.dropdown-item-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s;
}

.dropdown-item-btn:last-child {
    border-bottom: none;
}

.dropdown-item-btn:hover {
    background: var(--dropdown-hover);
}

.dropdown-item-btn.danger {
    color: #ef4444;
}

/* --- ESTILOS DE COMPONENTES DE MODAL Y GRIDS --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 3000;
    align-items: center;
    justify-content: center;
    padding: 15px;
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    background: var(--modal-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 100%;
    max-width: 420px;
    padding: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

.modal-header-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.section-title { 
    font-size: 0.85rem; 
    font-weight: 700; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    margin: 20px 0 10px 4px; 
}

.section-title.sacro { color: var(--sacrobits); }
.section-title.bio { color: var(--biosafras); }
.section-title.integra { color: var(--integralis); }

.app-grid { 
    display: grid; 
    grid-template-columns: repeat(2, 1fr); 
    gap: 10px; 
}

.app-btn { 
    background: var(--bg-card); 
    color: var(--text-main); 
    padding: 14px; 
    border-radius: 10px; 
    font-size: 0.9rem; 
    font-weight: 500; 
    border: 1px solid var(--border-color);
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: space-between;
}

.app-btn.disabled { opacity: 0.3; pointer-events: none; }

.btn-back-spa { 
    background: var(--bg-card); 
    color: var(--text-main); 
    border: 1px solid var(--border-color); 
    padding: 6px 12px; 
    border-radius: 6px; 
    cursor: pointer; 
    font-weight: 600; 
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-back-spa:hover { 
    background: var(--accent); 
    color: #fff;
    border-color: var(--accent); 
}

/* TOGGLE INTERRUPTOR */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.switch { position: relative; display: inline-block; width: 48px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--toggle-bg); transition: .3s; border-radius: 34px;
}
.slider:before {
    position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px;
    background-color: white; transition: .3s; border-radius: 50%;
}
input:checked + .slider { background-color: var(--sacrobits); }
input:checked + .slider:before { transform: translateX(24px); }