:root {
    --bg-main: #0f172a;      /* Deep slate blue/black */
    --bg-panel: #1e293b;     /* Slightly lighter for cards */
    --accent: #38bdf8;       /* Bright tech blue */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --error: #ef4444;        /* For the login page */
}

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

/* ----------------------------------
   BASE STYLES 
----------------------------------- */
body {
    background-color: var(--bg-main);
    color: var(--text-main);
    /* Removed the global flex and hidden overflow so pages can scroll naturally */
}

/* ----------------------------------
   PUBLIC FRONTEND (renderer.php)
----------------------------------- */
.navbar {
    background-color: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    padding: 15px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Scoped to .navbar to prevent conflict with the admin sidebar */
.navbar .brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
    letter-spacing: 1px;
    text-transform: uppercase;
    border: none;
    padding: 0;
    margin: 0;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    margin-left: 25px;
    font-weight: 600;
    transition: color 0.2s;
    font-size: 0.95rem;
}

.nav-links a:hover {
    color: var(--text-main);
}

.container {
    padding: 40px;
    max-width: 1400px;
    margin: 0 auto;
}

.widget-header {
    color: var(--accent);
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.2rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
    font-weight: 600;
}

.widget-text {
    color: var(--text-muted);
    line-height: 1.6;
}

/* ----------------------------------
   ADMIN DASHBOARD LAYOUT
----------------------------------- */
/* The flex rules are now safely contained in this wrapper */
.admin-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
    width: 100%;
}

.sidebar {
    width: 260px;
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
}

.sidebar .brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent);
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.nav-link {
    padding: 12px 20px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s ease;
    display: block;
}

.nav-link:hover, .nav-link.active {
    background-color: rgba(56, 189, 248, 0.1);
    color: var(--accent);
    border-left: 3px solid var(--accent);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.topbar {
    height: 60px;
    background-color: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
}

.page-title {
    font-size: 1.2rem;
    font-weight: 600;
}

/* ----------------------------------
   GRIDSTACK CORE
----------------------------------- */
.grid-container {
    padding: 30px;
}

.grid-stack-item-content {
    background-color: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    color: var(--text-main);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    overflow-y: auto;
}

/* Custom Scrollbars */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-main); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }