/* =========================
   GLOBAL RESET
========================= */
* {
    box-sizing: border-box;
}

:root {
    --sidebar-width: 220px;
    --topbar-height: 60px;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    background: #f1f5f9;
    color: #1e293b;
    overflow-x: hidden;
}

/* =========================
   SIDEBAR
========================= */
.sidebar {
    width: var(--sidebar-width);
    background: #0f172a;
    color: white;
    position: fixed;
    top: var(--topbar-height); /* 👈 FIX */
    left: 0;
    height: calc(100vh - var(--topbar-height)); /* 👈 FIX */
    padding: 20px;
    border-right: 1px solid #1e293b;
    z-index: 1000;
}

.sidebar h2 {
    font-size: 18px;
    margin-bottom: 25px;
    margin-top: 5px;
}

.sidebar a {
    display: block;
    color: #cbd5f5;
    text-decoration: none;
    padding: 10px 0;
    transition: 0.2s;
}

.sidebar a:hover {
    color: #38bdf8;
}

.sidebar a.active {
    color: #38bdf8;
    font-weight: bold;
}

/* =========================
   TOPBAR
========================= */
.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);

    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;

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

    padding: 0 20px;
    z-index: 900;
}

/* =========================
   MAIN CONTENT (supports BOTH classes)
========================= */
.main,
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: 30px;
    min-height: 100vh;
    background: #f1f5f9;
}

/* =========================
   HEADER
========================= */
header {
    margin-bottom: 30px;
}

header h1 {
    margin: 0;
}

/* =========================
   GRID
========================= */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* =========================
   CARDS
========================= */
.card {
    background: #ffffff;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    margin-bottom: 20px;
    transition: 0.2s;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* =========================
   BUTTONS
========================= */
.btn,
button.btn {
    display: inline-block;
    padding: 10px 15px;
    background: #38bdf8;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    margin: 5px 5px 0 0;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: 0.2s;
}

.btn:hover,
button.btn:hover {
    background: #0ea5e9;
}

/* =========================
   TABLE
========================= */
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 10px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    font-size: 14px;
}

/* =========================
   TEXT
========================= */
p {
    margin: 5px 0 0;
    color: #64748b;
}

/* =========================
   INPUTS
========================= */
input, textarea, select {
    width: 100%;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
}

/* =========================
   STATUS
========================= */
.status-on {
    color: green;
    font-weight: bold;
}

.status-off {
    color: gray;
}

/* =========================
   FOOTER
========================= */
.footer {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: 15px;
    text-align: center;
    font-size: 12px;
    color: #94a3b8;

    border-top: 1px solid #e2e8f0;
    background: #ffffff;
}
