/* SOCIETY 5.0 관리자 콘솔 프리미엄 다크테마 디자인 시스템 */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
	--sidebar-width: 280px;
	--color-primary: #6366f1;
	/* Indigo-500 */
	--color-primary-dark: #4f46e5;
	/* Indigo-600 */
	--color-success: #10b981;
	--color-info: #06b6d4;
	--color-warning: #f59e0b;
	--color-danger: #ef4444;
	--color-gray-800: #f8fafc;
	/* Light gray text for high visibility */
	--color-gray-600: #94a3b8;
	/* Slate-400 */
	--color-bg: #090d16;
	/* Deep dark obsidian body background */
	--font-body: 'Plus Jakarta Sans', -apple-system, 'Noto Sans KR', sans-serif;
	--radius-lg: 16px;
	--radius-md: 12px;
	--radius-sm: 8px;
}

* {
	font-family: var(--font-body);
	box-sizing: border-box;
}

body {
	background: var(--color-bg);
	color: #cbd5e1;
	/* Slate-300 */
}

/* Override native Bootstrap headings and general elements to light gray */
h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
	color: #f8fafc !important;
}

/* ---------- 사이드바 (Premium Slate-950 Dark Theme) ---------- */
.sb-sidebar {
	position: fixed;
	top: 0;
	left: 0;
	bottom: 0;
	width: var(--sidebar-width);
	background: linear-gradient(180deg, #111827 0%, #090d16 100%);
	color: #f8fafc;
	z-index: 30;
	overflow-y: auto;
	transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sb-sidebar .sb-brand {
	display: flex;
	align-items: center;
	padding: 1.8rem 1.5rem;
	color: #f8fafc;
	font-weight: 800;
	font-size: 1.1rem;
	letter-spacing: 0.03em;
	border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sb-sidebar .sb-brand i {
	display: none !important;
}

.sb-sidebar .sb-brand::before {
	content: "⚡";
	font-size: 1.25rem;
	margin-right: 0.5rem;
}

.sb-sidebar hr {
	border-color: rgba(255, 255, 255, 0.06);
	margin: 0;
}

.sb-nav {
	list-style: none;
	padding: 1.25rem 0.75rem;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.sb-nav .sb-nav-item .sb-nav-link {
	display: flex;
	align-items: center;
	color: #94a3b8;
	padding: 0.75rem 1rem;
	font-weight: 600;
	font-size: 0.88rem;
	border-radius: var(--radius-sm);
	transition: all 0.2s ease;
	text-decoration: none;
}

/* Hide standard Bootstrap icons and inject emojis */
.sb-nav .sb-nav-item .sb-nav-link i {
	display: none !important;
}

.sb-nav .sb-nav-item .sb-nav-link::before {
	font-size: 1.1rem;
	margin-right: 0.75rem;
	display: inline-block;
	text-align: center;
	width: 1.25rem;
}

.sb-nav .sb-nav-item .sb-nav-link[href="index.php"]::before {
	content: "📊";
}

.sb-nav .sb-nav-item .sb-nav-link[href="orders.php"]::before {
	content: "📦";
}

.sb-nav .sb-nav-item .sb-nav-link[href="purchases.php"]::before {
	content: "🛍️";
}

.sb-nav .sb-nav-item .sb-nav-link[href="users.php"]::before {
	content: "👥";
}

.sb-nav .sb-nav-item .sb-nav-link[href="reviews.php"]::before {
	content: "🛡️";
}

.sb-nav .sb-nav-item .sb-nav-link[href="settings.php"]::before {
	content: "⚙️";
}

.sb-nav .sb-nav-item .sb-nav-link:hover {
	color: #f8fafc;
	background: rgba(255, 255, 255, 0.04);
}

.sb-nav .sb-nav-item .sb-nav-link.active {
	color: #f8fafc;
	background: rgba(99, 102, 241, 0.18);
	border-left: 3px solid var(--color-primary);
	border-radius: 4px;
}

/* ---------- 콘텐츠 래퍼 ---------- */
.sb-content-wrap {
	margin-left: var(--sidebar-width);
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

@media (max-width: 768px) {
	.sb-sidebar {
		transform: translateX(-100%);
	}

	.sb-sidebar.show {
		transform: translateX(0);
	}

	.sb-content-wrap {
		margin-left: 0;
	}
}

/* ---------- 상단바 ---------- */
.sb-topbar {
	background: #111827;
	/* Dark topbar background */
	border-bottom: 1px solid rgba(255, 255, 255, 0.06);
	padding: 1rem 1.75rem;
	display: flex;
	align-items: center;
	justify-content: space-between;
	position: sticky;
	top: 0;
	z-index: 20;
}

.sb-topbar .sb-page-title {
	font-weight: 800;
	color: #f8fafc;
	font-size: 1.25rem;
	margin: 0;
}

.sb-topbar .sb-user {
	display: flex;
	align-items: center;
	gap: 1rem;
}

.sb-topbar .sb-user .name {
	font-weight: 700;
	font-size: 0.88rem;
	color: #f8fafc;
	text-align: right;
}

.sb-topbar .sb-user .name small {
	display: block;
	font-weight: 500;
	color: #94a3b8;
	font-size: 0.72rem;
	margin-top: 0.1rem;
}

.sb-topbar #btn-logout {
	border-radius: var(--radius-sm);
	font-size: 0.8rem;
	padding: 0.35rem 0.75rem;
	font-weight: 600;
}

.sb-toggle-btn {
	display: none;
	border: 1px solid rgba(255, 255, 255, 0.1);
	background: #1e293b;
	border-radius: var(--radius-sm);
	padding: 0.4rem 0.6rem;
	font-size: 1.1rem;
	color: #cbd5e1;
}

@media (max-width: 768px) {
	.sb-toggle-btn {
		display: inline-block;
	}
}

.sb-main {
	padding: 2rem;
	flex: 1;
}

/* ---------- 스탯 카드 (Glassmorphism & Emojis) ---------- */
.sb-stat-card {
	background: #1e293b;
	/* Obsidian Card background */
	border-radius: var(--radius-lg);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-left: 5px solid var(--color-primary);
	box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.15);
	padding: 1.5rem;
	display: flex;
	align-items: center;
	justify-content: space-between;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sb-stat-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

.sb-stat-card.success {
	border-left-color: var(--color-success);
}

.sb-stat-card.info {
	border-left-color: var(--color-info);
}

.sb-stat-card.warning {
	border-left-color: var(--color-warning);
}

.sb-stat-card.danger {
	border-left-color: var(--color-danger);
}

.sb-stat-card .label {
	font-size: 0.78rem;
	font-weight: 700;
	text-transform: uppercase;
	color: #818cf8;
	/* Light Indigo */
	letter-spacing: 0.05em;
	margin-bottom: 0.4rem;
}

.sb-stat-card.success .label {
	color: var(--color-success);
}

.sb-stat-card.info .label {
	color: var(--color-info);
}

.sb-stat-card.warning .label {
	color: var(--color-warning);
}

.sb-stat-card .value {
	font-size: 1.6rem;
	font-weight: 800;
	color: #f8fafc;
}

.sb-stat-card .icon {
	font-size: 2rem;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Inject emojis instead of bootstrap icons in stat cards */
.sb-stat-card .icon i {
	display: none !important;
}

.sb-stat-card:not(.success):not(.info):not(.warning) .icon::before {
	content: "👥";
}

.sb-stat-card.success .icon::before {
	content: "📦";
}

.sb-stat-card.info .icon::before {
	content: "🛒";
}

.sb-stat-card.warning .icon::before {
	content: "🛡️";
}

/* ---------- 카드 디자인 ---------- */
.sb-card {
	background: #1e293b;
	border-radius: var(--radius-lg);
	border: 1px solid rgba(255, 255, 255, 0.08);
	box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.15);
	overflow: hidden;
	margin-bottom: 1.5rem;
}

.sb-card .sb-card-header {
	padding: 1.25rem 1.5rem;
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
	font-weight: 800;
	color: #818cf8;
	/* Soft Indigo */
	font-size: 1rem;
	background: #1e293b;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.sb-card .sb-card-header::before {
	font-size: 1.1rem;
}

/* ---------- 탭 네비게이션 (승인 관리 등) ---------- */
.nav-tabs {
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-tabs .nav-link {
	color: #94a3b8;
	font-weight: 700;
	font-size: 0.9rem;
	background: transparent;
	border: 1px solid transparent;
	border-top-left-radius: var(--radius-sm);
	border-top-right-radius: var(--radius-sm);
	padding: 0.65rem 1.25rem;
	transition: color 0.2s ease, background 0.2s ease;
}

.nav-tabs .nav-link:hover,
.nav-tabs .nav-link:focus {
	color: #f8fafc;
	border-color: transparent;
	background: rgba(255, 255, 255, 0.04);
	isolation: isolate;
}

.nav-tabs .nav-link.active,
.nav-tabs .nav-item.show .nav-link {
	color: #f8fafc;
	background: #1e293b;
	border-color: rgba(255, 255, 255, 0.08) rgba(255, 255, 255, 0.08) #1e293b;
}

/* Dynamic card header emojis based on active page or element */
body:has(.sb-nav-link[href="orders.php"].active) .sb-card-header::before {
	content: "📦";
}

body:has(.sb-nav-link[href="settings.php"].active) .sb-card-header::before {
	content: "⚙️";
}

/* Reviews Page Card Emojis (탭별로 분리되어 있어 nth-of-type 대신 탭 ID로 구분) */
#tab-ledgers .sb-card-header::before {
	content: "💸";
}

#tab-education .sb-card-header::before {
	content: "🎓";
}

#tab-coop .sb-card-header::before {
	content: "🌱";
}

/* Users Page Card Emojis */
body:has(.sb-nav-link[href="users.php"].active):not(:has(#user-detail-root)) .sb-card-header::before {
	content: "👥";
}

/* User Details Card Emojis */
#user-detail-root .sb-card:nth-of-type(1) .sb-card-header::before {
	content: "👤";
}

#user-detail-root .sb-card:nth-of-type(2) .sb-card-header::before {
	content: "🏆";
}

#user-detail-root .col-lg-6:first-child .sb-card:nth-of-type(1) .sb-card-header::before {
	content: "💸";
}

#user-detail-root .col-lg-6:first-child .sb-card:nth-of-type(2) .sb-card-header::before {
	content: "🎓";
}

#user-detail-root .col-lg-6:last-child .sb-card:nth-of-type(1) .sb-card-header::before {
	content: "📦";
}

#user-detail-root .col-lg-6:last-child .sb-card:nth-of-type(2) .sb-card-header::before {
	content: "🌱";
}

.sb-card .sb-card-body {
	padding: 1.5rem;
}

.sb-card-body h5 i {
	display: none !important;
}

/* Card titles custom emojis inside dashboard quick links */
.sb-card-body a h5::before {
	font-size: 1.25rem;
	margin-right: 0.5rem;
}

.row.g-3 .col-md-6:first-child .sb-card-body h5::before {
	content: "📦";
}

.row.g-3 .col-md-6:last-child .sb-card-body h5::before {
	content: "👥";
}

/* ---------- 테이블 디자인 (Zebra & Dark Grid) ---------- */
.table {
	--bs-table-color: #cbd5e1;
	--bs-table-bg: transparent;
	--bs-table-border-color: rgba(255, 255, 255, 0.08);
}

.sb-table {
	width: 100%;
	margin-bottom: 0;
}

.sb-table thead th {
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #94a3b8;
	background-color: #111827;
	/* Dark table header */
	padding: 0.75rem 1rem;
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
	font-weight: 700;
}

.sb-table td {
	padding: 1rem;
	vertical-align: middle;
	font-size: 0.88rem;
	border-bottom: 1px solid rgba(255, 255, 255, 0.06);
	color: #cbd5e1;
}

.sb-table tbody tr:hover {
	background-color: rgba(255, 255, 255, 0.02) !important;
}

/* ---------- 뱃지 스타일 ---------- */
.sb-badge {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	padding: 0.35rem 0.75rem;
	border-radius: 50px;
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
}

.sb-badge-committed {
	background: rgba(148, 163, 184, 0.15);
	color: #cbd5e1;
}

.sb-badge-committed::before {
	content: "⏳";
	font-size: 0.75rem;
}

.sb-badge-fulfilled {
	background: rgba(16, 185, 129, 0.15);
	color: #34d399;
}

.sb-badge-fulfilled::before {
	content: "✅";
	font-size: 0.75rem;
}

.sb-badge-broken {
	background: rgba(239, 68, 68, 0.15);
	color: #f87171;
}

.sb-badge-broken::before {
	content: "❌";
	font-size: 0.75rem;
}

.sb-badge-cancelled {
	background: rgba(245, 158, 11, 0.15);
	color: #fbbf24;
}

.sb-badge-cancelled::before {
	content: "⚠️";
	font-size: 0.75rem;
}

.sb-badge-admin {
	background: rgba(99, 102, 241, 0.18);
	color: #818cf8;
}

.sb-badge-admin::before {
	content: "🛠️";
	font-size: 0.75rem;
}

.sb-badge-tier1 {
	background: rgba(245, 158, 11, 0.15);
	color: #fbbf24;
}

.sb-badge-tier1::before {
	content: "⭐";
	font-size: 0.75rem;
}

.sb-badge-tier2 {
	background: rgba(148, 163, 184, 0.15);
	color: #cbd5e1;
}

.sb-badge-tier2::before {
	content: "👤";
	font-size: 0.75rem;
}

.sb-empty {
	text-align: center;
	padding: 3rem 1rem;
	color: #94a3b8;
}

.sb-empty::before {
	content: "📭";
	display: block;
	font-size: 2.5rem;
	margin-bottom: 0.75rem;
}

/* ---------- 버튼 & 입력 필드 ---------- */
.form-control,
.form-select {
	border: 1px solid rgba(255, 255, 255, 0.15);
	background-color: #111827;
	/* Dark Input box */
	border-radius: var(--radius-sm);
	padding: 0.5rem 0.75rem;
	font-size: 0.88rem;
	color: #f8fafc;
	transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.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='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

.form-control:focus,
.form-select:focus {
	background-color: #111827;
	color: #f8fafc;
	border-color: var(--color-primary);
	box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-control::placeholder {
	color: #64748b;
}

.btn-sb-primary {
	background: var(--color-primary);
	border: none;
	color: #fff;
	font-weight: 700;
	padding: 0.5rem 1rem;
	border-radius: var(--radius-sm);
	transition: background 0.15s ease-in-out;
}

.btn-sb-primary:hover {
	background: var(--color-primary-dark);
	color: #fff;
}

/* Override default bootstrap buttons in dark mode */
.btn-outline-primary {
	color: #818cf8;
	border-color: rgba(99, 102, 241, 0.4);
}

.btn-outline-primary:hover {
	background-color: var(--color-primary);
	border-color: var(--color-primary);
	color: #fff;
}

.btn-outline-secondary {
	color: #94a3b8;
	border-color: rgba(255, 255, 255, 0.15);
}

.btn-outline-secondary:hover {
	background-color: rgba(255, 255, 255, 0.05);
	color: #f8fafc;
	border-color: rgba(255, 255, 255, 0.25);
}

/* ---------- 로그인 페이지 ---------- */
.sb-login-shell {
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	background: radial-gradient(circle at top, #1e293b 0%, #090d16 100%);
}

.sb-login-card {
	background: #1e293b;
	border-radius: var(--radius-lg);
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
	width: 100%;
	max-width: 400px;
	padding: 3rem 2.5rem;
	border: 1px solid rgba(255, 255, 255, 0.08);
}

.sb-login-card h2 {
	font-weight: 800;
	color: #f8fafc !important;
	margin-bottom: 0.5rem;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.sb-login-card h2::before {
	content: "🔐";
}

.sb-login-card .sub {
	color: #94a3b8;
	margin-bottom: 2rem;
	font-size: 0.88rem;
}

.sb-login-card label {
	font-weight: 700;
	font-size: 0.82rem;
	color: #cbd5e1;
	margin-bottom: 0.4rem;
}

/* ---------- 공통 레이아웃/푸터 어댑터 ---------- */
footer.bg-white {
	background-color: #111827 !important;
	/* Matches topbar dark shade */
	border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
}

footer .text-muted {
	color: #94a3b8 !important;
}

footer a.text-muted {
	color: #94a3b8 !important;
}

footer a.text-muted:hover {
	color: #f8fafc !important;
}

.alert-success {
	background-color: rgba(16, 185, 129, 0.15) !important;
	color: #34d399 !important;
	border-color: rgba(16, 185, 129, 0.25) !important;
}

.alert-danger {
	background-color: rgba(239, 68, 68, 0.15) !important;
	color: #f87171 !important;
	border-color: rgba(239, 68, 68, 0.25) !important;
}

.list-group-item {
	background-color: #1e293b !important;
	color: #cbd5e1 !important;
	border-color: rgba(255, 255, 255, 0.08) !important;
}

/* ---------- 다크 모드 텍스트 및 코드 블록 가시성 오버라이드 ---------- */
.text-muted,
.text-secondary {
	color: #94a3b8 !important;
	/* Muted text should be bright enough to read against dark BG */
}

.text-dark {
	color: #f8fafc !important;
}

.text-body {
	color: #cbd5e1 !important;
}

label {
	color: #cbd5e1 !important;
}

code {
	color: #f43f5e !important;
	/* Bright rose pink for code tags */
	background-color: rgba(255, 255, 255, 0.08) !important;
	padding: 0.15rem 0.35rem !important;
	border-radius: var(--radius-sm);
	font-size: 0.9em;
}

/* ---------- 브라우저 자동 완성(Autofill) 및 비활성화(Disabled) 상태 입력창 조율 ---------- */
.form-control:disabled,
.form-control[disabled],
.form-control[readonly],
.form-control:read-only {
	background-color: #0b0f19 !important;
	/* A slightly darker shade than regular input (#111827) */
	color: #64748b !important;
	/* Muted gray text color */
	border-color: rgba(255, 255, 255, 0.08) !important;
	opacity: 0.8;
}

/* Webkit (Chrome, Safari, Edge) autofill background and text overrides */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
	-webkit-text-fill-color: #f8fafc !important;
	/* Maintain bright text */
	-webkit-box-shadow: 0 0 0px 1000px #111827 inset !important;
	/* Forces background to match input BG (#111827) */
	transition: background-color 5000s ease-in-out 0s;
}

/* ---------- 관리자 페이지 리팩토링 전용 클래스 ---------- */
.sb-btn-logout {
	border-radius: var(--radius-md) !important;
	border: none !important;
	background: #ef4444 !important;
	font-size: 0.85rem !important;
	font-weight: 600 !important;
	padding: 0.4rem 0.9rem !important;
}

.sb-btn-logout:hover {
	background: #dc2626 !important;
	color: #fff !important;
}

.sb-footer-main {
	font-family: var(--font-body);
	flex-shrink: 0;
}

#password-reset-requests-row {
	display: none;
}

.sb-btn-link-sm {
	font-size: 0.8rem;
	font-weight: 600;
}

.sb-settings-desc {
	font-size: 0.88rem;
}

.sb-settings-textarea {
	font-size: 0.85rem;
}