:root {
    --primary: #5e72e4;
    --primary-dark: #324cdd;
    --secondary: #8392ab;
    --success: #2dce89;
    --info: #11cdef;
    --warning: #fb6340;
    --danger: #f5365c;
    --dark: #1a2035;
    --sidebar-bg: #1a2035;
    --sidebar-hover: #2d3561;
    --sidebar-text: #a0aec0;
    --sidebar-active: #5e72e4;
    --navbar-bg: #ffffff;
    --body-bg: #f8f9fe;
    --card-shadow: 0 0 2rem 0 rgba(0,0,0,.05);
    --border-color: #e9ecef;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

body {
    font-family: var(--font-family);
    background: var(--body-bg);
    color: #525f7f;
    font-size: .875rem;
    overflow-x: hidden;
}

.app-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    transition: width .2s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar.collapsed { width: 70px; }

.sidebar-header {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,.05);
    min-height: 65px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: #fff;
    text-decoration: none;
}

.sidebar-logo i { font-size: 1.5rem; color: var(--primary); }

.sidebar-brand { font-size: 1.1rem; font-weight: 700; letter-spacing: .5px; }

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    padding: .25rem;
    font-size: 1.1rem;
}

.sidebar-divider { height: 1px; background: rgba(255,255,255,.05); margin: 0; }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: .5rem 0;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

.nav-list { list-style: none; padding: 0; margin: 0; }

.nav-item { margin: 2px 8px; }

.nav-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 8px;
    transition: all .15s ease;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: .875rem;
}

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

.nav-item.active > .nav-link,
.nav-item.active > .nav-toggle {
    background: rgba(94, 114, 228, .15);
    color: var(--sidebar-active);
}

.nav-icon { font-size: 1.1rem; width: 20px; text-align: center; flex-shrink: 0; }

.nav-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-arrow { margin-left: auto; font-size: .75rem; transition: transform .2s; }
.nav-parent.expanded .nav-arrow { transform: rotate(90deg); }

.nav-submenu {
    list-style: none;
    padding: 0;
    margin: 2px 0 2px 36px;
    max-height: 0;
    overflow: hidden;
    transition: max-height .2s ease;
}

.nav-submenu.show { max-height: 500px; }

.nav-submenu .nav-link { padding: .5rem 1rem; font-size: .825rem; }

/* Main Wrapper */
.main-wrapper {
    flex: 1;
    margin-left: 260px;
    transition: margin-left .2s ease;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.sidebar.collapsed ~ .main-wrapper,
.app-layout.sidebar-collapsed .main-wrapper { margin-left: 70px; }

/* Navbar */
.navbar-main {
    background: var(--navbar-bg);
    padding: 0 1.5rem;
    height: 65px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 999;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

.navbar-left { display: flex; align-items: center; gap: 1rem; }

.navbar-toggler {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--dark);
    cursor: pointer;
    padding: .25rem;
    display: none;
}

.breadcrumb-nav { display: flex; align-items: center; gap: .5rem; font-size: .875rem; }

.breadcrumb-link {
    color: var(--primary);
    text-decoration: none;
}

.breadcrumb-link:hover { text-decoration: underline; }

.breadcrumb-separator { color: var(--secondary); margin: 0 .25rem; }

.breadcrumb-current { color: var(--dark); font-weight: 600; }

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

.notification-wrapper, .user-dropdown-wrapper { position: relative; }

.notification-btn, .user-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: .5rem;
    border-radius: 8px;
    transition: background .15s;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.notification-btn:hover, .user-btn:hover { background: var(--body-bg); }

.notification-btn { font-size: 1.2rem; color: var(--secondary); position: relative; }

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger);
    color: #fff;
    font-size: .65rem;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--info));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .875rem;
}

.user-info { display: flex; flex-direction: column; text-align: left; }

.user-name { font-size: .825rem; font-weight: 600; color: var(--dark); }
.user-role { font-size: .7rem; color: var(--secondary); }
.user-arrow { font-size: .75rem; color: var(--secondary); }

/* Dropdowns */
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,.15);
    min-width: 220px;
    z-index: 1001;
    padding: .5rem;
    display: none;
    margin-top: .5rem;
}

.dropdown-menu.show { display: block; }

.dropdown-header {
    padding: .75rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.dropdown-header h6 { margin: 0; font-size: .875rem; color: var(--dark); }

.user-avatar-lg {
    width: 48px; height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--info));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 auto .5rem;
}

.user-meta strong { display: block; font-size: .875rem; color: var(--dark); }
.user-meta small { color: var(--secondary); }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem .75rem;
    color: var(--dark);
    text-decoration: none;
    border-radius: 8px;
    border: none;
    background: none;
    width: 100%;
    cursor: pointer;
    font-size: .825rem;
    transition: background .15s;
}

.dropdown-item:hover { background: var(--body-bg); }
.dropdown-item.text-danger { color: var(--danger); }
.dropdown-item i { font-size: 1rem; width: 18px; }

.dropdown-divider { height: 1px; background: var(--border-color); margin: .25rem 0; }

.dropdown-footer { padding: .5rem .75rem; text-align: center; border-top: 1px solid var(--border-color); }

.dropdown-footer .btn-link { font-size: .8rem; color: var(--primary); text-decoration: none; }
.dropdown-empty { padding: 1.5rem; text-align: center; color: var(--secondary); font-size: .8rem; }

.notification-dropdown { min-width: 300px; }
.notification-item {
    display: flex;
    gap: .75rem;
    padding: .75rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
}

.notification-item:hover { background: var(--body-bg); }
.notification-item:last-child { border-bottom: none; }
.notification-item i { font-size: 1.1rem; margin-top: 2px; }

.notification-content p { margin: 0; font-size: .825rem; color: var(--dark); }
.notification-content small { color: var(--secondary); font-size: .7rem; }

/* Main Content */
.main-content {
    flex: 1;
    padding: 1.5rem;
}

/* Footer */
.main-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .8rem;
    color: var(--secondary);
    background: #fff;
}

/* Cards */
.card { border-radius: 10px; border: none; box-shadow: var(--card-shadow); margin-bottom: 1.5rem; }
.card-header {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    border-radius: 10px 10px 0 0 !important;
}

.card-body { padding: 1.25rem; }

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

.stat-card {
    border-radius: 12px;
    border: none;
    overflow: hidden;
    transition: transform .15s, box-shadow .15s;
}

.stat-card:hover { transform: translateY(-3px); box-shadow: 0 7px 14px rgba(0,0,0,.1); }

/* Buttons */
.btn { border-radius: 8px; font-size: .875rem; padding: .5rem 1rem; font-weight: 500; transition: all .15s; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-success { background: var(--success); border-color: var(--success); }
.btn-info { background: var(--info); border-color: var(--info); }
.btn-warning { background: var(--warning); border-color: var(--warning); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-sm { padding: .35rem .7rem; font-size: .8rem; }
.btn-icon { padding: .4rem; line-height: 1; }

/* Tables */
.table { margin-bottom: 0; font-size: .85rem; }
.table th { font-weight: 600; color: var(--dark); border-top: none; white-space: nowrap; }
.table td { vertical-align: middle; }
.table-hover tbody tr:hover { background: rgba(94,114,228,.03); }

/* Forms */
.form-label { font-size: .825rem; font-weight: 500; color: var(--dark); margin-bottom: .35rem; }
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: .5rem .75rem;
    font-size: .875rem;
    transition: border-color .15s, box-shadow .15s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(94,114,228,.1);
}

.form-floating > .form-control { padding: 1rem .75rem; }
.form-floating > label { padding: 1rem .75rem; font-size: .85rem; }

/* Badges */
.badge { padding: .35em .65em; font-weight: 500; font-size: .75rem; border-radius: 6px; }

/* Alerts */
.alert { border: none; border-radius: 10px; font-size: .875rem; }

/* Modals */
.modal-content { border: none; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal-header { border-bottom: 1px solid var(--border-color); padding: 1rem 1.25rem; }
.modal-footer { border-top: 1px solid var(--border-color); padding: 1rem 1.25rem; }

/* Pagination */
.pagination { margin-bottom: 0; }
.page-link {
    border: none;
    padding: .4rem .75rem;
    font-size: .85rem;
    color: var(--secondary);
    border-radius: 8px !important;
    margin: 0 2px;
}

.page-item.active .page-link { background: var(--primary); color: #fff; }
.page-link:hover { background: var(--body-bg); color: var(--dark); }

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner { width: 40px; height: 40px; border: 3px solid var(--border-color); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

/* Toast Notifications */
.toast-container { position: fixed; top: 80px; right: 20px; z-index: 9999; }

.toast-message {
    padding: .75rem 1.25rem;
    border-radius: 10px;
    margin-bottom: .5rem;
    box-shadow: 0 5px 20px rgba(0,0,0,.15);
    display: flex;
    align-items: center;
    gap: .75rem;
    animation: slideIn .3s ease;
    font-size: .875rem;
}

.toast-message.success { background: var(--success); color: #fff; }
.toast-message.error { background: var(--danger); color: #fff; }
.toast-message.warning { background: var(--warning); color: #fff; }
.toast-message.info { background: var(--info); color: #fff; }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a2035 0%, #2d3561 50%, #5e72e4 100%);
}

.login-card { max-width: 420px; width: 100%; margin: 1rem; }
.login-card .card { border-radius: 15px; overflow: hidden; }

.login-icon {
    width: 72px; height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--info));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.login-icon i { font-size: 2rem; color: #fff; }

/* Empty State */
.empty-state { padding: 3rem 1rem; text-align: center; }
.empty-state i { font-size: 3rem; color: var(--secondary); margin-bottom: 1rem; display: block; }
.empty-state h5 { color: var(--dark); margin-bottom: .5rem; }
.empty-state p { color: var(--secondary); margin-bottom: 1.5rem; }

/* Chart */
.chart-container { position: relative; height: 280px; width: 100%; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); width: 260px !important; }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-wrapper, .sidebar.collapsed ~ .main-wrapper { margin-left: 0 !important; }
    .navbar-toggler { display: block; }
    .user-info { display: none; }
    .main-content { padding: 1rem; }
}

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

.bg-primary-soft { background: rgba(94,114,228,.1); }
.bg-success-soft { background: rgba(45,206,137,.1); }
.bg-warning-soft { background: rgba(251,99,64,.1); }
.bg-danger-soft { background: rgba(245,54,92,.1); }
.bg-info-soft { background: rgba(17,205,239,.1); }

.cursor-pointer { cursor: pointer; }
.min-w-0 { min-width: 0; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: 1rem; }

/* Search */
.search-box { position: relative; }
.search-box .form-control { padding-right: 2.5rem; }
.search-box .search-icon {
    position: absolute;
    right: .75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary);
}
