/* ============================================================================
   RESET
   ============================================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-600: #4b5563;
    --gray-900: #111827;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
}

/* ============================================================================
   HEADER
   ============================================================================ */
.header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    height: 64px;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--primary);
    flex-shrink: 0;
}

.logo-icon {
    font-size: 1.5rem;
}

.header-nav {
    display: flex;
    gap: 0.5rem;
    flex: 1;
}

.nav-item {
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: var(--gray-600);
    font-weight: 500;
    font-size: 0.875rem;
    border-radius: 6px;
    transition: all 0.2s;
    position: relative;
}

.nav-item:hover {
    background: var(--gray-50);
    color: var(--gray-900);
}

.nav-item.active {
    background: var(--primary);
    color: white;
}

.badge-nav {
    background: var(--danger);
    color: white;
    font-size: 0.688rem;
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    margin-left: 0.5rem;
    font-weight: 700;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.user-info {
    text-align: right;
}

.user-name {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-900);
}

.user-role {
    display: block;
    font-size: 0.75rem;
    color: var(--gray-600);
}

.btn-logout {
    background: var(--danger);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: #dc2626;
}

/* ============================================================================
   MAIN CONTAINER
   ============================================================================ */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* ============================================================================
   PAGE HEADER
   ============================================================================ */
.page-header {
    margin-bottom: 2rem;
}

.page-header h2 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: var(--gray-600);
    font-size: 0.875rem;
}

/* ============================================================================
   GRID SYSTEM
   ============================================================================ */
.row {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.row.cols-2 { grid-template-columns: repeat(2, 1fr); }
.row.cols-3 { grid-template-columns: repeat(3, 1fr); }
.row.cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
    .row.cols-4 { grid-template-columns: repeat(2, 1fr); }
    .row.cols-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .row { grid-template-columns: 1fr !important; }
    .header-nav { display: none; }
}

/* ============================================================================
   STAT CARDS
   ============================================================================ */
.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-left: 4px solid var(--primary);
}

.stat-card.success { border-left-color: var(--success); }
.stat-card.danger { border-left-color: var(--danger); }
.stat-card.warning { border-left-color: var(--warning); }
.stat-card.info { border-left-color: var(--info); }

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.stat-title {
    font-size: 0.75rem;
    color: var(--gray-600);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.stat-icon {
    font-size: 1.5rem;
    opacity: 0.3;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-600);
}

.stat-trend {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    margin-top: 0.5rem;
    font-weight: 600;
}

.stat-trend.up {
    background: #dcfce7;
    color: #16a34a;
}

.stat-trend.down {
    background: #fee2e2;
    color: #dc2626;
}

/* ============================================================================
   CARDS
   ============================================================================ */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.card-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
}

.card-body {
    padding: 1.5rem;
}

.card-body.p-0 {
    padding: 0;
}

/* ============================================================================
   ALERTS
   ============================================================================ */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    border-left: 4px solid;
}

.alert-success {
    background: #dcfce7;
    border-left-color: var(--success);
    color: #166534;
}

.alert-danger {
    background: #fee2e2;
    border-left-color: var(--danger);
    color: #991b1b;
}

.alert-warning {
    background: #fef3c7;
    border-left-color: var(--warning);
    color: #92400e;
}

.alert-info {
    background: #e0f2fe;
    border-left-color: var(--info);
    color: #075985;
}

/* ============================================================================
   TABLES
   ============================================================================ */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead th {
    background: var(--gray-50);
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gray-600);
    text-transform: uppercase;
    border-bottom: 2px solid var(--gray-200);
}

.table tbody td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.875rem;
}

.table tbody tr:hover {
    background: var(--gray-50);
}

.table-sm td,
.table-sm th {
    padding: 0.5rem 1rem;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */
.btn {
    padding: 0.625rem 1.25rem;
    border-radius: 6px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-size: 0.875rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-info {
    background: var(--info);
    color: white;
}

.btn-secondary {
    background: var(--gray-600);
    color: white;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.813rem;
}

/* ============================================================================
   BADGES
   ============================================================================ */
.badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #e0f2fe; color: #075985; }
.badge-secondary { background: var(--gray-200); color: var(--gray-600); }

/* ============================================================================
   QUICK ACTIONS
   ============================================================================ */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.quick-action-btn {
    padding: 1.5rem 1rem;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    text-align: center;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.quick-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.quick-action-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

/* ============================================================================
   UTILITIES
   ============================================================================ */
.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-2 { gap: 0.5rem; }
.text-center { text-align: center; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
