:root {
    --sidebar-bg: #000000;
    --sidebar-text: #ffffff;
    --bg-color: #f3f4f6;
    --white: #ffffff;
    --primary: #1E3A8A; /* Blue */
    --primary-hover: #172554;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --danger: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

/* =========================
   UTILITIES
   ========================= */
.hidden { display: none !important; }
.btn-block { width: 100%; }
.error-msg { color: var(--danger); margin-top: 10px; font-size: 0.9rem; }

/* =========================
   AUTH SCREEN
   ========================= */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: #f9fafb;
}

.auth-card {
    background: var(--white);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.auth-card h2 { text-align: center; margin-bottom: 1.5rem; }

/* =========================
   DASHBOARD LAYOUT
   ========================= */
.dashboard-layout {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    flex-shrink: 0;
}

.brand h3 {
    font-size: 1.2rem;
    letter-spacing: 1px;
    margin-bottom: 2rem;
}
.brand span { color: #60a5fa; }

.nav-links { flex: 1; display: flex; flex-direction: column; gap: 0.5rem; }

.nav-item {
    color: #9ca3af;
    text-decoration: none;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    transition: all 0.2s;
}

.nav-item:hover, .nav-item.active {
    background-color: rgba(255,255,255,0.1);
    color: var(--white);
}

.btn-logout {
    background: transparent;
    border: 1px solid #374151;
    color: #9ca3af;
    padding: 0.75rem;
    width: 100%;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
}
.btn-logout:hover { border-color: var(--danger); color: var(--danger); }

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

/* =========================
   FORMS & BUTTONS
   ========================= */
.btn-primary {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}
.btn-primary:hover { background-color: var(--primary-hover); }

.form-group { margin-bottom: 1.25rem; }
.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }

label { display: block; margin-bottom: 0.5rem; font-weight: 500; font-size: 0.9rem; }
input[type="text"], input[type="email"], input[type="password"], 
textarea, select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
}

/* =========================
   DASHBOARD HOME
   ========================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.stat-number { font-size: 2rem; font-weight: 700; color: var(--primary); margin-top: 0.5rem; }

/* =========================
   PROJECT CARDS
   ========================= */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.project-card {
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}
.project-card:hover { transform: translateY(-3px); }

.card-img {
    height: 180px;
    width: 100%;
    object-fit: cover;
    background-color: #e5e7eb;
}

.card-body { padding: 1rem; }
.card-title { font-weight: 600; margin-bottom: 0.5rem; }
.card-meta { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1rem; }

.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-published { background: #d1fae5; color: #065f46; }
.badge-draft { background: #f3f4f6; color: #374151; }

.card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
.btn-danger { background-color: var(--danger); color: white; border: none; border-radius: 4px; cursor: pointer; }

/* =========================
   CATEGORY TREE
   ========================= */
.category-tree-container {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 8px;
}

.cat-item {
    margin-left: 1.5rem;
    border-left: 1px solid var(--border);
    padding-left: 1rem;
    margin-top: 1rem;
}
.cat-item:first-child { margin-left: 0; border-left: none; }

.cat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: #f9fafb;
    border-radius: 4px;
}
.cat-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    margin-left: 0.5rem;
    color: var(--primary);
}
.cat-actions button.delete { color: var(--danger); }

/* =========================
   MODAL
   ========================= */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.modal-content {
    background: var(--white);
    padding: 2rem;
    border-radius: 8px;
    width: 100%;
    max-width: 500px;
    position: relative;
}
.close-modal {
    position: absolute;
    top: 1rem; right: 1.5rem;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-layout { flex-direction: column; height: auto; overflow: visible; }
    .sidebar { width: 100%; height: auto; padding: 1rem; }
    .nav-links { flex-direction: row; overflow-x: auto; }
    .main-content { padding: 1rem; }
}