:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #10b981;
    --secondary-hover: #059669;
    --accent: #f59e0b;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --dark: #1f2937;
    --light: #f3f4f6;
    --white: #ffffff;
    --border: #e5e7eb;
    --text-main: #111827;
    --text-muted: #6b7280;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-sm: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 1rem;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--light);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #1e1e2f 0%, #2a2a40 100%);
    color: #cbd5e1;
    border-right: none;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    box-shadow: 4px 0 15px rgba(0,0,0,0.05);
    transition: var(--transition);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.025em;
}

.sidebar-nav {
    padding: 1.25rem 0.75rem;
    flex: 1;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: #94a3b8;
    text-decoration: none;
    border-radius: var(--radius-md);
    margin-bottom: 0.35rem;
    font-weight: 500;
    transition: var(--transition);
}

.nav-item i {
    margin-right: 0.75rem;
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

.nav-item:hover, .nav-item.active {
    background: linear-gradient(90deg, rgba(79, 70, 229, 0.8) 0%, rgba(79, 70, 229, 0.6) 100%);
    color: #ffffff;
    transform: translateX(4px);
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.2);
}

.has-submenu {
    cursor: pointer;
    justify-content: space-between;
}

.has-submenu i.chevron {
    font-size: 0.875rem;
    transition: var(--transition);
    width: auto;
    margin-right: 0;
}

.has-submenu.open i.chevron {
    transform: rotate(180deg);
}

.submenu {
    display: none;
    flex-direction: column;
    padding-left: 2.75rem;
    margin-bottom: 0.75rem;
    border-left: 1px solid rgba(255,255,255,0.1);
    margin-left: 1.5rem;
    margin-top: 0.25rem;
}

.submenu.open {
    display: flex;
}

.submenu-item {
    padding: 0.5rem 1rem;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.875rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
    display: block;
    position: relative;
    margin-bottom: 0.15rem;
}

.submenu-item::before {
    content: '';
    position: absolute;
    left: -18px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: transparent;
    transition: var(--transition);
}

.submenu-item:hover, .submenu-item.active {
    color: #ffffff;
    background-color: rgba(255,255,255,0.05);
}

.submenu-item:hover::before, .submenu-item.active::before {
    background-color: #60a5fa;
    box-shadow: 0 0 8px #60a5fa;
}

/* Main Content */
.main-wrapper {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--transition);
}

body.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
}

body.sidebar-collapsed .main-wrapper {
    margin-left: 0;
}

/* Topbar */
.topbar {
    height: 70px;
    background-color: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: var(--shadow-sm);
}

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

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* Content Area */
.content-area {
    padding: 2rem;
    flex: 1;
}

/* Cards */
.card {
    background-color: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--dark);
}

/* Grid Layouts */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Summary Cards */
.summary-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background: linear-gradient(135deg, var(--white) 0%, #f8fafc 100%);
    border-left: 4px solid transparent;
}

.summary-card:nth-child(1) { border-left-color: #3b82f6; }
.summary-card:nth-child(2) { border-left-color: #22c55e; }
.summary-card:nth-child(3) { border-left-color: #f97316; }
.summary-card:nth-child(4) { border-left-color: #ef4444; }

.summary-icon {
    width: 54px;
    height: 54px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.1);
}

.summary-icon.blue { background: linear-gradient(135deg, #eff6ff 0%, #bfdbfe 100%); color: #2563eb; }
.summary-icon.green { background: linear-gradient(135deg, #f0fdf4 0%, #bbf7d0 100%); color: #16a34a; }
.summary-icon.orange { background: linear-gradient(135deg, #fff7ed 0%, #fed7aa 100%); color: #ea580c; }
.summary-icon.red { background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%); color: #dc2626; }

.summary-details h3 {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.summary-details p {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin-top: 0.25rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-secondary {
    background-color: var(--white);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background-color: var(--light);
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background-color: var(--white);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--border);
}

.table th, .table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border: 1px solid var(--border);
    font-size: 0.875rem;
}

.table th {
    background-color: #f1f5f9;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--dark);
    font-weight: 600;
    border-bottom: 2px solid var(--border);
}

.table tbody tr:nth-child(even) {
    background-color: #f8fafc;
}

.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: #e2e8f0;
}

/* Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background-color: #dcfce7; color: #166534; }
.badge-warning { background-color: #fef9c3; color: #854d0e; }
.badge-danger { background-color: #fee2e2; color: #991b1b; }
.badge-primary { background-color: #e0e7ff; color: #3730a3; }

/* Utilities */
.text-right { text-align: right; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* Responsive */
@media (max-width: 1024px) {
    .grid-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .main-wrapper { margin-left: 0; }
    .grid-cols-2 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
    .grid-cols-3 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
    .grid-cols-4 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
}
