/* --- ESTILO NORDIC (Silenos Standard) + SOPORTE OSCURO NEGRO PURO --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght=300;400;500;600&family=JetBrains+Mono:wght@400&display=swap');

body {
    font-family: 'Inter', sans-serif;
    background: #ffffff;
    color: #1a1a1a;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    font-weight: 300;
}

/* Modo Oscuro basado en Negro Puro */
.dark body {
    background: #000000;
    color: #ffffff;
}

/* Scrollbar Minimalista */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #e5e5e5; border-radius: 2px; }
.dark ::-webkit-scrollbar-thumb { background: #27272a; }
::-webkit-scrollbar-thumb:hover { background: #d4d4d4; }
.dark ::-webkit-scrollbar-thumb:hover { background: #52525b; }

.loading-bar {
    position: fixed; top: 0; left: 0; height: 2px; background: #1a1a1a;
    transition: width 0.4s ease; z-index: 1000;
}
.dark .loading-bar {
    background: #ffffff;
}

.font-mono { font-family: 'JetBrains Mono', monospace; letter-spacing: -0.02em; }

/* Inputs Limpios */
.config-input {
    background: transparent; border-bottom: 1px solid #e5e5e5; color: #1a1a1a;
    padding: 8px 0; border-radius: 0; font-size: 0.8rem; outline: none;
    transition: border-color 0.3s; width: 100%;
}
.dark .config-input {
    border-bottom: 1px solid #27272a;
    color: #ffffff;
}
.config-input:focus { border-bottom: 1px solid #1a1a1a; }
.dark .config-input:focus { border-bottom: 1px solid #ffffff; }

select.config-input { cursor: pointer; border-radius: 0; -webkit-appearance: none; }
.dark select.config-input { background-color: #000000; color: #ffffff; }
.dark option { background-color: #09090b; color: #ffffff; }

/* Botones */
.btn-nordic {
    background: #ffffff; color: #1a1a1a; text-transform: uppercase;
    font-size: 10px; letter-spacing: 0.1em; font-weight: 500;
    border: 1px solid #e5e5e5; padding: 8px 16px; transition: all 0.3s ease;
    font-family: 'Inter', sans-serif; cursor: pointer; display: flex; align-items: center; gap: 8px;
}
.dark .btn-nordic {
    background: #09090b; color: #f4f4f5; border: 1px solid #27272a;
}
.btn-nordic:hover { border-color: #1a1a1a; background: #fafafa; }
.dark .btn-nordic:hover { border-color: #a1a1aa; background: #000000; color: #ffffff; }
.btn-nordic:disabled { opacity: 0.5; cursor: default; border-color: #f0f0f0; }
.dark .btn-nordic:disabled { opacity: 0.4; border-color: #27272a; }
.btn-nordic.active { background: #1a1a1a; color: white; border-color: #1a1a1a; }
.dark .btn-nordic.active { background: #ffffff; color: #000000; border-color: #ffffff; }

.btn-primary {
    background: #1a1a1a; color: #ffffff; border: none;
    font-family: 'Inter', sans-serif; text-transform: uppercase;
    font-size: 11px; letter-spacing: 0.15em; padding: 16px;
    transition: opacity 0.3s; cursor: pointer; width: 100%;
    display: flex; justify-content: center; align-items: center; gap: 8px;
}
.dark .btn-primary {
    background: #ffffff; color: #000000; font-weight: 600;
}
.btn-primary:hover { opacity: 0.9; }
.dark .btn-primary:hover { opacity: 0.85; }
.btn-primary:disabled { background: #e5e5e5; color: #a3a3a3; cursor: not-allowed; }
.dark .btn-primary:disabled { background: #27272a; color: #71717a; }

.label-text {
    font-size: 9px; text-transform: uppercase; letter-spacing: 0.2em;
    color: #9ca3af; font-weight: 500; margin-bottom: 4px; display: block;
}
.dark .label-text {
    color: #a1a1aa;
}

/* --- GRID DE DATOS --- */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1.5rem; margin : 3%; margin-bottom: 20%; padding: 1rem; width: 94%;
}

.data-card {
    background: #ffffff00; border: 0px solid #f0f0f0; display: flex; flex-direction: column;
    transition: all 0.3s ease; cursor: pointer; height: auto; min-height: 190px;
    position: relative; overflow: visible;
}
.dark .data-card:hover { background-color: #09090b; border-color: #27272a; }
.data-card:hover { border-color: #1a1a1a; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.dark .data-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.5); }

.card-img-box {
    width: 100%; aspect-ratio: 1 / 1; background: #fafafa00; border-bottom: 0px solid #f0f0f0;
    display: flex; align-items: center; justify-content: center; overflow: hidden;
    position: relative; border-radius: 28%;
}
.dark .card-img-box { border: 1px solid #27272a; }
.card-img { width: 100%; height: 100%; object-fit: contain; padding: 0px; transition: transform 0.5s; }
.data-card:hover .card-img { transform: scale(1.05); }

.card-tag {
    text-shadow: -2px -2px 0 #FFFFFF, 2px -2px 0 #FFFFFF, -2px 2px 0 #FFFFFF, 2px 2px 0 #FFFFFF;
    position: absolute; top: 10px; left: 10px; background: rgba(255, 255, 255, 0);
    padding: 4px 8px; font-size: 9px; font-weight: 600; text-transform: uppercase;
    border: 0px solid #e5e5e5; letter-spacing: 0.05em; z-index: 10;
}
.dark .card-tag {
    text-shadow: none; background: rgba(0, 0, 0, 0.6); color: #818cf8;
    backdrop-filter: blur(2px); border-radius: 4px; border: none;
}

/* Estado Loading en Card */
.card-loading-overlay {
    position: absolute; inset: 0; background: rgba(255,255,255,0.9);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    z-index: 20; backdrop-filter: blur(1px);
}
.dark .card-loading-overlay {
    background: rgba(0,0,0,0.85); color: #34d399;
}

/* --- SIDEBARS --- */
.sidebar {
    position: absolute; top: 0; bottom: 0; width: 350px; background: #ffffff;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1); z-index: 50; display: flex; flex-direction: column;
    box-shadow: 0 0 30px rgba(0,0,0,0.05);
}
.dark .sidebar { background: #09090b; box-shadow: -10px 0 30px rgba(0,0,0,0.5); }
.sidebar-right { right: 0; border-left: 1px solid #e5e5e5; transform: translateX(100%); }
.dark .sidebar-right { border-left: 1px solid #27272a; }
.sidebar-right.open { transform: translateX(0); }

.sidebar-left { left: 0; border-right: 1px solid #e5e5e5; transform: translateX(-100%); width: 320px; }
.dark .sidebar-left { border-right: 1px solid #27272a; box-shadow: 10px 0 30px rgba(0,0,0,0.5); }
.sidebar-left.open { transform: translateX(0); }

.sidebar-bottom {
    top: auto; bottom: 0; left: 0; right: 0; width: 100%; height: 35vh;
    border-top: 1px solid #e5e5e5; border-left: none; transform: translateY(100%);
}
.dark .sidebar-bottom { border-top: 1px solid #27272a; box-shadow: 0 -10px 30px rgba(0,0,0,0.5); }
.sidebar-bottom.open { transform: translateY(0); }

/* Loader Overlay */
.loader-overlay {
    position: absolute; inset: 0; background: rgba(255,255,255,0.8);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    z-index: 20; backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.dark .loader-overlay { background: rgba(0,0,0,0.9); color: #a78bfa; }
.loader-overlay.active { opacity: 1; pointer-events: all; }

/* Log Console */
.log-console {
    font-family: 'JetBrains Mono', monospace; font-size: 0.65rem; color: #666;
    overflow-y: auto; display: flex; flex-direction: column-reverse;
}
.dark .log-console { color: #a1a1aa; }
.log-entry { margin-bottom: 4px; padding-left: 8px; border-left: 2px solid #eee; }
.dark .log-entry { border-left: 2px solid #27272a; }
.log-entry.info { border-color: #3b82f6; color: #1a1a1a; }
.dark .log-entry.info { color: #f4f4f5; }
.log-entry.success { border-color: #10b981; color: #047857; }
.dark .log-entry.success { color: #34d399; }
.log-entry.error { border-color: #ef4444; color: #b91c1c; }
.dark .log-entry.error { color: #fb7185; }

/* Toggle Minimalista (FIXED) */
.toggle-checkbox { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.toggle-checkbox:checked + .toggle-label { background-color: #1a1a1a; }
.dark .toggle-checkbox:checked + .toggle-label { background-color: #34d399; }
.toggle-checkbox:checked + .toggle-label .toggle-circle { transform: translateX(12px); }

.toggle-label {
    width: 28px; height: 16px; background-color: #e5e5e5; border-radius: 999px;
    position: relative; cursor: pointer; transition: background-color 0.2s ease; display: block; flex-shrink: 0;
}
.dark .toggle-label { background-color: #27272a; }
.toggle-circle {
    width: 12px; height: 12px; background-color: white; border-radius: 50%;
    position: absolute; top: 2px; left: 2px; transition: transform 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Pestañas e Interacciones */
.tab-active { border-color: #1a1a1a !important; color: #1a1a1a !important; }
.dark .tab-active { border-color: #ffffff !important; color: #ffffff !important; }
.cursor-zoom-in { cursor: zoom-in; }
.cursor-zoom-out { cursor: zoom-out; }
.animate-hover-spin { transition: transform 0.5s ease; }
.btn-nordic:hover .animate-hover-spin { transform: rotate(90deg); }

/* Adaptaciones de Compatibilidad de Texto Forzado */
.dark .text-black { color: #ffffff !important; }
.dark textarea::placeholder { color: #71717a; }
#ui-zoom-overlay { background: rgba(255,255,255,0.95) !important; }
.dark #ui-zoom-overlay { background: rgba(0,0,0,0.96) !important; }