/* ============================================
   CRM Application - Custom Styles
   ============================================ */

/* ===== CSS VARIABLES ===== */
:root {
	--sidebar-width: 260px;
	--sidebar-bg: #0f172a;
	--sidebar-hover: rgba(255,255,255,0.06);
	--sidebar-active-border: #3b82f6;
	--sidebar-text: rgba(255,255,255,0.55);
	--sidebar-text-hover: #ffffff;
	--accent: #3b82f6;
	--accent-hover: #2563eb;
	--accent-light: #eff6ff;
	--bg: #f1f5f9;
	--card-bg: #ffffff;
	--card-border: #e2e8f0;
	--text-primary: #0f172a;
	--text-secondary: #475569;
	--text-muted: #94a3b8;
	--success: #10b981;
	--danger: #ef4444;
	--warning: #f59e0b;
	--info: #06b6d4;
}

/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
	box-sizing: border-box;
}

body {
	font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
	background-color: var(--bg);
	color: var(--text-primary);
	margin: 0;
	padding: 0;
	font-size: 0.875rem;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

a {
	color: var(--accent);
	text-decoration: none;
	transition: color 0.15s ease;
}

a:hover {
	color: var(--accent-hover);
}

/* ===== SIDEBAR ===== */
.sidebar {
	position: fixed;
	top: 0;
	left: 0;
	width: var(--sidebar-width);
	height: 100vh;
	background: var(--sidebar-bg);
	color: #fff;
	z-index: 1050;
	display: flex;
	flex-direction: column;
	overflow-y: auto;
	box-shadow: 2px 0 8px rgba(0,0,0,0.15);
}

.sidebar-brand {
	padding: 24px 24px 20px;
	border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-brand h4 {
	margin: 0;
	font-weight: 800;
	font-size: 1.25rem;
	color: #fff;
	letter-spacing: 0.5px;
	display: flex;
	align-items: center;
	gap: 10px;
}

.sidebar-brand h4 i {
	color: var(--accent);
	font-size: 1.4rem;
}

.sidebar-nav {
	list-style: none;
	padding: 12px 0;
	margin: 0;
	flex: 1;
}

.sidebar-nav li a {
	display: flex;
	align-items: center;
	padding: 11px 24px;
	color: var(--sidebar-text);
	font-size: 0.875rem;
	font-weight: 500;
	transition: all 0.2s ease;
	border-left: 3px solid transparent;
	gap: 12px;
}

.sidebar-nav li a:hover,
.sidebar-nav li a.active {
	color: var(--sidebar-text-hover);
	background: var(--sidebar-hover);
	border-left-color: var(--accent);
}

.sidebar-nav li a i {
	width: 20px;
	font-size: 1.05rem;
	text-align: center;
	flex-shrink: 0;
}

.sidebar-user {
	padding: 16px 24px;
	border-top: 1px solid rgba(255,255,255,0.06);
	background: rgba(0,0,0,0.15);
}

.sidebar-user .d-flex {
	gap: 12px;
}

.sidebar-user .user-avatar {
	width: 36px;
	height: 36px;
	background: rgba(59,130,246,0.3);
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.sidebar-user .user-avatar i {
	font-size: 1rem;
}

.sidebar-user .user-info {
	min-width: 0;
}

.sidebar-user .user-name {
	color: #fff;
	font-size: 0.8rem;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.sidebar-user .user-logout {
	color: rgba(255,255,255,0.35);
	font-size: 0.75rem;
	transition: color 0.15s;
}

.sidebar-user .user-logout:hover {
	color: #f87171;
}

/* ===== MAIN CONTENT ===== */
.main-content {
	margin-left: var(--sidebar-width);
	padding: 28px 32px;
	min-height: 100vh;
}

/* ===== PAGE HEADER ===== */
.page-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 24px;
	padding-bottom: 16px;
	border-bottom: 1px solid var(--card-border);
}

.page-header h2 {
	font-size: 1.35rem;
	font-weight: 700;
	color: var(--text-primary);
	margin: 0;
	display: flex;
	align-items: center;
	gap: 10px;
}

.page-header h2 i {
	color: var(--accent);
	font-size: 1.2rem;
}

/* ===== CARDS ===== */
.card {
	border: 1px solid var(--card-border);
	border-radius: 10px;
	box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
	background: var(--card-bg);
	overflow: hidden;
}

.card-header {
	background: #f8fafc;
	border-bottom: 1px solid var(--card-border);
	padding: 14px 20px;
}

.card-header h5 {
	margin: 0;
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--text-primary);
	display: flex;
	align-items: center;
	gap: 8px;
}

.card-body {
	padding: 20px;
}

/* ===== STAT CARDS (Dashboard) ===== */
.stat-card {
	border: none;
	border-radius: 12px;
	color: #fff;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	overflow: hidden;
	position: relative;
}

.stat-card::before {
	content: '';
	position: absolute;
	top: 0;
	right: 0;
	width: 80px;
	height: 80px;
	background: rgba(255,255,255,0.1);
	border-radius: 50%;
	transform: translate(20px, -20px);
}

.stat-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.stat-card .card-body {
	padding: 22px 24px;
	position: relative;
	z-index: 1;
}

.stat-card .stat-icon {
	font-size: 1.8rem;
	opacity: 0.8;
	margin-bottom: 8px;
}

.stat-card .stat-label {
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.8px;
	opacity: 0.85;
	font-weight: 600;
	margin-bottom: 4px;
}

.stat-card .stat-value {
	font-size: 2rem;
	font-weight: 800;
	line-height: 1;
}

/* ===== QUICK MENU CARDS (Dashboard) ===== */
.quick-menu-card {
	border: 1px solid var(--card-border);
	border-radius: 10px;
	background: var(--card-bg);
	padding: 20px;
	display: flex;
	align-items: center;
	gap: 16px;
	transition: all 0.2s ease;
	text-decoration: none;
	color: var(--text-primary);
}

.quick-menu-card:hover {
	border-color: var(--accent);
	box-shadow: 0 4px 12px rgba(59,130,246,0.12);
	transform: translateY(-2px);
	color: var(--text-primary);
}

.quick-menu-card .menu-icon {
	width: 48px;
	height: 48px;
	border-radius: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.3rem;
	flex-shrink: 0;
}

.quick-menu-card .menu-text h6 {
	margin: 0 0 2px;
	font-weight: 600;
	font-size: 0.9rem;
}

.quick-menu-card .menu-text p {
	margin: 0;
	font-size: 0.78rem;
	color: var(--text-muted);
}

/* ===== TABLES ===== */
.table {
	margin-bottom: 0;
}

.table thead th {
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.6px;
	color: var(--text-muted);
	border-bottom: 2px solid var(--card-border);
	padding: 12px 14px;
	white-space: nowrap;
	background: #fafbfc;
}

.table tbody td {
	padding: 12px 14px;
	vertical-align: middle;
	color: var(--text-secondary);
	font-size: 0.85rem;
	border-bottom: 1px solid #f1f5f9;
}

.table-hover tbody tr:hover {
	background-color: #f8fafc;
}

.table tbody tr:last-child td {
	border-bottom: none;
}

.table a {
	color: var(--accent);
	font-weight: 600;
}

.table a:hover {
	color: var(--accent-hover);
	text-decoration: underline;
}

/* ===== DETAIL TABLE ===== */
.detail-table {
	width: 100%;
}

.detail-table th {
	font-size: 0.8rem;
	font-weight: 500;
	color: var(--text-muted);
	padding: 8px 16px 8px 0;
	text-transform: none;
	letter-spacing: normal;
	white-space: nowrap;
	width: 140px;
	border: none;
	vertical-align: top;
}

.detail-table td {
	font-size: 0.875rem;
	color: var(--text-primary);
	padding: 8px 0;
	border: none;
}

/* ===== BADGES ===== */
.badge {
	font-weight: 600;
	font-size: 0.7rem;
	padding: 5px 10px;
	border-radius: 6px;
	letter-spacing: 0.3px;
}

/* ===== BUTTONS ===== */
.btn {
	font-size: 0.85rem;
	font-weight: 500;
	border-radius: 8px;
	padding: 8px 16px;
	transition: all 0.15s ease;
}

.btn-sm {
	padding: 5px 10px;
	font-size: 0.8rem;
	border-radius: 6px;
}

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

.btn-primary:hover {
	background-color: var(--accent-hover);
	border-color: var(--accent-hover);
	box-shadow: 0 2px 8px rgba(59,130,246,0.3);
}

.btn-outline-primary:hover {
	box-shadow: 0 2px 8px rgba(59,130,246,0.2);
}

.btn-outline-danger:hover {
	box-shadow: 0 2px 8px rgba(239,68,68,0.2);
}

.btn-action {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

/* ===== ACTION BUTTONS in tables ===== */
.actions {
	white-space: nowrap;
	text-align: right;
}

.actions .btn {
	padding: 4px 8px;
}

/* ===== FORMS ===== */
form table {
	width: 100%;
}

form table th {
	font-weight: 500;
	font-size: 0.85rem;
	color: var(--text-secondary);
	padding: 10px 14px 10px 0;
	vertical-align: top;
	text-align: right;
	width: 170px;
	text-transform: none;
	letter-spacing: normal;
	border: none;
}

form table td {
	padding: 8px 0;
	border: none;
}

form .mb-3 {
	margin-bottom: 1rem !important;
}

form input[type="text"],
form input[type="email"],
form input[type="password"],
form input[type="number"],
form input[type="date"],
form input[type="datetime-local"],
form textarea,
form select {
	display: block;
	width: 100%;
	padding: 8px 14px;
	font-size: 0.875rem;
	line-height: 1.5;
	color: var(--text-primary);
	background-color: #fff;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	appearance: none;
	-webkit-appearance: none;
}

form input[type="text"]:focus,
form input[type="email"]:focus,
form input[type="password"]:focus,
form input[type="number"]:focus,
form input[type="date"]:focus,
form input[type="datetime-local"]:focus,
form textarea:focus,
form select:focus {
	border-color: var(--accent);
	outline: 0;
	box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

form textarea {
	min-height: 100px;
	resize: vertical;
}

form select {
	background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23475569' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
	background-repeat: no-repeat;
	background-position: right 12px center;
	background-size: 14px 10px;
	padding-right: 36px;
}

form input[type="submit"],
form button[type="submit"] {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 28px;
	font-size: 0.875rem;
	font-weight: 600;
	color: #fff;
	background-color: var(--accent);
	border: 1px solid var(--accent);
	border-radius: 8px;
	cursor: pointer;
	transition: all 0.15s ease;
}

form input[type="submit"]:hover,
form button[type="submit"]:hover {
	background-color: var(--accent-hover);
	border-color: var(--accent-hover);
	box-shadow: 0 2px 8px rgba(59,130,246,0.3);
}

form .error,
form .invalid-feedback {
	color: var(--danger);
	font-size: 0.8rem;
	margin-top: 4px;
}

form label,
form .col-form-label {
	font-weight: 500;
	color: var(--text-secondary);
	font-size: 0.85rem;
}

/* ===== FLASH MESSAGES ===== */
.flash {
	padding: 14px 18px;
	border-radius: 8px;
	margin-bottom: 18px;
	font-size: 0.875rem;
	font-weight: 500;
	display: flex;
	align-items: center;
	gap: 10px;
}

.flash-success {
	background: #ecfdf5;
	color: #065f46;
	border: 1px solid #a7f3d0;
}

.flash-error,
.flash-danger {
	background: #fef2f2;
	color: #991b1b;
	border: 1px solid #fecaca;
}

.flash-info {
	background: #eff6ff;
	color: #1e40af;
	border: 1px solid #bfdbfe;
}

.flash-warning {
	background: #fffbeb;
	color: #92400e;
	border: 1px solid #fde68a;
}

/* ===== LIST GROUPS ===== */
.list-group-item {
	border-color: #f1f5f9;
	padding: 14px 20px;
	transition: background-color 0.1s ease;
}

.list-group-item:hover {
	background-color: #f8fafc;
}

.list-group-item-action {
	color: var(--text-primary);
}

.list-group-item-action:hover {
	color: var(--accent);
}

/* ===== EMPTY STATE ===== */
.empty-state {
	text-align: center;
	padding: 48px 20px;
	color: var(--text-muted);
}

.empty-state i {
	font-size: 3.5rem;
	margin-bottom: 12px;
	display: block;
	opacity: 0.4;
}

.empty-state p {
	margin: 0;
	font-size: 0.9rem;
}

/* ===== LOGIN PAGE ===== */
.login-wrapper {
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
	position: relative;
	overflow: hidden;
}

.login-wrapper::before {
	content: '';
	position: absolute;
	width: 500px;
	height: 500px;
	border-radius: 50%;
	background: radial-gradient(circle, rgba(59,130,246,0.15) 0%, transparent 70%);
	top: -100px;
	right: -100px;
}

.login-wrapper::after {
	content: '';
	position: absolute;
	width: 400px;
	height: 400px;
	border-radius: 50%;
	background: radial-gradient(circle, rgba(99,102,241,0.1) 0%, transparent 70%);
	bottom: -100px;
	left: -100px;
}

.login-box {
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 25px 60px rgba(0,0,0,0.3);
	width: 100%;
	max-width: 420px;
	padding: 44px 40px;
	position: relative;
	z-index: 1;
}

.login-box h3 {
	font-weight: 800;
	color: var(--text-primary);
	margin-bottom: 4px;
	font-size: 1.5rem;
}

.login-box p {
	color: var(--text-muted);
	font-size: 0.9rem;
	margin-bottom: 0;
}

.login-box .login-icon {
	width: 64px;
	height: 64px;
	background: var(--accent-light);
	border-radius: 16px;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0 auto 20px;
}

.login-box .login-icon i {
	font-size: 1.6rem;
	color: var(--accent);
}

.login-box form input[type="text"],
.login-box form input[type="email"],
.login-box form input[type="password"] {
	padding: 12px 16px;
	font-size: 0.9rem;
	border-radius: 10px;
}

.login-box form input[type="submit"],
.login-box form button[type="submit"] {
	width: 100%;
	justify-content: center;
	padding: 12px;
	font-size: 0.95rem;
	border-radius: 10px;
	margin-top: 8px;
}

/* ===== PROGRESS BAR ===== */
.prob-bar {
	display: flex;
	align-items: center;
	gap: 8px;
}

.prob-bar .progress {
	height: 6px;
	width: 60px;
	border-radius: 3px;
	background: #e2e8f0;
	flex-shrink: 0;
}

.prob-bar .progress-bar {
	border-radius: 3px;
}

/* ===== SECTION TITLE ===== */
.section-title {
	font-size: 0.95rem;
	font-weight: 700;
	color: var(--text-primary);
	margin-bottom: 16px;
	display: flex;
	align-items: center;
	gap: 8px;
}

.section-title i {
	color: var(--accent);
}

/* ===== TABLE RESPONSIVE ===== */
.table-responsive {
	overflow-x: auto;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 992px) {
	.sidebar {
		width: 220px;
	}
	.main-content {
		margin-left: 220px;
		padding: 20px;
	}
}

@media (max-width: 768px) {
	.sidebar {
		position: relative;
		width: 100%;
		height: auto;
	}
	.main-content {
		margin-left: 0;
		padding: 16px;
	}
	.page-header {
		flex-direction: column;
		gap: 12px;
		align-items: flex-start;
	}
}
