/* ============================================================
   Enterprise Admin Dashboard - Custom Design System
   ============================================================ */

/* CSS Variables */
:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --header-height: 60px;
    --primary-color: #4e73df;
    --secondary-color: #858796;
    --success-color: #1cc88a;
    --info-color: #36b9cc;
    --warning-color: #f6c23e;
    --danger-color: #e74a3b;
    --light-color: #f8f9fc;
    --dark-color: #5a5c69;
    --sidebar-bg: #2c3e50;
    --sidebar-hover: #34495e;
    --sidebar-active: #4e73df;
    --border-color: #e3e6f0;
    --card-border-radius: 8px;
    --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    color: #333;
    background-color: #f8f9fc;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: #fff;
    z-index: 1000;
    transition: all 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .sidebar-brand span,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .submenu,
.sidebar.collapsed .sidebar-footer {
    display: none;
}

.sidebar-header {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-size: 18px;
    font-weight: 600;
}

.sidebar-brand i {
    font-size: 24px;
    color: var(--sidebar-active);
}

.sidebar-nav {
    list-style: none;
    padding: 10px 0;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.2s;
    font-size: 14px;
}

.nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.nav-item.active > .nav-link {
    background: var(--sidebar-active);
    color: #fff;
}

.nav-link i:first-child {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.submenu-arrow {
    margin-left: auto;
    font-size: 12px;
    transition: transform 0.3s;
}

.nav-item.has-submenu.open .submenu-arrow {
    transform: rotate(180deg);
}

.submenu {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0, 0, 0, 0.15);
}

.nav-item.has-submenu.open .submenu {
    max-height: 500px;
}

.submenu li a {
    display: block;
    padding: 10px 20px 10px 52px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    transition: all 0.2s;
}

.submenu li a:hover,
.submenu li a.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    position: absolute;
    bottom: 0;
    width: 100%;
}

/* Sidebar Overlay (Mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed + .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* ============================================================
   HEADER
   ============================================================ */
.top-header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.sidebar-toggle {
    color: var(--dark-color);
    font-size: 18px;
    padding: 5px;
}

.page-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--dark-color);
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-search {
    width: 250px;
}

.header-btn {
    color: var(--dark-color);
    font-size: 18px;
    position: relative;
    padding: 8px;
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 10px;
}

.notification-dropdown {
    width: 320px;
    max-height: 400px;
    overflow-y: auto;
}

.notification-list {
    max-height: 300px;
    overflow-y: auto;
}

/* ============================================================
   BREADCRUMBS
   ============================================================ */
.breadcrumb-nav {
    padding: 10px 20px;
    background: #fff;
    border-bottom: 1px solid var(--border-color);
}

.breadcrumb {
    margin: 0;
    font-size: 13px;
}

.breadcrumb-item a {
    color: var(--primary-color);
}

.breadcrumb-item.active {
    color: var(--secondary-color);
}

/* ============================================================
   CONTENT AREA
   ============================================================ */
.content-area {
    padding: 20px;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    border: none;
    border-radius: var(--card-border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 20px;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 15px 20px;
    font-weight: 600;
    color: var(--dark-color);
}

.card-body {
    padding: 20px;
}

/* KPI Cards */
.kpi-card {
    background: #fff;
    border-radius: var(--card-border-radius);
    box-shadow: var(--box-shadow);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s;
}

.kpi-card:hover {
    transform: translateY(-2px);
}

.kpi-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
}

.kpi-icon.primary { background: var(--primary-color); }
.kpi-icon.success { background: var(--success-color); }
.kpi-icon.info { background: var(--info-color); }
.kpi-icon.warning { background: var(--warning-color); }
.kpi-icon.danger { background: var(--danger-color); }

.kpi-info h3 {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    color: var(--dark-color);
}

.kpi-info p {
    margin: 0;
    font-size: 13px;
    color: var(--secondary-color);
}

/* ============================================================
   TABLES
   ============================================================ */
.table-container {
    background: #fff;
    border-radius: var(--card-border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
}

.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.table-title {
    font-weight: 600;
    color: var(--dark-color);
}

.table-actions {
    display: flex;
    gap: 10px;
}

.table {
    margin: 0;
}

.table th {
    background: #f8f9fc;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    color: var(--dark-color);
    border-bottom: 2px solid var(--border-color);
    padding: 12px 15px;
}

.table td {
    padding: 12px 15px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:hover {
    background: #f8f9fc;
}

/* Status Badges */
.badge-status {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-active { background: #d4edda; color: #155724; }
.badge-inactive { background: #f8d7da; color: #721c24; }
.badge-pending { background: #fff3cd; color: #856404; }
.badge-completed { background: #d1ecf1; color: #0c5460; }
.badge-cancelled { background: #f5c6cb; color: #721c24; }

/* Action Buttons */
.action-btns {
    display: flex;
    gap: 5px;
}

.action-btn {
    width: 30px;
    height: 30px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn.view { background: #e3f2fd; color: #1976d2; }
.action-btn.edit { background: #fff3e0; color: #f57c00; }
.action-btn.delete { background: #ffebee; color: #d32f2f; }

.action-btn:hover {
    transform: scale(1.1);
}

/* ============================================================
   FORMS
   ============================================================ */
.form-label {
    font-weight: 500;
    color: var(--dark-color);
    margin-bottom: 5px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.15);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: #3a5fc9;
    border-color: #3a5fc9;
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-header {
    background: #f8f9fc;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-weight: 600;
    color: var(--dark-color);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar-overlay.show {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .header-search {
        display: none;
    }
}

@media (max-width: 768px) {
    .page-title {
        font-size: 16px;
    }

    .kpi-card {
        padding: 15px;
    }

    .kpi-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .kpi-info h3 {
        font-size: 20px;
    }

    .table-actions {
        flex-wrap: wrap;
    }
}

@media (max-width: 576px) {
    .content-area {
        padding: 10px;
    }

    .top-header {
        padding: 0 10px;
    }

    .header-right {
        gap: 8px;
    }
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.text-primary { color: var(--primary-color) !important; }
.text-success { color: var(--success-color) !important; }
.text-info { color: var(--info-color) !important; }
.text-warning { color: var(--warning-color) !important; }
.text-danger { color: var(--danger-color) !important; }

.bg-primary { background-color: var(--primary-color) !important; }
.bg-success { background-color: var(--success-color) !important; }
.bg-info { background-color: var(--info-color) !important; }
.bg-warning { background-color: var(--warning-color) !important; }
.bg-danger { background-color: var(--danger-color) !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 5px !important; }
.mb-2 { margin-bottom: 10px !important; }
.mb-3 { margin-bottom: 15px !important; }
.mb-4 { margin-bottom: 20px !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 5px !important; }
.mt-2 { margin-top: 10px !important; }
.mt-3 { margin-top: 15px !important; }
.mt-4 { margin-top: 20px !important; }

.d-flex { display: flex !important; }
.justify-content-between { justify-content: space-between !important; }
.align-items-center { align-items-center !important; }
.gap-2 { gap: 10px !important; }
.gap-3 { gap: 15px !important; }

.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }

.text-center { text-align: center !important; }
.text-end { text-align: right !important; }
.text-start { text-align: left !important; }

.fw-bold { font-weight: 700 !important; }
.fw-semibold { font-weight: 600 !important; }
.fw-medium { font-weight: 500 !important; }

.small { font-size: 12px; }
.text-muted { color: var(--secondary-color) !important; }
