/* style.css */
:root {
    --bg: #f5f7fb;
    --card: #ffffff;
    --ink: #172033;
    --muted: #778199;
    --primary: #ff8a00;
    --primary-dark: #ef6c00;
    --blue: #2563eb;
    --soft-orange: #fff4e6;
    --soft-blue: #eef4ff;
    --border: #e8edf5;
    --shadow: 0 20px 50px rgba(25, 37, 67, 0.08);
}

* { box-sizing: border-box; }

body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(255, 138, 0, 0.14), transparent 30%),
        linear-gradient(135deg, #f8fafc 0%, var(--bg) 45%, #eef4ff 100%);
    color: var(--ink);
    font-family: 'Anuphan', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Navbar */
.dashboard-navbar,
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background:
        radial-gradient(circle at 8% 0%, rgba(255, 138, 0, 0.34), transparent 28%),
        linear-gradient(135deg, #111827 0%, #172033 48%, #26344f 100%) !important;
    box-shadow: 0 18px 40px rgba(23, 32, 51, 0.2);
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
    backdrop-filter: blur(18px);
}

.dashboard-navbar .container-fluid {
    align-items: center;
}

.backend-brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.backend-brand-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 17px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), #ffb347);
    box-shadow: 0 12px 26px rgba(255, 138, 0, 0.28), inset 0 1px 0 rgba(255,255,255,0.35);
    font-size: 1.15rem;
    flex: 0 0 auto;
}

.navbar-brand {
    display: block;
    color: #fff !important;
    font-weight: 900;
    letter-spacing: 0.3px;
    line-height: 1.1;
    max-width: min(44vw, 520px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.navbar-subtitle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.82rem;
    margin-top: 0.15rem;
    letter-spacing: 0.2px;
}

.navbar-subtitle::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.14);
}

.backend-nav-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.btn-navbar-primary,
.btn-navbar-light,
.btn-navbar-ghost {
    border: 1px solid rgba(255,255,255,0.16);
    padding: 0.48rem 0.85rem;
    box-shadow: none;
}

.btn-navbar-primary {
    color: #1f2937;
    background: linear-gradient(135deg, #ffd166, var(--primary));
    border-color: rgba(255, 209, 102, 0.7);
}

.btn-navbar-primary:hover {
    color: #111827;
    background: linear-gradient(135deg, #ffe08a, #ff9f1a);
}

.btn-navbar-light {
    color: #172033;
    background: rgba(255,255,255,0.92);
}

.btn-navbar-light:hover {
    color: #172033;
    background: #fff;
}

.btn-navbar-ghost {
    color: rgba(255,255,255,0.88);
    background: rgba(255,255,255,0.08);
}

.btn-navbar-ghost:hover {
    color: #fff;
    background: rgba(255,255,255,0.15);
}

@media (max-width: 768px) {
    .dashboard-navbar .container-fluid {
        flex-direction: column;
        align-items: stretch;
        gap: 0.85rem;
    }

    .backend-nav-actions {
        justify-content: flex-start;
    }

    .navbar-brand {
        max-width: 100%;
    }
}

.btn {
    border-radius: 999px;
    font-weight: 700;
    transition: 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.12);
}

.dashboard-wrap {
    margin-top: 1.5rem;
    padding-bottom: 2rem;
}

.dashboard-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.6rem;
    border-radius: 28px;
    background: linear-gradient(135deg, rgba(255,255,255,0.88), rgba(255,255,255,0.64));
    border: 1px solid rgba(255,255,255,0.8);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.eyebrow {
    color: var(--primary-dark);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 1.6px;
    text-transform: uppercase;
}

.hero-title {
    color: var(--ink);
    font-size: clamp(1.7rem, 3vw, 2.5rem);
    font-weight: 900;
}

.hero-desc {
    color: var(--muted);
}

.hero-badge,
.section-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--soft-orange);
    color: var(--primary-dark);
    font-weight: 800;
    padding: 0.45rem 0.9rem;
    border: 1px solid rgba(255, 138, 0, 0.22);
}

.hero-badge::before {
    content: '';
    width: 8px;
    height: 8px;
    margin-right: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.16);
}

.dashboard-card,
.card {
    background: var(--card);
    border: 1px solid var(--border) !important;
    border-radius: 26px;
    box-shadow: var(--shadow);
}

.order-card {
    padding: 1.35rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-header h5 {
    font-weight: 900;
    color: var(--ink);
}

.order-list {
    display: grid;
    gap: 0.8rem;
}

.latest-scroll-list {
    max-height: 820px;
    overflow-y: auto;
    padding-right: 0.3rem;
}

.latest-scroll-list::-webkit-scrollbar {
    width: 8px;
}

.latest-scroll-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

.latest-scroll-list::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 999px;
}

.order-item {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: 0.9rem;
    align-items: center;
    padding: 1rem;
    border-radius: 20px;
    background: #fbfcff;
    border: 1px solid var(--border);
    transition: 0.18s ease;
}

.order-item:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 138, 0, 0.35);
    box-shadow: 0 14px 30px rgba(25, 37, 67, 0.08);
}

.order-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary), #ffb347);
    color: white;
    font-weight: 900;
    box-shadow: 0 10px 22px rgba(255, 138, 0, 0.26);
    overflow: hidden;
}

.order-icon-img {
    background: #fff;
    border: 0;
    border-radius: 0;
    box-shadow: 0 10px 22px rgba(25, 37, 67, 0.12);
}

.order-icon-img img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transform: scale(1.08);
}

.order-title {
    color: var(--ink);
    font-weight: 900;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.order-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
    color: var(--muted);
    font-size: 0.88rem;
    margin-top: 0.25rem;
}

.service-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.18rem 0.55rem;
    background: var(--soft-blue);
    color: var(--blue);
    font-weight: 800;
}

.order-date {
    color: #98a2b7;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.order-time {
    color: #ef4444;
    background: #fff1f2;
    border: 1px solid #ffe4e6;
    border-radius: 999px;
    padding: 0.4rem 0.7rem;
    font-size: 0.82rem;
    font-weight: 900;
    white-space: nowrap;
}

.order-item-expanded {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    align-items: start;
}

.order-sub-id {
    display: inline-flex;
    margin-left: 0.45rem;
    padding: 0.12rem 0.5rem;
    border-radius: 999px;
    background: #f1f5f9;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    vertical-align: middle;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.18rem 0.55rem;
    background: #f1f5f9;
    color: var(--muted);
    font-weight: 900;
}

.status-active {
    background: #ecfdf5;
    color: #047857;
}

.status-expired {
    background: #fff1f2;
    color: #be123c;
}

.expired-card {
    padding: 1.2rem;
}

.expired-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    border-radius: 999px;
    background: #fff1f2;
    color: #be123c;
    font-weight: 950;
    border: 1px solid #ffe4e6;
}

.expired-list {
    display: grid;
    gap: 0.75rem;
    max-height: 460px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.expired-list::-webkit-scrollbar {
    width: 8px;
}

.expired-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

.expired-list::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 999px;
}

.expired-item {
    padding: 0.9rem;
    border-radius: 18px;
    background: #fffafa;
    border: 1px solid #ffe4e6;
    border-left: 7px solid #ef4444;
    transition: 0.18s ease;
}

.expired-red {
    background: #fffafa;
    border-color: #ffe4e6;
    border-left-color: #ef4444;
}

.expired-yellow {
    background: #fffbeb;
    border-color: #fde68a;
    border-left-color: #f59e0b;
}

.expired-green {
    background: #f0fdf4;
    border-color: #bbf7d0;
    border-left-color: #22c55e;
}

.expired-blue {
    background: #eff6ff;
    border-color: #bfdbfe;
    border-left-color: #3b82f6;
}

.expired-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.expired-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.65rem;
    margin-top: 0.4rem;
    color: var(--muted);
    font-size: 0.8rem;
}

.expired-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.8rem;
}

.color-picker {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.28);
}

.color-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.12);
    cursor: pointer;
}

.color-dot.active {
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.22);
}

.color-red { background: #ef4444; }
.color-yellow { background: #f59e0b; }
.color-green { background: #22c55e; }
.color-blue { background: #3b82f6; }

.order-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.25rem 0.8rem;
    margin-top: 0.55rem;
    color: var(--muted);
    font-size: 0.78rem;
}

.order-detail-grid strong {
    color: var(--ink);
    font-weight: 800;
}

.stats-grid {
    display: grid;
    gap: 1rem;
}

.stat-card {
    position: relative;
    overflow: hidden;
    padding: 1.35rem;
}

.stat-card::after {
    content: '';
    position: absolute;
    right: -35px;
    top: -35px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    opacity: 0.14;
}

.stat-card-users::after { background: var(--primary); }
.stat-card-orders::after { background: var(--blue); }

.stat-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    margin-bottom: 1rem;
    border-radius: 16px;
    background: #f6f8fc;
    font-size: 1.3rem;
}

.stat-card small {
    color: var(--muted);
    font-weight: 800;
}

.stat-card h3 {
    margin: 0.25rem 0;
    color: var(--ink);
    font-size: 2.4rem;
    font-weight: 950;
}

.stat-card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
}

/* Table Styling */
.table-hover tbody tr:hover { background-color: #f8f9fa; transition: 0.2s; }
thead { background-color: #34495e; color: white; }
th { text-transform: uppercase; font-size: 0.85rem; letter-spacing: 0.5px; }
.filter-row th { background-color: #42526a; }
.filter-disabled { color: rgba(255,255,255,0.45); font-weight: 600; }
.column-filter { min-width: 130px; }
.filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    margin-left: 4px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 0.72rem;
}
.excel-filter { position: relative; }
.excel-filter-toggle { min-width: 105px; }
.excel-filter-popup {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 1050;
    width: 280px;
    padding: 0.85rem;
    border-radius: 14px;
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--border);
    box-shadow: 0 18px 45px rgba(23, 32, 51, 0.22);
    text-transform: none;
    letter-spacing: 0;
}
.excel-filter-title { font-weight: 900; margin-bottom: 0.5rem; }
.excel-filter-options {
    max-height: 230px;
    overflow: auto;
    margin: 0.5rem 0;
    border: 1px solid var(--border);
    border-radius: 10px;
}
.excel-filter-option {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    padding: 0.42rem 0.5rem;
    font-size: 0.82rem;
    color: var(--ink);
    cursor: pointer;
}
.excel-filter-option:hover { background: #f6f8fc; }
.excel-filter-option small { color: var(--muted); }
.excel-filter-select-all { font-weight: 800; }
.excel-filter-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.45rem;
}
/* Config page */
.config-wrap { padding-bottom: 2.5rem; }
.config-sidebar {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 130px);
    overflow: auto;
    padding: 1.1rem;
}
.config-table-menu {
    gap: 0.45rem;
}
.config-table-menu .list-group-item {
    border: 1px solid var(--border);
    border-radius: 16px !important;
    color: var(--ink);
    font-weight: 800;
    transition: 0.18s ease;
}
.config-table-menu .list-group-item:hover {
    transform: translateX(3px);
    border-color: rgba(255, 138, 0, 0.35);
    background: var(--soft-orange);
}
.config-table-menu .list-group-item.active {
    background: linear-gradient(135deg, var(--primary), #ffb347);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 12px 26px rgba(255, 138, 0, 0.24);
}
.config-table-card {
    overflow: hidden;
}
.config-table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(255,255,255,0.96), rgba(255,244,230,0.62));
}
.config-table-toolbar h4 {
    color: var(--ink);
    font-weight: 950;
}
.config-table-responsive {
    max-height: calc(100vh - 310px);
    overflow: auto;
}
.config-table-responsive table {
    min-width: 1100px;
}
.config-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    background: #fff;
}
.config-pagination-info,
.config-page-label,
.config-page-select-label {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 800;
}
.config-page-select-label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}
.config-page-select {
    width: auto;
    min-width: 82px;
    font-weight: 800;
}
.config-pagination-buttons {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}
.config-table-responsive thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    white-space: nowrap;
}
.config-table-responsive tbody td {
    white-space: nowrap;
    background: #fff;
}
.config-modal-content {
    border: 0;
    border-radius: 24px;
    box-shadow: var(--shadow);
}
.config-modal-header {
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, #fff, var(--soft-orange));
}
.config-modal-header .modal-title {
    color: var(--ink);
    font-weight: 950;
}
.badge { padding: 0.5em 0.8em; border-radius: 999px; }

@media (max-width: 768px) {
    .dashboard-hero,
    .section-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .order-item {
        grid-template-columns: 42px minmax(0, 1fr);
    }

    .order-icon {
        width: 42px;
        height: 42px;
    }

    .order-time {
        grid-column: 1 / -1;
        justify-self: flex-start;
    }

    .order-detail-grid {
        grid-template-columns: 1fr;
    }

    .config-table-toolbar,
    .config-pagination {
        align-items: flex-start;
        flex-direction: column;
    }

    .config-sidebar {
        position: static;
        max-height: none;
    }
}
