/* ================================
   GLOBAL VARIABLES / CSS RESET
================================ */

:root {
    --primary: #3498db;
    --primary-dark: #2980b9;
    --accent: #2ecc71;
    --danger: #e74c3c;
    --warning: #f1c40f;
    --grey-light: #f4f6f8;
    --grey: #bdc3c7;
    --grey-dark: #7f8c8d;
    --text: #2c3e50;
    --sidebar-width: 240px;
    --topbar-height: 60px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: var(--grey-light);
    color: var(--text);
    overflow-x: hidden;
}

/* ================================
   TOPBAR
================================ */

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    z-index: 1000;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 22px;
    color: var(--text);
}

.brand {
    display: flex;
    align-items: center;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.brand i {
    margin-right: 8px;
}

.user-icon {
    font-size: 26px;
    color: var(--primary-dark);
    cursor: pointer;
}

/* ================================
   SIDEBAR
================================ */

.sidebar {
    width: var(--sidebar-width);
    background: white;
    height: calc(100vh - var(--topbar-height));
    position: fixed;
    left: 0;
    top: var(--topbar-height);
    padding-top: 15px;
    overflow-y: auto;
    border-right: 1px solid var(--grey);
    transition: transform 0.3s ease;
    z-index: 999;
}

.sidebar.active {
    transform: translateX(-100%);
}

.sidebar ul {
    list-style: none;
    padding: 0;
}

.sidebar li {
    margin-bottom: 5px;
}

.sidebar a {
    display: flex;
    align-items: center;
    padding: 12px 18px;
    text-decoration: none;
    font-size: 15px;
    color: var(--text);
    transition: 0.2s;
}

.sidebar a:hover {
    background: rgba(52,152,219,0.15);
    color: var(--primary);
}

.sidebar a i {
    margin-right: 10px;
    width: 20px;
}

.sidebar li.active a {
    background: var(--primary);
    color: white;
}

.nav-section-title {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--grey-dark);
    padding: 10px 18px 5px;
    font-weight: bold;
}

/* ================================
   LAYOUT WRAPPER
================================ */

.layout {
    display: flex;
    margin-top: var(--topbar-height);
}

.content-wrapper {
    margin-left: var(--sidebar-width);
    width: calc(100vw - var(--sidebar-width));
    padding: 25px;
    transition: margin-left 0.3s ease;
}

.sidebar.active + .content-wrapper {
    margin-left: 0;
    width: 100%;
}

.content h2 {
    margin-bottom: 18px;
    font-size: 26px;
    font-weight: 700;
}

/* ================================
   CARDS
================================ */

.card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    margin-bottom: 18px;
}

.card h3 {
    margin-bottom: 12px;
    font-size: 18px;
    font-weight: 600;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
}

/* ================================
   TABLES
================================ */

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

table th {
    text-align: left;
    padding: 10px;
    background: #ecf0f1;
    font-weight: 600;
}

table td {
    padding: 10px;
    border-bottom: 1px solid #ddd;
}

table tr:hover td {
    background: #f9f9f9;
}

/* Low-stock row */
tr.warn td {
    background: #fff3cd !important;
}

/* ================================
   BUTTONS
================================ */

.btn {
    padding: 7px 14px;
    border: none;
    cursor: pointer;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    font-size: 14px;
    color: white;
    background: var(--primary);
    transition: 0.2s;
}

.btn:hover {
    background: var(--primary-dark);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-secondary {
    background: var(--accent);
}

.btn-danger {
    background: var(--danger);
}

/* ================================
   FORMS
================================ */

label {
    font-weight: 600;
    margin-bottom: 4px;
    display: block;
}

input, select, textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 14px;
    background: white;
}

textarea {
    resize: vertical;
}

/* Form rows */
.form-row {
    display: flex;
    gap: 15px;
}

.form-row .col-3 { width: 25%; }
.form-row .col-4 { width: 33%; }
.form-row .col-6 { width: 50%; }
.form-row .col-12 { width: 100%; }

/* ================================
   TABS
================================ */

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    border-bottom: 1px solid #ccc;
}

.tab {
    padding: 8px 14px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: var(--grey-dark);
}

.tab.active {
    border-color: var(--primary);
    color: var(--primary);
}

/* ================================
   CHART CONTAINER
================================ */

.chart-container {
    width: 100%;
    height: 300px;
    position: relative;
}

/* ================================
   RESPONSIVE
================================ */

@media(max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .content-wrapper {
        margin-left: 0;
        width: 100%;
    }
}

