@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700&display=swap');

:root {
    --bg-main: #0B1120;
    --bg-sidebar: #111827;
    --bg-card: #1E293B;
    --bg-hover: #374151;
    --primary-blue: #2563EB;
    --primary-blue-hover: #1D4ED8;
    --text-main: #F9FAFB;
    --text-muted: #9CA3AF;
    --border-color: #374151;
    --success-color: #10B981;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    
    --sidebar-width: 260px;
    --header-height: 70px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Typography Utilities */
h1, h2, h3, h4, h5, h6 { font-weight: 700; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success-color); }
.text-danger { color: var(--danger-color); }
.text-warning { color: var(--warning-color); }
.text-primary { color: var(--primary-blue); }

.fw-500 { font-weight: 500; }
.fw-700 { font-weight: 700; }
.fs-sm { font-size: 0.875rem; }
.fs-lg { font-size: 1.25rem; }
.fs-xl { font-size: 1.5rem; }

/* Layout */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    height: 100vh;
    position: fixed;
    right: 0;
    top: 0;
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 1000;
}

.main-content {
    flex: 1;
    margin-right: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-right 0.3s ease;
}

/* Sidebar Components */
.sidebar-logo {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
    color: white;
    text-decoration: none;
    gap: 0.5rem;
}
.sidebar-logo img {
    height: 30px;
}
.sidebar-logo .brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.sidebar-logo .brand-text span:last-child {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    font-weight: 500;
}

.nav-link:hover {
    background-color: var(--bg-hover);
    color: var(--text-main);
}

.nav-link.active {
    background-color: var(--primary-blue);
    color: white;
}

.nav-link i {
    font-size: 1.25rem;
}

.sidebar-footer {
    padding: 1.5rem 1rem;
    border-top: 1px solid var(--border-color);
}

.dark-mode-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    width: 100%;
    text-align: right;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s;
}
.dark-mode-toggle:hover {
    background-color: var(--bg-hover);
    color: var(--text-main);
}

/* Header */
.top-header {
    height: var(--header-height);
    background-color: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 900;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.menu-toggle {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
    display: none;
}

.search-bar {
    position: relative;
    width: 300px;
}
.search-bar input {
    width: 100%;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    border-radius: 0.5rem;
    outline: none;
    font-family: inherit;
}
.search-bar input:focus {
    border-color: var(--primary-blue);
}
.search-bar i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    transition: color 0.2s;
    position: relative;
}
.icon-btn:hover {
    color: var(--text-main);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}
.user-profile img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}
.user-profile span {
    font-weight: 500;
}

/* Main Container */
.container {
    padding: 2rem;
    flex: 1;
}

.page-title {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Cards */
.card {
    background-color: var(--bg-card);
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.card-title {
    font-size: 1.125rem;
    font-weight: 700;
}

/* Grid Layouts */
.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

/* Stats Card Specific */
.stat-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    min-height: 120px;
}
.stat-card .title {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}
.stat-card .value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}
.stat-card .desc {
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
}
th {
    text-align: right;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    border-bottom: 1px solid var(--border-color);
}
td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}
tr:last-child td {
    border-bottom: none;
}
.action-btn {
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--primary-blue);
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.2s;
}
.action-btn:hover {
    background-color: var(--primary-blue);
    color: white;
}
.more-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.25rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}
.badge-success { background-color: rgba(16, 185, 129, 0.1); color: var(--success-color); }
.badge-warning { background-color: rgba(245, 158, 11, 0.1); color: var(--warning-color); }
.badge-danger { background-color: rgba(239, 68, 68, 0.1); color: var(--danger-color); }

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}
.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}
.form-control, .form-select {
    width: 100%;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary-blue);
}
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
}
.btn-primary {
    background-color: var(--primary-blue);
    color: white;
}
.btn-primary:hover {
    background-color: var(--primary-blue-hover);
}
.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}
.btn-outline:hover {
    background-color: var(--bg-hover);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
}
.page-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}
.page-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-main);
}
.page-btn.active {
    background-color: var(--primary-blue);
    color: white;
}

/* Breadcrumbs */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}
.breadcrumb a {
    color: var(--primary-blue);
    text-decoration: none;
}
.breadcrumb a:hover {
    text-decoration: underline;
}

/* Utilities */
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }

/* Responsive */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-right: 0;
    }
    .menu-toggle {
        display: block;
    }
    .grid-2 { grid-template-columns: 1fr; }
    .grid-4 { grid-template-columns: 1fr; }
    .search-bar { display: none; } /* Hide search on mobile for simplicity, or make it a toggle */
}
