/* Reset & base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html {
    font-size: 16px; /* Base font size */
}

body {
    display: flex;
    background-color: #f4f7fd;
    color: #333;
}

/* Sidebar */
.sidebar {
    width: 18vw;
    min-width: 200px;
    background-color: #1f2937;
    color: #fff;
    min-height: 100vh;
    transition: transform 0.3s ease;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem;
}

.sidebar h2 {
    font-size: 1.4rem;
}

.sidebar ul {
    list-style: none;
    padding: 0;
}

.sidebar ul li {
    padding: 0.9rem 1.2rem;
    cursor: pointer;
    font-size: 1rem;
    transition: 0.2s;
}

.sidebar ul li:hover,
.sidebar ul li.active {
    background-color: #374151;
}

.hamburger {
    display: none;
    font-size: 1.8rem;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
}

/* Main content */
.main {
    flex: 1;
    margin-left: 18vw;
    min-width: 300px;
    padding: 1.5rem 2.5rem;
    transition: margin-left 0.3s ease;
}

header {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 2rem;
    gap: 0.8rem;
}

header h1 {
    font-size: 1.8rem;
}

header input,
header select {
    padding: 0.6rem 0.8rem;
    border-radius: 0.5rem;
    border: 1px solid #ccc;
    font-size: 1rem;
    min-width: 150px;
}
/* Cards */
.cards {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    overflow-x: auto;
}

/* Card */
.card {
    flex: 0 0 12rem;
    background-color: #fff;
    padding: clamp(0.8rem, 2vw, 1.2rem);
    border-radius: 1rem;
    box-shadow: 0 0.3rem 1rem rgba(0,0,0,0.05);
    transition: transform 0.2s;
}

.card:hover {
    transform: translateY(-0.3rem);
}

/* Card title */
.card h3 {
    margin-bottom: 0.5rem;
    font-size: clamp(0.75rem, 2.2vw, 1rem);
    color: #555;
    line-height: 1.2;
}

/* Card value */
.card p {
    font-size: clamp(1rem, 3.5vw, 1.4rem);
    font-weight: bold;
    line-height: 1.2;
}

/* Table Container */
.table-section {
    margin-bottom: 2rem;
    width: 100%;
    overflow-x: auto;
}


/* Table */
table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    background-color: #fff;
    border-radius: 0.8rem;
    overflow: hidden;
    box-shadow: 0 0.3rem 1rem rgba(0,0,0,0.05);
    table-layout: auto;
    font-size: clamp(0.7rem, 1.5vw, 0.95rem); /* Font scales with viewport but has min/max */
}

/* Table Head */
thead {
    background-color: #1f2937;
    color: #fff;
    font-size: inherit;
}

/* Table Cells */
th, td {
    padding: 0.5rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid #eee;
    word-wrap: break-word; /* Prevent long words from breaking layout */
}

/* Zebra striping */
tbody tr:nth-child(even) {
    background-color: #f3f4f6;
}

/* Responsive adjustments for very small screens */
@media (max-width: 600px) {
    th, td {
        padding: 0.4rem 0.6rem;
    }
}


/* Pagination */
.pagination {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.pagination button {
    padding: 0.4rem 0.8rem;
    border: none;
    background-color: #1f2937;
    color: white;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: 0.2s;
}

.pagination button:hover,
.pagination button.active {
    background-color: #3b82f6;
}

/* Charts */
.charts {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.chart-container {
    flex: 1;
    min-width: 250px;
    background-color: #fff;
    padding: 1rem;
    border-radius: 1rem;
    box-shadow: 0 0.3rem 1rem rgba(0,0,0,0.05);
}

/* Bar Chart */
.bar-chart {
    display: flex;
    align-items: flex-end;
    height: 200px;
    gap: 0.5rem;
}

.bar-chart .bar {
    flex: 1;
    position: relative;
    background-color: #3b82f6;
    border-radius: 0.5rem 0.5rem 0 0;
    transition: 0.3s;
}

.bar-chart .bar:hover {
    background-color: #2563eb;
}

.bar-chart .bar::after {
    content: attr(data-value);
    position: absolute;
    top: -1.2rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    color: #555;
}

/* Line Chart */
.line-chart {
    position: relative;
    width: 100%;
    height: 200px;
}

.line-chart svg {
    width: 100%;
    height: 100%;
}

.line-chart svg polyline {
    fill: none;
    stroke: #3b82f6;
    stroke-width: 2;
}

.line-chart svg circle {
    fill: #3b82f6;
    cursor: pointer;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .hamburger {
        display: block;
    }

    .main {
        margin-left: 0;
        padding: 1rem 1.5rem;
    }

    header {
        flex-direction: column;
        align-items: stretch;
    }

    
}

@media (max-width: 768px) {
    .chart-container {
        min-width: 100%;
    }
}
