/**
 * Fleet360 - Modern Professional Design System
 * Muted palette, compact forms, small buttons
 * Compatible with Bootstrap 5.x, PHP 8.1, CodeIgniter 3.1.13
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

@font-face {
	font-family: "JameelNooriNastaliq";
	src: url(https://cdn.jsdelivr.net/npm/jameel-noori@1.1.2/fonts/jameel-noori-nastaleeq4.woff2) format('woff2');
}

/* Bootstrap overrides - muted professional palette */
:root {
	--bs-primary: #334155;
	--bs-primary-rgb: 51, 65, 85;
	--bs-body-color: #1e293b;
	--bs-body-bg: #f1f5f9;
	--bs-border-color: #e2e8f0;
	/* Layout */
	--sidebar-width: 240px;
	--sidebar-collapsed: 64px;
	--header-height: 52px;
	--content-padding: 1.25rem;
	--radius-sm: 6px;
	--radius-md: 8px;
	--radius-lg: 10px;

	/* Muted professional palette - no radiant colors */
	--color-bg: #f1f5f9;
	--color-surface: #ffffff;
	--color-border: #e2e8f0;
	--color-border-light: #f1f5f9;

	--color-text: #1e293b;
	--color-text-secondary: #475569;
	--color-text-muted: #64748b;

	--color-primary: #334155;
	--color-primary-hover: #1e293b;
	--color-primary-light: #f1f5f9;

	--color-success: #059669;
	--color-success-bg: #ecfdf5;
	--color-warning: #d97706;
	--color-warning-bg: #fffbeb;
	--color-danger: #dc2626;
	--color-danger-bg: #fef2f2;

	/* Typography */
	--font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	--text-xs: 0.75rem;
	--text-sm: 0.8125rem;
	--text-base: 0.875rem;
	--text-lg: 1rem;

	/* Form - standardized sizing */
	--input-height: 36px;
	--input-padding-x: 12px;
	--label-mb: 6px;
	--header-blue: #dbeafe;
	--header-blue-border: #93c5fd;
}

/* Base */
* { box-sizing: border-box; }
body {
	font-family: var(--font-sans);
	font-size: var(--text-base);
	line-height: 1.5;
	color: var(--color-text);
	background: var(--color-bg);
	-webkit-font-smoothing: antialiased;
}

/* Sidebar */
.sidebar {
	position: fixed;
	top: 0;
	left: 0;
	width: var(--sidebar-width);
	height: 100vh;
	background: var(--color-surface);
	border-right: 1px solid var(--color-border);
	transition: width 0.2s ease;
	z-index: 1000;
	overflow-x: hidden;
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }

.sidebar .brand {
	font-weight: 600;
	font-size: var(--text-lg);
	color: var(--color-primary);
	padding: 0.875rem 1rem;
	display: block;
	border-bottom: 1px solid var(--color-border-light);
}

.sidebar nav { padding: 0.5rem 0; }
.sidebar .nav-link {
	color: var(--color-text-secondary);
	padding: 0.5rem 1rem;
	margin: 0 0.5rem;
	border-radius: var(--radius-sm);
	display: flex;
	align-items: center;
	gap: 0.75rem;
	font-size: var(--text-sm);
	font-weight: 600;
	transition: all 0.15s ease;
}
.sidebar .nav-link:hover {
	background: var(--color-primary-light);
	color: var(--color-primary);
}
.sidebar .nav-link.active {
	background: var(--color-primary-light);
	color: var(--color-primary);
}
.sidebar .nav-link i {
	font-size: 1.125rem;
	flex-shrink: 0;
	opacity: 0.9;
}
.sidebar .nav-text { white-space: nowrap; }
.sidebar.collapsed .nav-text { display: none; }

/* Header - lighter blue */
.main-header {
	position: fixed;
	top: 0;
	left: var(--sidebar-width);
	right: 0;
	height: var(--header-height);
	background: var(--header-blue);
	border-bottom: 1px solid var(--header-blue-border);
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 1.25rem;
	z-index: 999;
	transition: left 0.2s ease;
}
.sidebar.collapsed + .main-header { left: var(--sidebar-collapsed); }

.main-header .page-title {
	font-size: var(--text-base);
	font-weight: 600;
	color: var(--color-text);
	margin: 0;
}

.btn-toggle {
	background: none;
	border: none;
	padding: 0.5rem;
	cursor: pointer;
	color: var(--color-text-muted);
	border-radius: var(--radius-sm);
	transition: color 0.15s;
}
.btn-toggle:hover { color: var(--color-primary); }

/* Main content */
.main-content {
	margin-left: var(--sidebar-width);
	margin-top: var(--header-height);
	padding: var(--content-padding);
	min-height: calc(100vh - var(--header-height));
	transition: margin-left 0.2s ease;
}
.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-collapsed); }

/* Buttons - small, professional */
.btn {
	font-size: var(--text-sm);
	font-weight: 500;
	padding: 0.375rem 0.75rem;
	border-radius: var(--radius-sm);
	transition: all 0.15s ease;
}
.btn-sm {
	padding: 0.25rem 0.625rem;
	font-size: var(--text-xs);
}
.btn-primary {
	background: var(--color-primary);
	border-color: var(--color-primary);
	color: #fff;
}
.btn-primary:hover {
	background: var(--color-primary-hover);
	border-color: var(--color-primary-hover);
	color: #fff;
}
.btn-outline-primary {
	color: var(--color-primary);
	border-color: var(--color-border);
}
.btn-outline-primary:hover {
	background: var(--color-primary-light);
	border-color: var(--color-primary);
	color: var(--color-primary);
}
.btn-outline-secondary {
	color: var(--color-text-secondary);
	border-color: var(--color-border);
}
.btn-outline-secondary:hover {
	background: var(--color-primary-light);
	border-color: var(--color-text-muted);
	color: var(--color-primary);
}

/* Forms - standardized height/width across all inputs */
.form-label {
	font-size: var(--text-sm);
	font-weight: 500;
	color: var(--color-text);
	margin-bottom: var(--label-mb);
	display: block;
}
/* All inputs/selects - UNIFORM 36px height, full width */
input.form-control,
input.form-control-sm,
select.form-control,
select.form-select,
select.form-select-sm,
.form-control,
.form-select {
	height: var(--input-height) !important;
	min-height: var(--input-height);
	padding: 0 var(--input-padding-x) !important;
	font-size: var(--text-sm) !important;
	border-radius: var(--radius-sm);
	border: 1px solid var(--color-border);
	width: 100% !important;
	max-width: 100%;
	box-sizing: border-box;
	transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus, .form-select:focus {
	border-color: var(--color-primary);
	box-shadow: 0 0 0 2px rgba(51, 65, 85, 0.15);
	outline: none;
}
/* Textareas - consistent min-height */
textarea.form-control,
textarea.form-control-sm {
	height: auto !important;
	min-height: 80px;
	padding: 0.5rem var(--input-padding-x) !important;
	line-height: 1.5;
	resize: vertical;
	width: 100% !important;
}
/* File inputs */
input[type="file"].form-control,
input[type="file"].form-control-sm {
	height: auto !important;
	min-height: var(--input-height);
	padding: 0.375rem var(--input-padding-x) !important;
}
.form-check-input { width: 1rem; height: 1rem; }
/* Form grid - equal column widths */
.row.g-2 [class*="col-"] .form-control,
.row.g-2 [class*="col-"] .form-select,
.row.g-2 [class*="col-"] .form-control-sm,
.row.g-2 [class*="col-"] .form-select-sm {
	width: 100% !important;
}

/* Form groups compact */
.form-group-compact .row { --bs-gutter-y: 0.5rem; }
.form-group-compact .mb-2 { margin-bottom: 0.5rem !important; }
.form-group-compact .mb-3 { margin-bottom: 0.75rem !important; }

/* Cards */
.card {
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	background: var(--color-surface);
	box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.card-header {
	font-size: var(--text-sm);
	font-weight: 600;
	color: var(--color-text);
	padding: 0.625rem 1rem;
	background: var(--color-surface);
	border-bottom: 1px solid var(--color-border);
	border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.card-body { padding: 1rem; }

/* KPI cards - dashboard (legacy) */
.kpi-card {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: 1rem;
	height: 100%;
	transition: box-shadow 0.15s ease;
}
.kpi-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.kpi-card .value {
	font-size: 1.25rem;
	font-weight: 600;
	color: var(--color-primary);
	letter-spacing: -0.02em;
}
.kpi-card .label {
	font-size: var(--text-xs);
	color: var(--color-text-muted);
	margin-top: 0.25rem;
}

/* Dashboard 3D widgets - uniform size, icons */
.widget-3d {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: 1rem;
	height: 100%;
	min-height: 110px;
	display: flex;
	flex-direction: column;
	position: relative;
	/* 3D elevation */
	box-shadow:
		0 1px 2px rgba(0, 0, 0, 0.04),
		0 4px 8px rgba(0, 0, 0, 0.06),
		0 8px 16px rgba(0, 0, 0, 0.04);
	transform: translateY(0);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.widget-3d:hover {
	transform: translateY(-3px);
	box-shadow:
		0 4px 8px rgba(0, 0, 0, 0.06),
		0 12px 24px rgba(0, 0, 0, 0.08),
		0 20px 40px rgba(0, 0, 0, 0.06);
}
.widget-3d .widget-icon {
	position: absolute;
	top: 0.75rem;
	right: 0.75rem;
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--header-blue);
	color: #1e40af;
	border-radius: var(--radius-sm);
	font-size: 1.125rem;
}
.widget-3d .value {
	font-size: 1.5rem;
	font-weight: 600;
	color: var(--color-primary);
	letter-spacing: -0.02em;
	margin-top: 0.25rem;
}
.widget-3d .label {
	font-size: 0.9375rem;
	color: var(--color-text-secondary);
	margin-top: 0.35rem;
	line-height: 1.4;
}

/* Chart cards - 3D */
.chart-card {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	overflow: hidden;
	box-shadow:
		0 1px 2px rgba(0, 0, 0, 0.04),
		0 4px 8px rgba(0, 0, 0, 0.06),
		0 8px 16px rgba(0, 0, 0, 0.04);
	transition: box-shadow 0.2s ease;
}
.chart-card:hover {
	box-shadow:
		0 4px 8px rgba(0, 0, 0, 0.06),
		0 12px 24px rgba(0, 0, 0, 0.08);
}
.chart-card-header {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: var(--text-sm);
	font-weight: 600;
	color: var(--color-text);
	padding: 0.75rem 1rem;
	background: var(--color-bg);
	border-bottom: 1px solid var(--color-border);
}
.chart-card-header i {
	color: var(--color-primary);
	font-size: 1.125rem;
}
.chart-card-body {
	padding: 1rem;
	min-height: 240px;
}

/* Tables */
.table {
	font-size: var(--text-sm);
	color: var(--color-text);
}
.table thead th {
	font-size: var(--text-xs);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--color-text-muted);
	padding: 0.625rem 1rem;
	border-bottom: 1px solid var(--color-border);
	background: var(--color-bg);
}
.table tbody td {
	padding: 0.5rem 1rem;
	border-bottom: 1px solid var(--color-border-light);
	vertical-align: middle;
}
.table tbody tr:hover { background: rgba(241, 245, 249, 0.6); }
.table-sm thead th, .table-sm tbody td { padding: 0.5rem 0.75rem; }
.table a { color: var(--color-primary); text-decoration: none; font-weight: 500; }
.table a:hover { text-decoration: underline; }

/* Nav tabs */
.nav-tabs {
	border-bottom: 1px solid var(--color-border);
	gap: 0;
}
.nav-tabs .nav-link {
	font-size: var(--text-sm);
	font-weight: 500;
	color: var(--color-text-muted);
	padding: 0.5rem 1rem;
	border: none;
	border-bottom: 2px solid transparent;
	border-radius: 0;
	background: none;
	transition: all 0.15s;
}
.nav-tabs .nav-link:hover {
	color: var(--color-text);
}
.nav-tabs .nav-link.active {
	color: var(--color-primary);
	border-bottom-color: var(--color-primary);
	background: none;
}

/* Alerts - compact */
.alert {
	font-size: var(--text-sm);
	padding: 0.5rem 1rem;
	border-radius: var(--radius-sm);
	border: 1px solid transparent;
}
.alert-success {
	background: var(--color-success-bg);
	border-color: rgba(5, 150, 105, 0.2);
	color: #047857;
}
.alert-danger {
	background: var(--color-danger-bg);
	border-color: rgba(220, 38, 38, 0.2);
	color: #b91c1c;
}
.alert-warning {
	background: var(--color-warning-bg);
	border-color: rgba(217, 119, 6, 0.2);
	color: #b45309;
}

/* Badges - muted */
.badge {
	font-size: 0.6875rem;
	font-weight: 500;
	padding: 0.2rem 0.5rem;
	border-radius: 4px;
}
.bg-primary { background: var(--color-primary) !important; }
.bg-success { background: var(--color-success) !important; }
.bg-secondary { background: var(--color-text-muted) !important; }
.bg-warning { background: var(--color-warning) !important; }
.bg-danger { background: var(--color-danger) !important; }

/* List group - reports etc */
.list-group-item {
	font-size: var(--text-sm);
	padding: 0.5rem 1rem;
	border-color: var(--color-border-light);
}
.list-group-item-action:hover { background: var(--color-primary-light); }
.list-group-item-action { color: var(--color-primary); }

/* Pagination */
.pagination .page-link {
	font-size: var(--text-sm);
	padding: 0.375rem 0.625rem;
	border-radius: var(--radius-sm);
}

/* Login page - background image + 3D form */
.login-wrapper {
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.5rem;
	position: relative;
	overflow: hidden;
	background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 50%, #1e293b 100%);
	background-image: 
		linear-gradient(135deg, rgba(30, 58, 95, 0.92) 0%, rgba(15, 23, 42, 0.94) 50%, rgba(30, 41, 59, 0.92) 100%),
		url('https://images.unsplash.com/photo-1601584115197-04ecc0da31d7?auto=format&fit=crop&w=1920&q=80');
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
}
.login-wrapper::before {
	content: '';
	position: absolute;
	inset: 0;
	background: radial-gradient(ellipse at 50% 0%, rgba(59, 130, 246, 0.15) 0%, transparent 50%);
	pointer-events: none;
}
.login-card {
	position: relative;
	z-index: 1;
	max-width: 400px;
	width: 100%;
	background: rgba(255, 255, 255, 0.98);
	backdrop-filter: blur(12px);
	border: 1px solid rgba(255, 255, 255, 0.3);
	border-radius: 16px;
	padding: 2rem;
	/* 3D elevation effect */
	box-shadow:
		0 0 0 1px rgba(255, 255, 255, 0.1) inset,
		0 4px 6px -1px rgba(0, 0, 0, 0.1),
		0 10px 20px -5px rgba(0, 0, 0, 0.15),
		0 25px 50px -12px rgba(0, 0, 0, 0.2),
		0 50px 80px -20px rgba(0, 0, 0, 0.25);
	transform: translateY(0) perspective(1000px) rotateX(0deg);
	transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.login-card:hover {
	transform: translateY(-4px) perspective(1000px) rotateX(1deg);
	box-shadow:
		0 0 0 1px rgba(255, 255, 255, 0.15) inset,
		0 8px 12px -2px rgba(0, 0, 0, 0.12),
		0 20px 30px -8px rgba(0, 0, 0, 0.18),
		0 35px 60px -15px rgba(0, 0, 0, 0.22),
		0 60px 100px -25px rgba(0, 0, 0, 0.28);
}
.login-brand {
	font-weight: 600;
	font-size: 1.5rem;
	color: #1e3a5f;
}
.login-subtitle {
	font-size: var(--text-sm);
	color: var(--color-text-muted);
	margin-top: 0.25rem;
}
.login-card .form-control,
.login-card .form-select {
	height: 42px;
	border-radius: 10px;
	font-size: 0.9375rem;
}
.login-card .btn-primary {
	height: 42px;
	border-radius: 10px;
	font-weight: 600;
	background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
	border: none;
	box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}
.login-card .btn-primary:hover {
	background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
	box-shadow: 0 6px 20px rgba(59, 130, 246, 0.45);
}

/* Urdu font - preserve */
.urdu-input, input[name*="urdu"], textarea[name*="urdu"], input.urdu, textarea.urdu {
	font-family: "JameelNooriNastaliq", "Noto Nastaliq Urdu", serif !important;
	font-size: 1.1em;
	direction: rtl;
}

/* Page sections */
.section-title {
	font-size: var(--text-sm);
	font-weight: 600;
	color: var(--color-text-muted);
	text-transform: uppercase;
	letter-spacing: 0.04em;
	margin: 0;
}

/* List/table page toolbar */
.page-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	margin-bottom: 1rem;
}
.page-toolbar h5, .page-toolbar h6 {
	font-size: var(--text-base);
	font-weight: 600;
	color: var(--color-text);
	margin: 0;
}

/* Utility */
.text-muted { color: var(--color-text-muted) !important; }
.small { font-size: var(--text-xs) !important; }
