/* ==========================================================================
   Site Security - design system
   Layered on top of Tabler 1.5 / Bootstrap 5. Tokens first, then component
   overrides. Everything under [data-bs-theme="dark"] mirrors the light
   tokens so both themes stay in sync.

   Tabler doesn't ship AdminLTE's card-color/callout/small-box/info-box/
   btn-block helpers, and Bootstrap 5 dropped form-group/btn-block outright -
   rather than touch every page that still uses that vocabulary, this file
   backfills those classes to the same visual result they always had.
   ========================================================================== */

:root {
	--psec-primary: #4f46e5;
	--psec-primary-dark: #4338ca;
	--psec-primary-light: #6366f1;
	--psec-accent: #0ea5e9;

	--psec-bg: #f3f4f6;
	--psec-surface: #ffffff;
	--psec-surface-alt: #f9fafb;
	--psec-border: #e5e7eb;
	--psec-text: #111827;
	--psec-text-muted: #6b7280;

	--psec-sidebar-bg: #111827;
	--psec-sidebar-bg-alt: #1f2937;
	--psec-sidebar-text: #cbd5e1;
	--psec-sidebar-active: var(--psec-primary);

	--psec-success: #059669;
	--psec-danger: #dc2626;
	--psec-warning: #d97706;
	--psec-info: #0284c7;
	--psec-secondary: #64748b;

	--psec-radius: 0.5rem;
	--psec-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.08);
	--psec-shadow-lg: 0 4px 12px rgba(15, 23, 42, 0.10);
}

:root[data-bs-theme="dark"] {
	--psec-bg: #0b1120;
	--psec-surface: #161e2e;
	--psec-surface-alt: #1c2637;
	--psec-border: #2a3549;
	--psec-text: #e5e7eb;
	--psec-text-muted: #9aa5b4;

	--psec-sidebar-bg: #0b1120;
	--psec-sidebar-bg-alt: #161e2e;
}

/* ---------------------------------------------------------------------- */
/* Base                                                                    */
/* ---------------------------------------------------------------------- */

body, .page-wrapper {
	background-color: var(--psec-bg);
	color: var(--psec-text);
}

a:link, a:visited {
	text-decoration: none;
}

.height_auto {
	height: auto;
}

.margin_auto {
	height: auto;
}

.marg_bottom {
	margin-bottom: 0;
}

.width100 {
	width: 100%;
}

.font13 { font-size: 13px; }
.font14 { font-size: 14px; }
.font20 { font-size: 20px; }
.font35 { font-size: 35px; }

.map_div {
	width: 99%;
	height: 450px;
	border-radius: var(--psec-radius);
	overflow: hidden;
	z-index: 1;
}

/* ---------------------------------------------------------------------- */
/* Navbar + sidebar                                                       */
/* ---------------------------------------------------------------------- */

header.navbar {
	background-color: var(--psec-surface);
	border-bottom: 1px solid var(--psec-border);
}

:root[data-bs-theme="dark"] header.navbar {
	background-color: var(--psec-surface);
}

/* input-group-flat assumes it sits on a light card surface and blends
   into it - on the header (dark in both themes) that leaves ~zero
   contrast between the input and the bar itself. A translucent white
   overlay guarantees a visible box against any bg, light or dark. */
header.navbar .input-group-flat .form-control,
header.navbar .input-group-flat .input-group-text {
	background-color: rgba(255, 255, 255, 0.14);
	border-color: rgba(255, 255, 255, 0.22);
	color: #fff;
}

header.navbar .input-group-flat .form-control::placeholder {
	color: rgba(255, 255, 255, 0.6);
	opacity: 1;
}

header.navbar .input-group-flat .form-control:focus {
	background-color: rgba(255, 255, 255, 0.2);
	box-shadow: none;
}

.navbar-vertical {
	--tblr-navbar-bg: var(--psec-sidebar-bg);
}

.navbar-vertical .navbar-brand {
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
	padding-bottom: 1rem;
}

.navbar-vertical .navbar-brand svg,
.navbar-vertical .navbar-brand img {
	margin-right: 2px;
}

.navbar-vertical .nav-link.active,
.navbar-vertical .dropdown-item.active {
	background-color: var(--psec-primary);
	color: #fff;
	border-radius: var(--psec-radius);
}

.navbar-vertical .nav-link:hover {
	border-radius: var(--psec-radius);
}

.navbar-vertical .nav-header {
	color: #64748b;
	font-weight: 700;
	font-size: 0.7rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	display: flex;
	align-items: center;
	padding: 1rem 0.5rem 0.25rem;
}

/* ---------------------------------------------------------------------- */
/* Cards / tables / buttons                                               */
/* ---------------------------------------------------------------------- */

.card {
	border-radius: var(--psec-radius);
	box-shadow: var(--psec-shadow);
	border: 1px solid var(--psec-border);
}

:root[data-bs-theme="dark"] .card {
	background-color: var(--psec-surface);
	color: var(--psec-text);
}

/* .bg-light is a literal Bootstrap utility - it doesn't react to
   data-bs-theme the way .card/.table do, so the "module status" tiles
   (dashboard.php, system-info.php, ...) render pale-on-pale in dark mode
   unless overridden. */
:root[data-bs-theme="dark"] .bg-light {
	background-color: var(--psec-surface-alt) !important;
	color: var(--psec-text) !important;
}

.card-header {
	border-radius: var(--psec-radius) var(--psec-radius) 0 0 !important;
	font-weight: 600;
}

.btn {
	border-radius: 0.4rem;
}

.btn-primary {
	background-color: var(--psec-primary);
	border-color: var(--psec-primary);
}

.btn-primary:hover, .btn-primary:focus {
	background-color: var(--psec-primary-dark);
	border-color: var(--psec-primary-dark);
}

.btn-flat {
	border-radius: 0.35rem !important;
}

/* Bootstrap 5 dropped .btn-block - same definition it always had. */
.btn-block {
	display: block;
	width: 100%;
}

/* Bootstrap 5 dropped .form-group - same bottom margin it always had. */
.form-group {
	margin-bottom: 1rem;
}

.form-bordered .form-group,
.form-bordered .mb-3 {
	border-bottom: 1px solid var(--psec-border);
	padding-bottom: 0.75rem;
}

/* -- Card color context (card-primary/success/danger/warning/secondary) --
   Combined with .card-outline: colored top border only.
   On its own: solid colored header, white text.
   Combined with .card-solid: the whole card is colored, white text.        */
.card.card-outline.card-primary   { border-top: 3px solid var(--psec-primary); }
.card.card-outline.card-success   { border-top: 3px solid var(--psec-success); }
.card.card-outline.card-danger    { border-top: 3px solid var(--psec-danger); }
.card.card-outline.card-warning   { border-top: 3px solid var(--psec-warning); }
.card.card-outline.card-info      { border-top: 3px solid var(--psec-info); }
.card.card-outline.card-secondary { border-top: 3px solid var(--psec-secondary); }

.card.card-primary:not(.card-outline):not(.card-solid) > .card-header   { background-color: var(--psec-primary); color: #fff; }
.card.card-success:not(.card-outline):not(.card-solid) > .card-header   { background-color: var(--psec-success); color: #fff; }
.card.card-danger:not(.card-outline):not(.card-solid) > .card-header    { background-color: var(--psec-danger); color: #fff; }
.card.card-warning:not(.card-outline):not(.card-solid) > .card-header   { background-color: var(--psec-warning); color: #fff; }
.card.card-info:not(.card-outline):not(.card-solid) > .card-header      { background-color: var(--psec-info); color: #fff; }
.card.card-secondary:not(.card-outline):not(.card-solid) > .card-header { background-color: var(--psec-secondary); color: #fff; }

.card.card-solid.card-primary   { background-color: var(--psec-primary); color: #fff; }
.card.card-solid.card-success   { background-color: var(--psec-success); color: #fff; }
.card.card-solid.card-danger    { background-color: var(--psec-danger); color: #fff; }
.card.card-solid.card-warning   { background-color: var(--psec-warning); color: #fff; }
.card.card-solid.card-info      { background-color: var(--psec-info); color: #fff; }
.card.card-solid.card-secondary { background-color: var(--psec-secondary); color: #fff; }
.card.card-solid > .card-header { background-color: rgba(255, 255, 255, 0.12); color: inherit; }

/* -- Callout (colored left-border box; AdminLTE class, no Tabler equivalent) -- */
.callout {
	border-radius: 0 var(--psec-radius) var(--psec-radius) 0;
	padding: 1rem 1.25rem;
	margin-bottom: 1rem;
	border-left: 4px solid var(--psec-secondary);
	background-color: var(--psec-surface-alt);
}

.callout-default { border-left-color: var(--psec-secondary); }
.callout-info     { border-left-color: var(--psec-info); }
.callout-warning  { border-left-color: var(--psec-warning); }
.callout-danger   { border-left-color: var(--psec-danger); }

/* -- Small-box / info-box stat widgets (AdminLTE DOM, restyled here) -- */
.small-box, .info-box {
	position: relative;
	border-radius: var(--psec-radius);
	box-shadow: var(--psec-shadow);
	color: #fff;
	overflow: hidden;
}

.small-box { padding: 0; }

.small-box .inner { padding: 1.25rem; }

.small-box h3 {
	font-size: 2rem;
	font-weight: 700;
	margin: 0 0 0.25rem;
}

.small-box p { margin: 0; opacity: 0.9; }

.small-box .icon {
	position: absolute;
	top: -0.6rem;
	right: 0.5rem;
	font-size: 4.5rem;
	opacity: 0.25;
}

.small-box .small-box-footer {
	display: block;
	padding: 0.5rem;
	text-align: center;
	color: rgba(255, 255, 255, 0.9);
	background: rgba(0, 0, 0, 0.12);
	position: relative;
}

.small-box .small-box-footer:hover {
	background: rgba(0, 0, 0, 0.2);
	color: #fff;
}

.info-box {
	display: flex;
	align-items: center;
	background-color: var(--psec-surface);
	color: var(--psec-text);
	padding: 0.75rem;
}

.info-box .info-box-icon {
	flex-shrink: 0;
	width: 3rem;
	height: 3rem;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: var(--psec-radius);
	font-size: 1.5rem;
	color: #fff;
	margin-right: 0.75rem;
}

.info-box .info-box-content { min-width: 0; }
.info-box .info-box-text { font-size: 0.8rem; text-transform: uppercase; color: var(--psec-text-muted); }
.info-box .info-box-number { font-size: 1.25rem; font-weight: 700; }

.table thead {
	font-size: 0.78rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--psec-text-muted);
}

:root[data-bs-theme="dark"] .table {
	color: var(--psec-text);
}

/* Module status "enabled/disabled" cards */

.pm_enabled {
	color: var(--psec-success);
}

.pm_disabledblue {
	color: var(--psec-primary);
}

.pm_disabled {
	color: var(--psec-danger);
}

/* Public-facing warning pages */

.wpage_head {
	background-color: var(--psec-danger);
	color: white;
	border-radius: var(--psec-radius);
}

/* ---------------------------------------------------------------------- */
/* .psec-switch - CSS-only toggle switch (replaces the old Switchery JS
   widget; same markup, <input type="checkbox" class="psec-switch">)      */
/* ---------------------------------------------------------------------- */

/* Off = red, on = green - a security app's toggles should read at a
   glance, and color is a clearer "is this protection active?" signal
   than a plain slide position. Same pair in both themes since the pill
   is a small filled shape judged against its own white knob, not the
   page background, so it doesn't need a separate dark-mode tint. */
input.psec-switch {
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	position: relative;
	width: 46px;
	height: 26px;
	border-radius: 999px;
	background-color: var(--psec-danger);
	border: none;
	outline: none;
	cursor: pointer;
	vertical-align: middle;
	transition: background-color 0.15s ease-in-out;
}

input.psec-switch::before {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background-color: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
	transition: left 0.15s ease-in-out;
}

input.psec-switch:checked {
	background-color: var(--psec-success);
}

input.psec-switch:checked::before {
	left: 23px;
}

input.psec-switch:focus-visible {
	box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.35);
}

input.psec-switch:checked:focus-visible {
	box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.35);
}

/* ---------------------------------------------------------------------- */
/* Login page                                                             */
/* ---------------------------------------------------------------------- */

.login-page {
	background: linear-gradient(160deg, var(--psec-sidebar-bg) 0%, var(--psec-sidebar-bg-alt) 100%);
}

.login-page h1 {
	font-size: 1.6rem;
	color: #fff;
}

.login-page h1 svg {
	vertical-align: -4px;
	margin-right: 2px;
}

/* ---------------------------------------------------------------------- */
/* Scroll-to-top button                                                   */
/* ---------------------------------------------------------------------- */

.scroll-btn {
	height: 42px;
	width: 42px;
	padding: 0;
	font: inherit;
	color: inherit;
	border: none;
	border-radius: 50%;
	background-color: var(--psec-primary);
	position: fixed;
	bottom: 25px;
	right: 20px;
	opacity: 0.9;
	z-index: 9999;
	cursor: pointer;
	display: none;
	box-shadow: var(--psec-shadow-lg);
}

.scroll-btn .scroll-btn-arrow {
	height: 10px;
	width: 10px;
	border: 3px solid;
	border-right: none;
	border-top: none;
	margin: 15px 14px;
	transform: rotate(135deg);
	color: white;
}

.notouch .scroll-btn:hover { opacity: 1; }

@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) {
	.scroll-btn {
		bottom: 8px;
		right: 8px;
	}
}

/* ---------------------------------------------------------------------- */
/* Misc third-party widget fit-and-finish                                 */
/* ---------------------------------------------------------------------- */

div.dt-buttons {
	width: auto !important;
}

:root[data-bs-theme="dark"] .select2-container--default .select2-selection--single {
	background-color: var(--psec-surface-alt);
	border-color: var(--psec-border);
	color: var(--psec-text);
}

:root[data-bs-theme="dark"] .select2-dropdown {
	background-color: var(--psec-surface-alt);
	border-color: var(--psec-border);
	color: var(--psec-text);
}

:root[data-bs-theme="dark"] .select2-results__option--highlighted {
	background-color: var(--psec-primary) !important;
}
