/*
 * Temas oscuros de las vistas con menú (body.rdk-shell): Oscuro y Tenue (gris azulado, menos oscuro). Los dos llevan
 * html[data-theme="dark"]; Tenue además html[data-theme-variant="dim"], que solo cambia los valores de las variables.
 * Los pone el script del <head> de template.php según la preferencia del navegador (localStorage rdk_theme: light,
 * dim, dark o system) y los cambia src/js/rdk-theme.js (botón de la barra superior y menú de usuario). El Login no cambia.
 *
 * 1) Las hojas rdk usan las variables de color de :root (rdk-layout.css): aquí solo se cambian sus valores.
 * 2) Lo que no usa variables (Bootstrap 3, la plantilla Gentelella, DataTables, bootstrap-select, dibujos SVG)
 *    se corrige abajo, siempre bajo html[data-theme="dark"] .rdk-shell, con las variables --rdk-dk-* para lo que
 *    cambia entre Oscuro y Tenue.
 * Un color nuevo en una vista debe usar las variables (--rdk-surface, --rdk-text, --rdk-border, --rdk-*-soft...)
 * para que funcione en los tres temas sin tocar este archivo.
 */
html[data-theme="dark"] body.rdk-shell {
	color-scheme: dark;
	--rdk-navy: #1c2b3a;
	--rdk-accent-text: #62d1af;
	--rdk-mark: #a9bccd;
	--rdk-accent-soft: #133a31;
	--rdk-page-bg: #0f161d;
	--rdk-surface: #17212b;
	--rdk-surface-2: #1b2631;
	--rdk-surface-3: #1f2b37;
	--rdk-surface-4: #25333f;
	--rdk-surface-5: #0c1218;
	--rdk-text: #e3eaf0;
	--rdk-text-2: #c3ced8;
	--rdk-muted: #97a6b3;
	--rdk-faint: #6f8090;
	--rdk-border-soft: #212e3a;
	--rdk-border: #2a3846;
	--rdk-control-border: #3a4b5b;
	--rdk-border-strong: #52667a;
	--rdk-success-text: #62d1af;
	--rdk-success-soft: #133a31;
	--rdk-success-faint: #11302a;
	--rdk-success-line: #24614f;
	--rdk-warning-text: #f0b45c;
	--rdk-warning-soft: #3b2d13;
	--rdk-warning-faint: #31270f;
	--rdk-warning-line: #6e5220;
	--rdk-danger-text: #f2928c;
	--rdk-danger-soft: #3f1e20;
	--rdk-danger-faint: #341a1b;
	--rdk-danger-line: #73373a;
	--rdk-info-text: #82bbe8;
	--rdk-info-soft: #162f47;
	--rdk-info-faint: #14283b;
	--rdk-info-line: #2e5a80;
	--rdk-violet-text: #bba6f0;
	--rdk-violet-soft: #2b2346;
	--rdk-violet-line: #54448a;
	--rdk-shadow: rgba(0, 0, 0, .4);
	--rdk-nav-text: #b9c6d2;
	/* Solo de este archivo: lo que no sale de las variables comunes */
	--rdk-dk-primary: #2f5677;
	--rdk-dk-primary-hover: #3b6a91;
	--rdk-dk-link: #7fb6e6;
	--rdk-dk-link-hover: #a8cdef;
	--rdk-dk-selected: #24496a;
	--rdk-dk-menu-shadow: 0 8px 24px rgba(0, 0, 0, .45);
	--rdk-dk-modal-shadow: 0 16px 48px rgba(0, 0, 0, .55);
	--rdk-dk-backdrop: .7;
	--rdk-dk-metal: #5d7084;
	background: var(--rdk-page-bg);
	color: var(--rdk-text);
}
/* Tenue: gris azulado, menos contraste con el menú lateral */
html[data-theme="dark"][data-theme-variant="dim"] body.rdk-shell {
	--rdk-navy: #243444;
	--rdk-accent-text: #6fd8b8;
	--rdk-mark: #b6c6d4;
	--rdk-accent-soft: #1f4a3f;
	--rdk-page-bg: #222b35;
	--rdk-surface: #2b3540;
	--rdk-surface-2: #303b47;
	--rdk-surface-3: #35414d;
	--rdk-surface-4: #3b4855;
	--rdk-surface-5: #1e262f;
	--rdk-text: #e6ecf1;
	--rdk-text-2: #c9d3dc;
	--rdk-muted: #a2b0bc;
	--rdk-faint: #7f8e9b;
	--rdk-border-soft: #36424e;
	--rdk-border: #3e4b58;
	--rdk-control-border: #4c5b6a;
	--rdk-border-strong: #637485;
	--rdk-success-text: #6fd8b8;
	--rdk-success-soft: #1f4a3f;
	--rdk-success-faint: #233f38;
	--rdk-success-line: #2f6b59;
	--rdk-warning-text: #f3bd6a;
	--rdk-warning-soft: #4a3a1c;
	--rdk-warning-faint: #403521;
	--rdk-warning-line: #7a5c26;
	--rdk-danger-text: #f59d97;
	--rdk-danger-soft: #4d2a2d;
	--rdk-danger-faint: #432b2d;
	--rdk-danger-line: #7d4044;
	--rdk-info-text: #8cc3ee;
	--rdk-info-soft: #1f3d58;
	--rdk-info-faint: #243b50;
	--rdk-info-line: #3a6a92;
	--rdk-violet-text: #c3b0f3;
	--rdk-violet-soft: #3a3058;
	--rdk-violet-line: #5f4f99;
	--rdk-shadow: rgba(0, 0, 0, .3);
	--rdk-nav-text: #c3cfda;
	--rdk-dk-primary: #3a6386;
	--rdk-dk-primary-hover: #4673a0;
	--rdk-dk-link: #8cc3ee;
	--rdk-dk-link-hover: #b2d6f3;
	--rdk-dk-selected: #2f5677;
	--rdk-dk-menu-shadow: 0 8px 24px rgba(0, 0, 0, .35);
	--rdk-dk-modal-shadow: 0 16px 48px rgba(0, 0, 0, .45);
	--rdk-dk-backdrop: .6;
	--rdk-dk-metal: #6c8094;
}

/* ---------- Plantilla (Gentelella) ---------- */
html[data-theme="dark"] .rdk-shell .container.body .right_col,
html[data-theme="dark"] .rdk-shell .main_container { background: var(--rdk-page-bg); color: var(--rdk-text); }
html[data-theme="dark"] .rdk-shell footer { border-top: 1px solid var(--rdk-border); background: var(--rdk-surface); color: var(--rdk-muted); }
html[data-theme="dark"] .rdk-shell .nav_menu.rdk-topbar { box-shadow: inset 0 -1px 0 var(--rdk-border); }
html[data-theme="dark"] .rdk-shell .top_nav .nav > li > a:hover,
html[data-theme="dark"] .rdk-shell .top_nav .nav > li > a:focus,
html[data-theme="dark"] .rdk-shell .top_nav .nav .open > a { background: var(--rdk-surface-3); }
:where(html[data-theme="dark"] .rdk-shell) :is(h1, h2, h3, h4, h5, h6) { color: var(--rdk-text); }
:where(html[data-theme="dark"] .rdk-shell) a { color: var(--rdk-dk-link); }
:where(html[data-theme="dark"] .rdk-shell) a:hover,
:where(html[data-theme="dark"] .rdk-shell) a:focus { color: var(--rdk-dk-link-hover); }
html[data-theme="dark"] .rdk-shell hr { border-top-color: var(--rdk-border); }
html[data-theme="dark"] .rdk-shell ::selection { background: #2e5a80; color: #fff; }

/* ---------- Textos de Bootstrap ---------- */
html[data-theme="dark"] .rdk-shell .text-muted,
html[data-theme="dark"] .rdk-shell .help-block { color: var(--rdk-muted); }
html[data-theme="dark"] .rdk-shell .text-primary { color: var(--rdk-info-text); }
html[data-theme="dark"] .rdk-shell .text-success { color: var(--rdk-success-text); }
html[data-theme="dark"] .rdk-shell .text-info { color: var(--rdk-info-text); }
html[data-theme="dark"] .rdk-shell .text-warning { color: var(--rdk-warning-text); }
html[data-theme="dark"] .rdk-shell .text-danger,
html[data-theme="dark"] .rdk-shell .has-error .help-block,
html[data-theme="dark"] .rdk-shell .has-error .control-label { color: var(--rdk-danger-text); }
html[data-theme="dark"] .rdk-shell .has-success .help-block,
html[data-theme="dark"] .rdk-shell .has-success .control-label { color: var(--rdk-success-text); }
html[data-theme="dark"] .rdk-shell code { background: var(--rdk-danger-soft); color: var(--rdk-danger-text); }
html[data-theme="dark"] .rdk-shell pre { border-color: var(--rdk-border); background: var(--rdk-surface-2); color: var(--rdk-text); }
html[data-theme="dark"] .rdk-shell mark { background: var(--rdk-warning-soft); color: var(--rdk-text); }

/* ---------- Campos ---------- */
html[data-theme="dark"] .rdk-shell .form-control {
	border-color: var(--rdk-control-border);
	background-color: var(--rdk-surface);
	color: var(--rdk-text);
}
html[data-theme="dark"] .rdk-shell .form-control::placeholder { color: var(--rdk-faint); }
html[data-theme="dark"] .rdk-shell .form-control[readonly] { background-color: var(--rdk-surface-3); color: var(--rdk-text-2); }
/* Bloqueado: texto atenuado como en el tema claro y en los selects bloqueados (se distingue de un campo editable) */
html[data-theme="dark"] .rdk-shell .form-control[disabled],
html[data-theme="dark"] .rdk-shell fieldset[disabled] .form-control { background-color: var(--rdk-surface-3); color: var(--rdk-muted); }
html[data-theme="dark"] .rdk-shell .input-group-addon { border-color: var(--rdk-control-border); background: var(--rdk-surface-4); color: var(--rdk-text-2); }
html[data-theme="dark"] .rdk-shell select option { background: var(--rdk-surface); color: var(--rdk-text); }
/* Autocompletar del navegador: sin el fondo amarillo claro */
html[data-theme="dark"] .rdk-shell input:-webkit-autofill,
html[data-theme="dark"] .rdk-shell input:-webkit-autofill:hover,
html[data-theme="dark"] .rdk-shell input:-webkit-autofill:focus {
	-webkit-box-shadow: 0 0 0 1000px var(--rdk-surface) inset;
	-webkit-text-fill-color: var(--rdk-text);
	caret-color: var(--rdk-text);
}

/* ---------- Botones: el primario sobre fondo oscuro necesita más luz ---------- */
html[data-theme="dark"] .rdk-shell .btn-primary {
	--rdk-btn-bg: var(--rdk-dk-primary);
	--rdk-btn-border: var(--rdk-dk-primary);
	--rdk-btn-hover-bg: var(--rdk-dk-primary-hover);
	--rdk-btn-hover-border: var(--rdk-dk-primary-hover);
}
html[data-theme="dark"] .rdk-shell .btn-link { color: var(--rdk-dk-link); }
html[data-theme="dark"] .rdk-shell .close { color: var(--rdk-text); text-shadow: none; opacity: .6; }
html[data-theme="dark"] .rdk-shell .close:hover,
html[data-theme="dark"] .rdk-shell .close:focus { color: var(--rdk-text); opacity: 1; }

/* ---------- Menús desplegables, paneles y listas de Bootstrap ---------- */
html[data-theme="dark"] .rdk-shell .dropdown-menu {
	border-color: var(--rdk-border);
	background: var(--rdk-surface);
	box-shadow: var(--rdk-dk-menu-shadow);
	color: var(--rdk-text);
}
html[data-theme="dark"] .rdk-shell .dropdown-menu > li > a { color: var(--rdk-text-2); }
html[data-theme="dark"] .rdk-shell .dropdown-menu > li > a:hover,
html[data-theme="dark"] .rdk-shell .dropdown-menu > li > a:focus { background: var(--rdk-surface-3); color: var(--rdk-text); }
html[data-theme="dark"] .rdk-shell .dropdown-menu > .disabled > a,
html[data-theme="dark"] .rdk-shell .dropdown-menu > .disabled > a:hover { background: transparent; color: var(--rdk-faint); }
html[data-theme="dark"] .rdk-shell .dropdown-menu .divider { background: var(--rdk-border); }
html[data-theme="dark"] .rdk-shell .dropdown-header { color: var(--rdk-muted); }
html[data-theme="dark"] .rdk-shell .navbar-nav .open .dropdown-menu { border-color: var(--rdk-border); background: var(--rdk-surface); }
html[data-theme="dark"] .rdk-shell .well { border-color: var(--rdk-border); background: var(--rdk-surface-2); box-shadow: none; }
html[data-theme="dark"] .rdk-shell .panel { border-color: var(--rdk-border); background: var(--rdk-surface); }
html[data-theme="dark"] .rdk-shell .panel-default > .panel-heading,
html[data-theme="dark"] .rdk-shell .panel-footer { border-color: var(--rdk-border); background: var(--rdk-surface-2); color: var(--rdk-text); }
html[data-theme="dark"] .rdk-shell .list-group-item { border-color: var(--rdk-border); background: var(--rdk-surface); color: var(--rdk-text); }
html[data-theme="dark"] .rdk-shell a.list-group-item:hover,
html[data-theme="dark"] .rdk-shell button.list-group-item:hover { background: var(--rdk-surface-3); }
html[data-theme="dark"] .rdk-shell .nav > li > a:hover,
html[data-theme="dark"] .rdk-shell .nav > li > a:focus { background: var(--rdk-surface-3); }
html[data-theme="dark"] .rdk-shell .nav-tabs { border-bottom-color: var(--rdk-border); }
html[data-theme="dark"] .rdk-shell .nav-tabs > li > a:hover { border-color: var(--rdk-border) var(--rdk-border) transparent; }
html[data-theme="dark"] .rdk-shell .nav-tabs > li.active > a,
html[data-theme="dark"] .rdk-shell .nav-tabs > li.active > a:hover,
html[data-theme="dark"] .rdk-shell .nav-tabs > li.active > a:focus { border-color: var(--rdk-border) var(--rdk-border) transparent; background: var(--rdk-surface); color: var(--rdk-text); }
html[data-theme="dark"] .rdk-shell .progress { background: var(--rdk-surface-5); box-shadow: none; }
html[data-theme="dark"] .rdk-shell .popover { border-color: var(--rdk-border); background: var(--rdk-surface); color: var(--rdk-text); }
html[data-theme="dark"] .rdk-shell .popover-title { border-bottom-color: var(--rdk-border); background: var(--rdk-surface-2); }
html[data-theme="dark"] .rdk-shell .popover.top > .arrow::after { border-top-color: var(--rdk-surface); }
html[data-theme="dark"] .rdk-shell .popover.bottom > .arrow::after { border-bottom-color: var(--rdk-surface); }
html[data-theme="dark"] .rdk-shell .popover.left > .arrow::after { border-left-color: var(--rdk-surface); }
html[data-theme="dark"] .rdk-shell .popover.right > .arrow::after { border-right-color: var(--rdk-surface); }

/* Avisos de Bootstrap */
html[data-theme="dark"] .rdk-shell .alert-success { border-color: var(--rdk-success-line); background: var(--rdk-success-faint); color: var(--rdk-success-text); }
html[data-theme="dark"] .rdk-shell .alert-info { border-color: var(--rdk-info-line); background: var(--rdk-info-faint); color: var(--rdk-info-text); }
html[data-theme="dark"] .rdk-shell .alert-warning { border-color: var(--rdk-warning-line); background: var(--rdk-warning-faint); color: var(--rdk-warning-text); }
html[data-theme="dark"] .rdk-shell .alert-danger { border-color: var(--rdk-danger-line); background: var(--rdk-danger-faint); color: var(--rdk-danger-text); }

/* ---------- Modales ---------- */
html[data-theme="dark"] .rdk-shell .modal-content { border-color: var(--rdk-border); background: var(--rdk-surface); box-shadow: var(--rdk-dk-modal-shadow); color: var(--rdk-text); }
html[data-theme="dark"] .rdk-shell .modal-header,
html[data-theme="dark"] .rdk-shell .modal-footer { border-color: var(--rdk-border); }
html[data-theme="dark"] .rdk-shell .modal-backdrop.in { opacity: var(--rdk-dk-backdrop); }

/* ---------- Tablas y DataTables ---------- */
html[data-theme="dark"] .rdk-shell .table { color: var(--rdk-text); }
html[data-theme="dark"] .rdk-shell .table > thead > tr > th,
html[data-theme="dark"] .rdk-shell .table > tbody > tr > th,
html[data-theme="dark"] .rdk-shell .table > tfoot > tr > th,
html[data-theme="dark"] .rdk-shell .table > thead > tr > td,
html[data-theme="dark"] .rdk-shell .table > tbody > tr > td,
html[data-theme="dark"] .rdk-shell .table > tfoot > tr > td { border-color: var(--rdk-border-soft); }
html[data-theme="dark"] .rdk-shell .table-bordered,
html[data-theme="dark"] .rdk-shell .table-bordered > thead > tr > th,
html[data-theme="dark"] .rdk-shell .table-bordered > tbody > tr > td,
html[data-theme="dark"] .rdk-shell .table-bordered > tbody > tr > th,
html[data-theme="dark"] .rdk-shell .table-bordered > tfoot > tr > td,
html[data-theme="dark"] .rdk-shell .table-bordered > tfoot > tr > th { border-color: var(--rdk-border); }
html[data-theme="dark"] .rdk-shell .table-striped > tbody > tr:nth-of-type(odd) { background: var(--rdk-surface-2); }
html[data-theme="dark"] .rdk-shell .table-hover > tbody > tr:hover { background: var(--rdk-surface-3); }
html[data-theme="dark"] .rdk-shell .table > tbody > tr.active > td,
html[data-theme="dark"] .rdk-shell .table > tbody > tr > td.active { background: var(--rdk-surface-3); }
html[data-theme="dark"] .rdk-shell .table > tbody > tr.success > td,
html[data-theme="dark"] .rdk-shell .table > tbody > tr > td.success { background: var(--rdk-success-soft); }
html[data-theme="dark"] .rdk-shell .table > tbody > tr.info > td,
html[data-theme="dark"] .rdk-shell .table > tbody > tr > td.info { background: var(--rdk-info-soft); }
html[data-theme="dark"] .rdk-shell .table > tbody > tr.warning > td,
html[data-theme="dark"] .rdk-shell .table > tbody > tr > td.warning { background: var(--rdk-warning-soft); }
html[data-theme="dark"] .rdk-shell .table > tbody > tr.danger > td,
html[data-theme="dark"] .rdk-shell .table > tbody > tr > td.danger { background: var(--rdk-danger-soft); }
html[data-theme="dark"] .rdk-shell table.dataTable.fixedHeader-floating,
html[data-theme="dark"] .rdk-shell table.dataTable.fixedHeader-locked { background: var(--rdk-surface); }
html[data-theme="dark"] .rdk-shell div.dataTables_processing { border-color: var(--rdk-border); background: var(--rdk-surface); color: var(--rdk-text); }
html[data-theme="dark"] .rdk-shell table.dataTable > tbody > tr.child ul.dtr-details > li { border-bottom-color: var(--rdk-border-soft); }
html[data-theme="dark"] .rdk-shell table.dataTable tbody > tr.selected,
html[data-theme="dark"] .rdk-shell table.dataTable tbody > tr > .selected { background: var(--rdk-dk-selected); }
html[data-theme="dark"] .rdk-shell .pagination > li > a,
html[data-theme="dark"] .rdk-shell .pagination > li > span { border-color: var(--rdk-control-border); background: var(--rdk-surface); color: var(--rdk-text); }
html[data-theme="dark"] .rdk-shell .pagination > li > a:hover { background: var(--rdk-surface-3); }
html[data-theme="dark"] .rdk-shell .pagination > .disabled > a,
html[data-theme="dark"] .rdk-shell .pagination > .disabled > span { background: var(--rdk-surface); color: var(--rdk-faint); }

/* ---------- bootstrap-select ---------- */
html[data-theme="dark"] .rdk-shell .bootstrap-select .dropdown-menu li a { color: var(--rdk-text-2); }
html[data-theme="dark"] .rdk-shell .bootstrap-select .dropdown-menu li a:hover,
html[data-theme="dark"] .rdk-shell .bootstrap-select .dropdown-menu li.active a,
html[data-theme="dark"] .rdk-shell .bootstrap-select .dropdown-menu li.selected a { background: var(--rdk-surface-3); color: var(--rdk-text); }
html[data-theme="dark"] .rdk-shell .bootstrap-select .dropdown-menu li.disabled a { color: var(--rdk-faint); }
html[data-theme="dark"] .rdk-shell .bootstrap-select .dropdown-menu li small,
html[data-theme="dark"] .rdk-shell .bootstrap-select .dropdown-header { color: var(--rdk-muted); }
html[data-theme="dark"] .rdk-shell .bootstrap-select .no-results { background: var(--rdk-surface-2); color: var(--rdk-muted); }
html[data-theme="dark"] .rdk-shell .bootstrap-select .bs-actionsbox .btn,
html[data-theme="dark"] .rdk-shell .bootstrap-select .bs-donebutton .btn { color: var(--rdk-text); }

/* ---------- Dibujos de Combustible (tanques y pipas) ---------- */
html[data-theme="dark"] .rdk-shell :is(.rdk-tank-shell, .rdk-pipa-shell) { fill: var(--rdk-surface-4); }
html[data-theme="dark"] .rdk-shell .rdk-tank-valve { fill: var(--rdk-surface); stroke: #8a9cad; }
html[data-theme="dark"] .rdk-shell :is(.rdk-pipa-road, .rdk-pipa-lane) { stroke: var(--rdk-control-border); }
html[data-theme="dark"] .rdk-shell :is(.rdk-pipa-chassis, .rdk-pipa-bumper, .rdk-pipa-leg, .rdk-pipa-mirror) { fill: var(--rdk-dk-metal); }
html[data-theme="dark"] .rdk-shell .rdk-pipa-guard { stroke: var(--rdk-dk-metal); }
html[data-theme="dark"] .rdk-shell .rdk-tank-low { stroke: var(--rdk-warning-text); }
