/* =========================================
   ⚙️ Light / Dark Theme Variables
========================================= */
:root {
    --bg: #f6f8fa;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #94a3b8;
    --primary: #2563eb;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #f4273a;
    --radius: 14px;
    --shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
    --shadow-hover: 0 8px 30px rgba(15, 23, 42, 0.12);
}

/* ===== DARK THEME ===== */
[data-theme="dark"] {
    --bg: #0f172a;
    --card: #1e293b;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --primary: #3b82f6;
    --success: #16a34a;
    --warning: #fbbf24;
    --danger: #f87171;
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    --shadow-hover: 0 6px 26px rgba(0, 0, 0, 0.6);
}

/* =========================================
   ⚙️ Base Styles
========================================= */
html,
body {
    height: 100%;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Poppins", sans-serif;
    transition: background 0.4s ease, color 0.4s ease;
}

.container {
    max-width: 1220px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* =========================================
   Header
========================================= */
header h1 {
    font-size: 30px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
    transition: color 0.3s ease;
}

header p {
    color: var(--muted);
    font-size: 15px;
    margin-bottom: 24px;
}

/* =========================================
   Buttons
========================================= */
.btn {
    font-weight: 600;
    border-radius: 10px !important;
    padding: 8px 16px !important;
    border: none !important;
    transition: all 0.3s ease-in-out;
}

.btn:hover {
    color: var(--text);
}

.btn-primary {
    background: var(--primary) !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background: #1d4ed8 !important;
    transform: translateY(-2px);
}

/* ACTIVE BUTTON (RED) */
.btn.btn-primary.active,
.btn.btn-primary:active,
.btn.btn-primary.active:focus {
    background: linear-gradient(90deg, #f4273a 0%, #dc2626 100%) !important;
    color: #fff !important;
    box-shadow: 0 4px 18px rgba(244, 39, 58, 0.4) !important;
}

/* Dark mode tweak for active btn */
[data-theme="dark"] .btn.btn-primary.active {
    background: linear-gradient(90deg, #f87171 0%, #dc2626 100%) !important;
    box-shadow: 0 4px 14px rgba(244, 39, 58, 0.5) !important;
}

/* =========================================
   Dashboard Top Cards
========================================= */
.top-box {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 18px;
    margin-top: 20px;
}

.cardbox {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1 1 23%;
    min-width: 240px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.cardbox:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
}

.cardbox .card-left {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cardbox .cbtitle {
    font-size: 13px;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cardbox .cbvalue {
    font-size: 30px;
    font-weight: 700;
    color: var(--text);
}

/* Card icons */
.cardbox .iconbox {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: rgba(37, 99, 235, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cardbox .iconbox img {
    width: 22px;
    height: 22px;
}

/* Variants */
.cardbox.outofstock {
    background: #fff5f6;
}

[data-theme="dark"] .cardbox.outofstock {
    background: rgba(244, 39, 58, 0.15);
}

.cardbox.pricechanges {
    background: #f3fff9;
}

[data-theme="dark"] .cardbox.pricechanges {
    background: rgba(34, 197, 94, 0.1);
}

.cardbox.descupdates {
    background: #fffdf3;
}

[data-theme="dark"] .cardbox.descupdates {
    background: rgba(234, 179, 8, 0.1);
}

/* =========================================
   Chart Section
========================================= */
.chart-section {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 30px;
}

.chart-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    width: 68%;
    transition: all 0.3s ease;
}

.chart-card:hover {
    box-shadow: var(--shadow-hover);
}

.chart-card h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 14px;
}

.chart-wrap {
    height: 340px;
}

/* =========================================
   Right Sidebar
========================================= */
.right-card {
    width: 30%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.right-card-c {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.right-card-c:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.rc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.rc-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

.rc-header .rc-badge {
    background: #f3f4f6;
    border-radius: 10px;
    font-size: 12px;
    padding: 3px 10px;
    font-weight: 500;
    color: var(--muted);
}

.rc-status-sec {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}

.rc-label {
    font-size: 13px;
    color: var(--muted);
}

.rc-hr {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

[data-theme="dark"] .rc-header .rc-badge {
    background: #334155;
}

/* =========================================
   Table Section
========================================= */
.table-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    margin-top: 35px;
    transition: all 0.3s ease;
}

.table-card h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 14px;
}

.table thead th {
    color: var(--muted);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    background: #f9fafb;
    border-bottom: 1px solid #e2e8f0;
}

[data-theme="dark"] .table thead th {
    background: #1e293b;
    border-bottom: 1px solid #334155;
}

[data-theme="dark"] table.table-bordered.dataTable thead tr:first-child th,
table.table-bordered.dataTable thead tr:first-child td {
    border-top: 1px solid #334155;
}

[data-theme="dark"] table.table-bordered.dataTable th:first-child {
    border-left: 1px solid #334155;
}

[data-theme="dark"] .table-bordered> :not(caption)>*>* {
    border-color: #334155;
}

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

[data-theme="dark"] .table tbody td {
    background: var(--bg);
    border-bottom: 1px solid #334155;
}

/* =========================================
   Pills & Status
========================================= */
.pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 12px;
}

.pill.price {
    background: #e0f2fe;
    color: var(--primary);
}

.pill.stock {
    background: #fff7e6;
    color: var(--warning);
}

.pill.desc {
    background: #f3f4f6;
    color: var(--text);
}

.status-updated {
    background: #e6fbef;
    color: var(--success);
}

.status-warning {
    background: #fff6ed;
    color: var(--warning);
}

.status-error {
    background: #fee2e2;
    color: var(--danger);
}

/* =========================================
   Responsive
========================================= */
@media (max-width: 992px) {
    .cardbox {
        flex: 1 1 48%;
    }

    .chart-card,
    .right-card {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .cardbox {
        flex: 1 1 100%;
    }

    header h1 {
        font-size: 22px;
    }

    .chart-wrap {
        height: 260px;
    }
}

/* =========================================
   🔝 Top Navbar (Light + Dark)
========================================= */
.top-navbar {
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    background: var(--card);
    color: var(--text);
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    transition: background 0.4s ease, color 0.4s ease, box-shadow 0.4s ease;
}

[data-theme="dark"] .top-navbar {
    background: #1e293b;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
    border-bottom: 1px solid #334155;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-logo {
    width: 28px;
    height: 28px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.navbar-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text);
    margin: 0;
}

/* Right Section */
.navbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Environment badge */
.env-badge {
    font-size: 12px;
    font-weight: 600;
    background: var(--primary);
    color: #fff;
    border-radius: 6px;
    padding: 4px 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

[data-theme="dark"] .env-badge {
    background: var(--success);
}

/* Theme toggle button */
.btn-theme {
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.4) !important;
    color: var(--text);
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-theme:hover {
    background: rgba(148, 163, 184, 0.15);
}

/* Dark theme tweaks */
[data-theme="dark"] .btn-theme {
    border-color: rgba(148, 163, 184, 0.6) !important;
}

[data-theme="dark"] .btn-theme:hover {
    background: rgba(255, 255, 255, 0.08);
}

.main-contain {
    padding: 100px 0 60px 0;
}

[data-theme="dark"] .select2-container--bootstrap-5 .select2-selection,
[data-theme="dark"] .select2-container--bootstrap-5 .select2-dropdown {
    color: #e2e8f0;
    background-color: #0f172a;
    border: 1px solid #4f565e;
}

[data-theme="dark"] .select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__rendered .select2-selection__choice {
    color: #e2e8f0;
    border: 1px solid #4f565e;
}

[data-theme="dark"] .select2-container--bootstrap-5 .select2-selection--multiple .select2-search .select2-search__field::placeholder {
    color: #e2e8f0;
}

[data-theme="dark"] .select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option.select2-results__option--highlighted {
    color: #e2e8f0;
    background-color: #1e293b;
}
