/* =====================================================
   Page Wrapper — Header, Footer, Container Dark Mode
   ===================================================== */

/* Container */
.pw-container {
	background-color: #ffffff;
	transition: background-color 0.2s ease;
}
[data-theme="dark"] .pw-container {
	background-color: #111827;
}

/* =====================================================
   Header / Branding Bar
   ===================================================== */
.pw-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 24px;
	background: linear-gradient(135deg, #1a2332 0%, #263548 100%);
	border-bottom: 3px solid #4f7df5;
}
[data-theme="dark"] .pw-header {
	background: linear-gradient(135deg, #0d1117 0%, #161b26 100%);
	border-bottom-color: #6b8df5;
}

.pw-brand {
	display: flex;
	align-items: center;
	gap: 14px;
}
.pw-brand-logo {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	border-radius: 10px;
	background: rgba(79, 125, 245, 0.15);
	border: 1px solid rgba(79, 125, 245, 0.3);
	color: #6b9bff;
	font-size: 20px;
}
.pw-brand-name {
	font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
	font-size: 20px;
	font-weight: 700;
	color: #ffffff;
	letter-spacing: -0.02em;
	line-height: 1.2;
}
.pw-brand-accent {
	font-weight: 400;
	color: #7db0ff;
}
.pw-brand-sub {
	font-size: 11px;
	font-weight: 500;
	color: #7a8fa6;
	letter-spacing: 0.5px;
	text-transform: uppercase;
}

/* Navigation links in header */
.pw-nav {
	text-align: right;
}
.pw-nav div {
	float: none !important;
	text-align: right !important;
}
.pw-nav,
.pw-nav a,
.pw-nav b {
	font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
	font-size: 12px;
	color: #94a8c0;
}
.pw-nav a {
	color: #93c5fd;
	text-decoration: none;
	padding: 2px 4px;
	border-radius: 3px;
	transition: color 0.15s ease, background 0.15s ease;
}
.pw-nav a:hover {
	color: #ffffff;
	background: rgba(255, 255, 255, 0.08);
}
.pw-nav b {
	color: #ffffff;
	font-weight: 700;
}
.pw-nav small a {
	color: #6b7f99;
}
.pw-nav small a:hover {
	color: #ff7b7b;
}

/* Dark Mode Toggle — inline with nav links */
.pw-darkmode-toggle {
	color: #93c5fd;
	text-decoration: none;
	padding: 2px 4px;
	border-radius: 3px;
	transition: color 0.15s ease, background 0.15s ease;
	white-space: nowrap;
}
.pw-darkmode-toggle:hover {
	color: #ffffff;
	background: rgba(255, 255, 255, 0.08);
}

/* =====================================================
   Page Title Bar (replaces .well)
   ===================================================== */
.pw-title-bar {
	padding: 12px 24px;
	background: #f8fafc;
	border-bottom: 1px solid #e2e8f0;
}
[data-theme="dark"] .pw-title-bar {
	background: #161b26;
	border-bottom-color: #2a3444;
}
.pw-page-title {
	margin: 0;
	font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
	font-size: 16px;
	font-weight: 700;
	color: #1a2332;
	letter-spacing: -0.01em;
}
[data-theme="dark"] .pw-page-title {
	color: #e2e8f0;
}

/* =====================================================
   Footer
   ===================================================== */
.pw-footer {
	text-align: center;
	padding: 14px 10px;
	font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
	font-size: 12px;
	color: #7a8a9a;
	background: #f1f5f9;
	border-top: 1px solid #e2e8f0;
	border-radius: 0 0 4px 4px;
}
[data-theme="dark"] .pw-footer {
	background: #0d1117;
	border-top-color: #2a3444;
	color: #556070;
}

/* =====================================================
   Legacy well & footer overrides
   ===================================================== */
.well.well-sm {
	transition: background-color 0.2s ease, border-color 0.2s ease;
}
[data-theme="dark"] .well.well-sm {
	background: #161b26;
	border-color: #2a3444;
	color: #b0bec5;
}
[data-theme="dark"] .footer {
	background-color: #0d1117 !important;
	color: #556070;
	border-top: 1px solid #2a3444;
}

/* =====================================================
   Bootstrap / Global Dark Mode Overrides
   ===================================================== */
[data-theme="dark"] .breadcrumb {
	background: #161b26;
	border-color: #2a3444;
}
[data-theme="dark"] .breadcrumb > li,
[data-theme="dark"] .breadcrumb > .active {
	color: #7a8a9a;
}
[data-theme="dark"] .breadcrumb > li > a {
	color: #93c5fd;
}

/* Global link color improvements for dark mode */
[data-theme="dark"] a {
	color: #93c5fd;
}
[data-theme="dark"] a:hover {
	color: #bfdbfe;
}
[data-theme="dark"] td a,
[data-theme="dark"] p a {
	color: #93c5fd;
}
[data-theme="dark"] td a:hover,
[data-theme="dark"] p a:hover {
	color: #bfdbfe;
}

/* Form controls */
[data-theme="dark"] .form-control {
	background-color: #1a2030;
	border-color: #2a3444;
	color: #b0bec5;
}
[data-theme="dark"] .form-control:focus {
	border-color: #93c5fd;
	background-color: #1e2638;
}

/* Form labels & horizontal form text */
[data-theme="dark"] label,
[data-theme="dark"] .form-horizontal .control-label,
[data-theme="dark"] .form-group label {
	color: #b0bec5;
}
[data-theme="dark"] .checkbox-control {
	accent-color: #93c5fd;
}
[data-theme="dark"] hr {
	border-top-color: #2a3444;
}

/* DataTables overrides */
[data-theme="dark"] .dataTables_wrapper {
	color: #b0bec5;
}
[data-theme="dark"] .dataTables_wrapper .dataTables_filter input,
[data-theme="dark"] .dataTables_wrapper .dataTables_length select {
	background: #1a2030;
	border-color: #2a3444;
	color: #b0bec5;
}

/* DataTables scroll containers */
[data-theme="dark"] .dataTables_scrollHead,
[data-theme="dark"] .dataTables_scrollHead .dataTables_scrollHeadInner,
[data-theme="dark"] .dataTables_scrollHead table {
	background-color: #111827 !important;
}
[data-theme="dark"] .dataTables_scrollBody {
	background-color: #1a2030 !important;
}
[data-theme="dark"] .dataTables_scrollHead th {
	background-color: #111827 !important;
	color: #556070 !important;
	border-bottom-color: #2a3444 !important;
}

/* DataTables sorting arrows */
[data-theme="dark"] table.dataTable thead .sorting,
[data-theme="dark"] table.dataTable thead .sorting_asc,
[data-theme="dark"] table.dataTable thead .sorting_desc {
	background-color: #111827 !important;
	color: #556070 !important;
}

/* DataTables sorted-column highlight (prevents white column flash) */
[data-theme="dark"] table.dataTable tbody td.sorting_1,
[data-theme="dark"] table.dataTable tbody tr.odd td.sorting_1,
[data-theme="dark"] table.dataTable tbody tr.even td.sorting_1 {
	background-color: transparent !important;
}

/* DataTables info/length/filter labels */
[data-theme="dark"] .dataTables_wrapper .dataTables_info,
[data-theme="dark"] .dataTables_wrapper .dataTables_length label,
[data-theme="dark"] .dataTables_wrapper .dataTables_filter label {
	color: #7a8a9a !important;
}

/* DataTables body cell text */
[data-theme="dark"] .dataTables_scrollBody td,
[data-theme="dark"] table.dataTable tbody td {
	color: #b0bec5 !important;
	border-bottom-color: #2a3444;
}

/* =====================================================
   Bootstrap Table Dark Mode Overrides
   ===================================================== */
[data-theme="dark"] .table {
	background-color: #1a2030;
	color: #b0bec5;
}
[data-theme="dark"] .table > thead > tr > th {
	background-color: #111827 !important;
	color: #7a8a9a !important;
	border-bottom-color: #2a3444 !important;
}
[data-theme="dark"] .table > tbody > tr > td,
[data-theme="dark"] .table > tbody > tr > th {
	border-top-color: #222c3a;
	color: #b0bec5;
}
[data-theme="dark"] .table-bordered {
	border-color: #2a3444;
}
[data-theme="dark"] .table-bordered > thead > tr > th,
[data-theme="dark"] .table-bordered > thead > tr > td,
[data-theme="dark"] .table-bordered > tbody > tr > th,
[data-theme="dark"] .table-bordered > tbody > tr > td {
	border-color: #2a3444;
}
[data-theme="dark"] .table-striped > tbody > tr:nth-child(odd) > td,
[data-theme="dark"] .table-striped > tbody > tr:nth-child(odd) > th {
	background-color: #151b28 !important;
}
[data-theme="dark"] .table-striped > tbody > tr:nth-child(even) > td,
[data-theme="dark"] .table-striped > tbody > tr:nth-child(even) > th {
	background-color: #1a2030 !important;
}
[data-theme="dark"] .table > tbody > tr:hover > td,
[data-theme="dark"] .table > tbody > tr:hover > th,
[data-theme="dark"] .table-striped > tbody > tr:hover > td,
[data-theme="dark"] .table-striped > tbody > tr:hover > th {
	background-color: #1e2a42 !important;
}

/* jQuery UI DataTables wrapper dark mode */
[data-theme="dark"] .fg-toolbar,
[data-theme="dark"] .ui-widget-header {
	background: #161b26 !important;
	border-color: #2a3444 !important;
	color: #7a8a9a !important;
}
[data-theme="dark"] .ui-state-default {
	background: #1a2030 !important;
	border-color: #2a3444 !important;
	color: #b0bec5 !important;
}
[data-theme="dark"] .ui-state-hover {
	background: #1e2a42 !important;
	border-color: #3a4a5a !important;
	color: #93c5fd !important;
}
[data-theme="dark"] .ui-state-active {
	background: #1e2a42 !important;
	border-color: #4f7df5 !important;
	color: #93c5fd !important;
}
[data-theme="dark"] .dataTables_paginate .ui-state-disabled {
	opacity: 0.4 !important;
}

/* =====================================================
   Bootstrap Panels Dark Mode
   ===================================================== */
[data-theme="dark"] .panel {
	background-color: #1a2030;
	border-color: #2a3444;
}
[data-theme="dark"] .panel-body {
	background-color: #1a2030;
	color: #b0bec5;
}
[data-theme="dark"] .panel-default > .panel-heading {
	background-color: #161b26;
	border-bottom-color: #2a3444;
	color: #b0bec5;
}
[data-theme="dark"] .panel-info {
	border-color: #1e3a5f;
}
[data-theme="dark"] .panel-info > .panel-heading {
	background-color: #142440;
	border-bottom-color: #1e3a5f;
	color: #93c5fd;
}
[data-theme="dark"] .panel-danger {
	border-color: #5f1e1e;
}
[data-theme="dark"] .panel-danger > .panel-heading {
	background-color: #401414;
	border-bottom-color: #5f1e1e;
	color: #fca5a5;
}
[data-theme="dark"] .panel-warning {
	border-color: #5f4a1e;
}
[data-theme="dark"] .panel-warning > .panel-heading {
	background-color: #402e14;
	border-bottom-color: #5f4a1e;
	color: #fbbf24;
}
[data-theme="dark"] .panel-success {
	border-color: #1e5f2a;
}
[data-theme="dark"] .panel-success > .panel-heading {
	background-color: #143020;
	border-bottom-color: #1e5f2a;
	color: #34d399;
}
[data-theme="dark"] .panel-title {
	color: inherit;
}

/* =====================================================
   Bootstrap Nav Pills Dark Mode
   ===================================================== */
[data-theme="dark"] .nav-pills > li > a {
	color: #b0bec5;
}
[data-theme="dark"] .nav-pills > li > a:hover,
[data-theme="dark"] .nav-pills > li > a:focus {
	background-color: #1e2a42;
	color: #93c5fd;
}
[data-theme="dark"] .nav-pills > li.active > a,
[data-theme="dark"] .nav-pills > li.active > a:hover {
	background-color: #93c5fd;
	color: #0f1219;
}

/* =====================================================
   Bootstrap Alerts Dark Mode
   ===================================================== */
[data-theme="dark"] .alert-info {
	background-color: #1e2a42;
	border-color: #2a3f5f;
	color: #b0bec5;
}
[data-theme="dark"] .alert-warning {
	background-color: #402e14;
	border-color: #5f4a1e;
	color: #fbbf24;
}
[data-theme="dark"] .alert-danger {
	background-color: #401414;
	border-color: #5f1e1e;
	color: #fca5a5;
}
[data-theme="dark"] .alert-success {
	background-color: #143020;
	border-color: #1e5f2a;
	color: #34d399;
}

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 767px) {
	.pw-header {
		flex-direction: column;
		gap: 12px;
		padding: 14px 16px;
	}
	.pw-nav {
		text-align: center;
	}
	.pw-brand-name {
		font-size: 17px;
	}
}
