:root {
    --brand-green: #27ae60;
    --brand-dark: #2c3e50;
    --brand-light: #ecf0f1;
    --sidebar-width: 250px;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', sans-serif; }

body {
    display: flex; /* The Layout Engine */
    height: 100vh; /* Full screen height */
    overflow: hidden; /* Prevent body scroll, individual areas will scroll */
    background-color: #f4f7f6;
    color: #333;
}

/* --- SIDEBAR --- */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--brand-dark);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 20px;
    flex-shrink: 0; /* Never shrink */
}

.logo-area {
    margin-bottom: 40px;
    text-align: center;
}
.logo-area h1 { font-size: 1.2rem; margin-top: 10px; color: var(--brand-green); }

.nav-links button {
    background: none;
    border: none;
    color: #bdc3c7;
    width: 100%;
    text-align: left;
    padding: 15px;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 8px;
    margin-bottom: 5px;
    transition: 0.3s;
}

.nav-links button:hover { background-color: rgba(255,255,255,0.1); color: white; }
.nav-links button.active { background-color: var(--brand-green); color: white; font-weight: bold; }
.nav-links i { margin-right: 10px; width: 20px; text-align: center; }

/* --- MAIN CONTENT AREA --- */
.main-content {
    flex: 1; /* Take remaining space */
    padding: 30px;
    overflow-y: auto; /* Allow scrolling inside here */
    position: relative;
}

/* --- VIEWS (Hiding/Showing) --- */
.view-section { display: none; animation: fadeIn 0.3s; }
.view-section.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* --- DASHBOARD WIDGETS --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border-left: 4px solid var(--brand-green);
}
.stat-card h3 { font-size: 0.9rem; color: #7f8c8d; margin-bottom: 5px; }
.stat-card .number { font-size: 1.8rem; font-weight: bold; color: var(--brand-dark); }

/* --- EXISTING STYLES (Tables, Forms, Buttons) --- */
.container { max-width: 100%; } /* Reset old container */
.grid { display: grid; grid-template-columns: 350px 1fr; gap: 20px; align-items: start; }

.card { background: white; padding: 20px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
h2 { margin-bottom: 15px; color: var(--brand-dark); border-bottom: 2px solid var(--brand-light); padding-bottom: 10px; }

/* Forms */
.form-group { margin-bottom: 15px; }
label { display: block; margin-bottom: 5px; font-weight: 500; font-size: 0.9rem; }
input, select { width: 100%; padding: 8px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px; }
.checkbox-group { display: flex; gap: 15px; align-items: center; flex-wrap: wrap; }
.checkbox-group label { font-weight: normal; margin: 0; cursor: pointer; }
.checkbox-group input[type="checkbox"] { width: auto; margin-right: 5px; }

/* Buttons */
.btn { padding: 10px 15px; border: none; border-radius: 4px; cursor: pointer; font-size: 14px; transition: 0.2s; }
.btn-green { background-color: var(--brand-green); color: white; }
.btn-green:hover { background-color: #219150; }
.btn-outline { background: white; border: 1px solid #ccc; color: #333; }
.btn-outline:hover { background: #f9f9f9; }

/* Toolbar */
.toolbar { margin-bottom: 20px; display: flex; justify-content: flex-end; }
.dropdown { position: relative; display: inline-block; }
.dropdown-content { display: none; position: absolute; right: 0; background-color: #f9f9f9; min-width: 160px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); z-index: 1; }
.dropdown:hover .dropdown-content { display: block; }
.dropdown-content a { color: black; padding: 12px 16px; text-decoration: none; display: block; }
.dropdown-content a:hover {background-color: #f1f1f1}

/* Table */
table { width: 100%; border-collapse: collapse; margin-top: 10px; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid #eee; }
th { background-color: #f8f9fa; font-weight: 600; color: #555; }
tr:hover { background-color: #f1f1f1; }
.badge { padding: 4px 8px; border-radius: 12px; font-size: 0.8rem; font-weight: bold; color: white; }
.type-MI { background-color: #e67e22; }
.type-CE { background-color: #3498db; }
.type-PG { background-color: #9b59b6; }
.action-btn { background: none; border: none; cursor: pointer; font-size: 1.1rem; margin-right: 5px; color: #7f8c8d; }
.action-btn:hover { color: var(--brand-dark); }
.btn-delete:hover { color: #c0392b; }
.btn-price:hover { color: var(--brand-green); }

/* --- MODAL (Popup) --- */
.modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    overflow-y: auto;
    background-color: rgba(0,0,0,0.5);
    align-items: flex-start; justify-content: center;
    padding: 40px 0;
}
.modal-content {
    background-color: #fff;
    margin: auto;
    padding: 30px;
    border-radius: 12px;
    width: 500px;
    max-width: 90%;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}
.close { position: absolute; right: 20px; top: 15px; font-size: 28px; font-weight: bold; color: #aaa; cursor: pointer; }
.close:hover { color: #c0392b; }
body.modal-open { overflow: hidden; }
