/* ==========================================================================
   ธีมหลักของระบบแพ็คสินค้า — โทนอินดิโก้/ม่วง ดูพรีเมียม สะอาดตา
   โหลดหลัง Bootstrap เพื่อ override ค่ามาตรฐาน
   ========================================================================== */

:root {
    /* โทนสีแบรนด์ The Go Getters — เขียวมรกต/teal ดูหรู */
    --brand: #2f8772;
    --brand-600: #276e5c;
    --brand-700: #1e5a4b;
    --brand-rgb: 47, 135, 114;
    --accent: #34b599;
    --mint: #97d9cb;

    --app-bg: #eef4f1;
    --surface: #ffffff;
    --ink: #1c2b28;
    --muted: #667a75;
    --line: rgba(20, 45, 40, .09);

    --radius: 16px;
    --radius-sm: 12px;
    --shadow-xs: 0 1px 2px rgba(16, 24, 40, .06);
    --shadow-sm: 0 2px 6px rgba(16, 24, 40, .06), 0 4px 14px rgba(16, 24, 40, .06);
    --shadow: 0 6px 22px rgba(16, 24, 40, .09);
    --shadow-lg: 0 16px 40px rgba(16, 24, 40, .16);

    /* ผูกกับตัวแปร Bootstrap บางส่วน */
    --bs-primary: #2f8772;
    --bs-primary-rgb: 47, 135, 114;
    --bs-link-color-rgb: var(--brand-rgb);
    --bs-link-hover-color-rgb: 30, 90, 75;
    --bs-body-font-family: 'Sarabun', system-ui, sans-serif;
}

[data-bs-theme="dark"] {
    --app-bg: #081713;
    --surface: #0f221d;
    --ink: #e3efe9;
    --muted: #93a9a2;
    --line: rgba(255, 255, 255, .08);
}

body {
    background: var(--app-bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* ---------- ปุ่ม ---------- */
.btn {
    border-radius: 10px;
    font-weight: 600;
    letter-spacing: .01em;
    transition: transform .05s ease, box-shadow .15s ease, background-color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-lg { border-radius: 13px; }
.btn-sm { border-radius: 8px; }

.btn-primary {
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-600);
    --bs-btn-hover-border-color: var(--brand-600);
    --bs-btn-active-bg: var(--brand-700);
    --bs-btn-active-border-color: var(--brand-700);
    --bs-btn-disabled-bg: var(--brand);
    --bs-btn-disabled-border-color: var(--brand);
    box-shadow: 0 4px 12px rgba(var(--brand-rgb), .30);
}
.btn-primary:hover { box-shadow: 0 6px 18px rgba(var(--brand-rgb), .38); }

.btn-outline-primary {
    --bs-btn-color: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand);
    --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-bg: var(--brand-700);
}
.btn-success { box-shadow: 0 4px 12px rgba(25, 135, 84, .28); }

/* ---------- ลิงก์ / primary utilities ---------- */
.text-primary { color: var(--brand) !important; }
.bg-primary { background-color: var(--brand) !important; }
.badge.text-bg-primary { background-color: var(--brand) !important; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-700); }

/* ---------- ฟอร์ม ---------- */
.form-control, .form-select {
    border-radius: 10px;
    border-color: var(--line);
    background: var(--surface);
    color: var(--ink);
}
.form-control:focus, .form-select:focus {
    border-color: rgba(var(--brand-rgb), .5);
    box-shadow: 0 0 0 .22rem rgba(var(--brand-rgb), .16);
}
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-check-input:focus { border-color: rgba(var(--brand-rgb), .5); box-shadow: 0 0 0 .22rem rgba(var(--brand-rgb), .16); }
.input-group-text { background: rgba(var(--brand-rgb), .06); border-color: var(--line); }

/* ---------- การ์ด ---------- */
.card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
}
.card.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--line);
    font-weight: 600;
    padding: .95rem 1.15rem;
}
.card-footer { background: transparent; border-top: 1px solid var(--line); }

/* ---------- ตาราง ---------- */
.table { --bs-table-color: var(--ink); }
.table > thead th {
    font-weight: 600;
    color: var(--muted);
    text-transform: none;
    border-bottom: 1px solid var(--line);
    padding-top: .8rem;
    padding-bottom: .8rem;
}
.table-light, .table-light > th, .table-light > td { --bs-table-bg: #f7f8fc; }
[data-bs-theme="dark"] .table-light, [data-bs-theme="dark"] .table-light > th { --bs-table-bg: #0e1526; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: rgba(var(--brand-rgb), .05); }

/* ---------- Sidebar (ไล่เฉดเขียวเข้ม ดูหรู) ---------- */
.sidebar {
    background: linear-gradient(195deg, #0c2c25 0%, #14453b 48%, #1d6553 100%);
    border: 0 !important;
    color: #bfe0d6;
    box-shadow: 4px 0 26px rgba(12, 44, 37, .18);
}
.sidebar .border-bottom { border-color: rgba(255, 255, 255, .10) !important; }
.sidebar .fw-bold { color: #ffffff; }
.sidebar small, .sidebar .text-secondary { color: #90cdbb !important; }
.sidebar .nav-section {
    color: #6fc9b3;
    opacity: 1;
    font-weight: 700;
    letter-spacing: .06em;
}
.sidebar .nav-link {
    color: #c2ded5;
    border-radius: 11px;
    font-weight: 500;
    transition: background .15s ease, color .15s ease;
}
.sidebar .nav-link:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.sidebar .nav-link.active {
    background: linear-gradient(90deg, #2f8772, #34b599);
    color: #fff;
    box-shadow: 0 8px 18px rgba(47, 135, 114, .5);
}
.sidebar .nav-link i { opacity: .95; }

/* โลโก้ในหัว sidebar (ใส่พื้นขาวให้อ่านชัดบนพื้นเขียวเข้ม) */
.sidebar-logo {
    width: 46px; height: 46px; flex: 0 0 46px;
    background: #fff; border-radius: 13px;
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .18);
}
.sidebar-logo img { width: 38px; height: 38px; object-fit: contain; }

/* ---------- Topbar ---------- */
.navbar.sticky-top {
    background: rgba(255, 255, 255, .82) !important;
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line) !important;
    box-shadow: 0 1px 12px rgba(16, 24, 40, .04);
}
[data-bs-theme="dark"] .navbar.sticky-top { background: rgba(18, 26, 46, .82) !important; }
.navbar-brand { font-weight: 700; }

/* ---------- Stat cards (การ์ดสรุปแดชบอร์ด) ---------- */
.stat-card {
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface);
    transition: transform .15s ease, box-shadow .15s ease;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat-card .fs-2 {
    width: 58px; height: 58px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 16px;
    background: color-mix(in srgb, currentColor 15%, transparent);
    margin-bottom: .35rem;
}
.stat-card .display-6 { font-weight: 800; letter-spacing: -.01em; }

/* ---------- Badge ---------- */
.badge { font-weight: 600; padding: .4em .7em; }
.rounded-pill { border-radius: 50rem !important; }

/* ---------- List group ---------- */
.list-group-item { background: var(--surface); border-color: var(--line); color: var(--ink); }

/* ---------- Toast ---------- */
.toast { border-radius: 12px; box-shadow: var(--shadow-lg); }

/* ---------- Modal ---------- */
.modal-content { border: 0; border-radius: 18px; box-shadow: var(--shadow-lg); }

/* ---------- หน้า Login (พื้นหลังไล่เฉดเขียวหรู) ---------- */
.auth-bg {
    background:
        radial-gradient(1100px 520px at 8% 6%, rgba(52, 181, 153, .5), transparent 42%),
        radial-gradient(900px 520px at 92% 96%, rgba(47, 135, 114, .55), transparent 46%),
        linear-gradient(135deg, #0c2c25 0%, #14453b 58%, #1d6553 100%);
}
.auth-card { border-radius: 22px !important; box-shadow: 0 24px 60px rgba(0, 0, 0, .35) !important; border: 0 !important; }
.auth-logo {
    width: 120px; height: 120px; border-radius: 24px;
    display: inline-flex; align-items: center; justify-content: center;
    background: #ffffff;
    box-shadow: 0 12px 30px rgba(47, 135, 114, .25);
    padding: 10px;
}
.auth-logo img { width: 100%; height: 100%; object-fit: contain; }

/* ---------- เบ็ดเตล็ด ---------- */
h1, h2, h3, .fw-bold { letter-spacing: -.01em; }
.text-secondary { color: var(--muted) !important; }
::selection { background: rgba(var(--brand-rgb), .2); }
