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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-soft: #eff6ff;
    --secondary: #4f46e5;
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;
    --info: #0891b2;

    --dark: #0f172a;
    --text: #334155;
    --muted: #64748b;
    --border: #e2e8f0;
    --bg: #f5f7fb;
    --white: #ffffff;

    --sidebar-width: 270px;
    --topbar-height: 72px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: 'Sarabun', sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    text-decoration: none;
}

img {
    max-width: 100%;
}

/* =========================================================
   ADMIN LAYOUT
========================================================= */

.admin-wrapper {
    min-height: 100vh;
}

.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;

    width: var(--sidebar-width);

    background:
        linear-gradient(
            180deg,
            #172554 0%,
            #1e3a8a 45%,
            #1e40af 100%
        );

    color: #fff;

    overflow-y: auto;
    overflow-x: hidden;

    z-index: 1050;

    transition: transform .25s ease;

    box-shadow:
        10px 0 30px
        rgba(15, 23, 42, .08);
}

.sidebar-brand {
    min-height: 96px;

    display: flex;
    align-items: center;

    gap: 13px;

    padding: 20px 22px;

    border-bottom:
        1px solid
        rgba(255, 255, 255, .10);
}

.sidebar-brand-icon {
    width: 48px;
    height: 48px;

    flex: 0 0 48px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 16px;

    background:
        rgba(255, 255, 255, .14);

    color: #fff;

    font-size: 24px;

    border:
        1px solid
        rgba(255, 255, 255, .12);
}

.sidebar-brand-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
}

.sidebar-brand-subtitle {
    font-size: 12px;
    opacity: .7;
    margin-top: 2px;
}

.sidebar-menu {
    padding: 18px 14px 32px;
}

.sidebar-heading {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .8px;

    color:
        rgba(255, 255, 255, .55);

    padding: 14px 13px 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;

    gap: 12px;

    min-height: 46px;

    padding: 10px 13px;

    margin-bottom: 4px;

    border-radius: 12px;

    color:
        rgba(255, 255, 255, .82);

    font-size: 14px;
    font-weight: 500;

    transition:
        background .18s ease,
        color .18s ease,
        transform .18s ease;
}

.sidebar-link:hover {
    color: #fff;

    background:
        rgba(255, 255, 255, .10);

    transform: translateX(2px);
}

.sidebar-link.active {
    color: #fff;

    background:
        rgba(255, 255, 255, .17);

    box-shadow:
        inset 3px 0 0
        rgba(255,255,255,.9);
}

.sidebar-link i {
    width: 22px;

    text-align: center;

    font-size: 18px;
}

.sidebar-link .badge {
    margin-left: auto;
}

.admin-main {
    min-height: 100vh;

    margin-left: var(--sidebar-width);

    transition: margin-left .25s ease;
}

/* =========================================================
   TOPBAR
========================================================= */

.admin-topbar {
    height: var(--topbar-height);

    position: sticky;
    top: 0;

    z-index: 1020;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 28px;

    background:
        rgba(255, 255, 255, .94);

    backdrop-filter: blur(15px);

    border-bottom:
        1px solid var(--border);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.sidebar-toggle {
    width: 42px;
    height: 42px;

    display: none;

    align-items: center;
    justify-content: center;

    border: 0;

    border-radius: 12px;

    background: #f1f5f9;

    color: var(--dark);

    font-size: 21px;
}

.page-title-top {
    margin: 0;

    font-size: 19px;
    font-weight: 700;

    color: var(--dark);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 11px;
}

.topbar-avatar {
    width: 42px;
    height: 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 14px;

    color: #fff;

    font-size: 18px;

    background:
        linear-gradient(
            135deg,
            var(--primary),
            var(--secondary)
        );
}

.topbar-user-name {
    font-size: 14px;
    font-weight: 700;

    color: var(--dark);
}

.topbar-user-role {
    font-size: 12px;
    color: var(--muted);
}

/* =========================================================
   CONTENT
========================================================= */

.admin-content {
    padding: 28px;
}

.page-heading {
    margin-bottom: 24px;
}

.page-heading h1 {
    margin: 0;

    color: var(--dark);

    font-size:
        clamp(25px, 3vw, 34px);

    font-weight: 800;
}

.page-heading p {
    color: var(--muted);

    margin:
        7px 0 0;
}

/* =========================================================
   CARDS
========================================================= */

.app-card {
    border: 1px solid #edf2f7;

    border-radius: 20px;

    background: #fff;

    box-shadow:
        0 8px 25px
        rgba(15, 23, 42, .045);
}

.stat-card {
    height: 100%;

    padding: 22px;

    position: relative;

    overflow: hidden;

    transition:
        transform .2s ease,
        box-shadow .2s ease;
}

.stat-card:hover {
    transform:
        translateY(-3px);

    box-shadow:
        0 14px 35px
        rgba(15,23,42,.08);
}

.stat-card::after {
    content: "";

    position: absolute;

    width: 100px;
    height: 100px;

    border-radius: 50%;

    right: -34px;
    top: -35px;

    background:
        rgba(37, 99, 235, .04);
}

.stat-icon {
    width: 52px;
    height: 52px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 16px;

    font-size: 24px;

    margin-bottom: 18px;
}

.stat-icon.blue {
    background: #eff6ff;
    color: #2563eb;
}

.stat-icon.green {
    background: #ecfdf5;
    color: #16a34a;
}

.stat-icon.orange {
    background: #fff7ed;
    color: #ea580c;
}

.stat-icon.purple {
    background: #f5f3ff;
    color: #7c3aed;
}

.stat-icon.cyan {
    background: #ecfeff;
    color: #0891b2;
}

.stat-icon.red {
    background: #fef2f2;
    color: #dc2626;
}

.stat-value {
    font-size: 30px;
    line-height: 1;

    font-weight: 800;

    color: var(--dark);
}

.stat-label {
    margin-top: 8px;

    color: var(--muted);

    font-size: 14px;
}

/* =========================================================
   SECTION CARD
========================================================= */

.section-card {
    padding: 0;
    overflow: hidden;
}

.section-card-header {
    min-height: 66px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 15px 20px;

    border-bottom:
        1px solid #eef2f7;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;

    color: var(--dark);

    font-size: 17px;
    font-weight: 700;
}

.section-title-icon {
    width: 38px;
    height: 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 12px;

    color: var(--primary);

    background: var(--primary-soft);
}

.section-card-body {
    padding: 20px;
}

/* =========================================================
   TABLE
========================================================= */

.table-app {
    margin-bottom: 0;
}

.table-app th {
    white-space: nowrap;

    color: #475569;

    background: #f8fafc;

    border-bottom:
        1px solid var(--border);

    font-size: 13px;
    font-weight: 700;
}

.table-app td {
    vertical-align: middle;

    color: #475569;

    font-size: 14px;

    border-color: #eef2f7;
}

.table-app tbody tr:hover {
    background: #fbfdff;
}

/* =========================================================
   BADGES
========================================================= */

.status-badge {
    display: inline-flex;
    align-items: center;

    gap: 5px;

    padding: 6px 10px;

    border-radius: 50px;

    font-size: 12px;
    font-weight: 600;
}

.status-approved {
    background: #ecfdf5;
    color: #15803d;
}

.status-submitted,
.status-under_review {
    background: #fff7ed;
    color: #c2410c;
}

.status-returned,
.status-cancelled {
    background: #fef2f2;
    color: #b91c1c;
}

.status-draft {
    background: #f1f5f9;
    color: #475569;
}

.status-active {
    background: #eff6ff;
    color: #1d4ed8;
}

/* =========================================================
   CURRENT YEAR CARD
========================================================= */

.year-banner {
    position: relative;

    overflow: hidden;

    padding: 26px;

    border-radius: 22px;

    color: #fff;

    background:
        linear-gradient(
            135deg,
            #2563eb,
            #4f46e5
        );

    box-shadow:
        0 16px 35px
        rgba(37, 99, 235, .18);
}

.year-banner::before {
    content: "";

    position: absolute;

    width: 180px;
    height: 180px;

    right: -70px;
    top: -80px;

    border-radius: 50%;

    background:
        rgba(255,255,255,.10);
}

.year-banner::after {
    content: "";

    position: absolute;

    width: 110px;
    height: 110px;

    right: 80px;
    bottom: -70px;

    border-radius: 50%;

    background:
        rgba(255,255,255,.07);
}

.year-banner-content {
    position: relative;
    z-index: 2;
}

.year-caption {
    font-size: 13px;
    opacity: .85;
}

.year-title {
    margin: 5px 0;

    font-size:
        clamp(24px, 3vw, 34px);

    font-weight: 800;
}

.year-subtitle {
    opacity: .88;
}

/* =========================================================
   EMPTY
========================================================= */

.empty-state {
    padding: 40px 20px;

    text-align: center;

    color: var(--muted);
}

.empty-state-icon {
    font-size: 42px;

    color: #cbd5e1;

    margin-bottom: 10px;
}

/* =========================================================
   PUBLIC PAGE
========================================================= */

.public-body {
    min-height: 100vh;

    background:
        linear-gradient(
            180deg,
            #eff6ff 0,
            #f8fafc 520px,
            #f8fafc 100%
        );
}

.public-navbar {
    min-height: 72px;

    background:
        rgba(255,255,255,.94);

    backdrop-filter:
        blur(15px);

    border-bottom:
        1px solid rgba(226,232,240,.8);
}

.public-brand {
    display: flex;
    align-items: center;
    gap: 11px;

    color: var(--dark);

    font-weight: 800;
}

.public-brand-icon {
    width: 42px;
    height: 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 13px;

    color: #fff;

    background:
        linear-gradient(
            135deg,
            #2563eb,
            #4f46e5
        );
}

.hero {
    padding:
        80px 0 70px;

    overflow: hidden;
}

.hero-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    padding: 7px 13px;

    border-radius: 50px;

    color: #1d4ed8;

    background: #dbeafe;

    font-size: 13px;
    font-weight: 700;
}

.hero-title {
    margin:
        20px 0 17px;

    color: #0f172a;

    font-size:
        clamp(36px, 6vw, 62px);

    line-height: 1.15;

    font-weight: 800;
}

.hero-title span {
    color: #2563eb;
}

.hero-description {
    max-width: 650px;

    color: #64748b;

    font-size: 18px;
    line-height: 1.8;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;

    margin-top: 28px;
}

.hero-button {
    min-height: 52px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: 8px;

    padding: 0 22px;

    border-radius: 14px;

    font-weight: 700;
}

.hero-panel {
    padding: 26px;

    border:
        1px solid
        rgba(255,255,255,.8);

    border-radius: 26px;

    background:
        rgba(255,255,255,.86);

    backdrop-filter:
        blur(20px);

    box-shadow:
        0 30px 80px
        rgba(37,99,235,.12);
}

.public-stat {
    padding: 18px;

    border-radius: 17px;

    background: #f8fafc;

    border: 1px solid #eef2f7;
}

.public-stat-number {
    color: var(--dark);

    font-size: 27px;
    font-weight: 800;
}

.public-stat-label {
    color: var(--muted);

    font-size: 13px;
}

.public-section {
    padding: 65px 0;
}

.public-section-title {
    color: var(--dark);

    font-size: 30px;
    font-weight: 800;
}

.quick-card {
    height: 100%;

    display: block;

    padding: 25px;

    border-radius: 20px;

    color: var(--text);

    background: #fff;

    border: 1px solid #edf2f7;

    box-shadow:
        0 7px 25px
        rgba(15,23,42,.04);

    transition:
        transform .2s ease,
        box-shadow .2s ease;
}

.quick-card:hover {
    color: var(--text);

    transform:
        translateY(-5px);

    box-shadow:
        0 18px 40px
        rgba(15,23,42,.08);
}

.quick-card-icon {
    width: 54px;
    height: 54px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 17px;

    margin-bottom: 18px;

    font-size: 25px;

    color: #2563eb;

    background: #eff6ff;
}

.public-footer {
    padding: 30px 0;

    color: #64748b;

    background: #fff;

    border-top: 1px solid #e2e8f0;
}

/* =========================================================
   OVERLAY
========================================================= */

.sidebar-overlay {
    position: fixed;
    inset: 0;

    display: none;

    z-index: 1040;

    background:
        rgba(15,23,42,.45);

    backdrop-filter:
        blur(2px);
}

/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 991.98px) {

    .admin-sidebar {
        transform:
            translateX(-100%);
    }

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

    .sidebar-overlay.show {
        display: block;
    }

    .admin-main {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: flex;
    }

    .admin-topbar {
        padding: 0 18px;
    }

    .admin-content {
        padding: 20px 16px;
    }

    .topbar-user-info {
        display: none;
    }

    .hero {
        padding:
            50px 0;
    }
}

@media (max-width: 575.98px) {

    .page-title-top {
        font-size: 16px;
    }

    .year-banner {
        padding: 21px;
    }

    .section-card-header {
        align-items: flex-start;
        gap: 10px;
        flex-direction: column;
    }

    .hero-title {
        font-size: 38px;
    }
}