:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --topbar-height: 60px;
    --transition: all 0.3s ease;
}

/* Blue Palette (Default) */
[data-palette="blue"], :root {
    --primary: #36517E;
    --primary-dark: #1E293B;
    --primary-light: #ECF1F6;
    --accent: #3B82F6;
    --sidebar-tint: #0B1120;
    --sidebar-tint-mid: #12243D;
    --sidebar-tint-end: #1A3358;
    --bg: #F1F5F9;
    --white: #FFFFFF;
    --dark-text: #1E293B;
    --gray-text: #64748B;
    --light-gray: #E2E8F0;
    --success: #10B981;
    --info: #3B82F6;
    --warning: #F59E0B;
    --danger: #EF4444;
}

/* Purple Palette */
[data-palette="purple"] {
    --primary: #6B46C1;
    --primary-dark: #2D1B69;
    --primary-light: #F3E8FF;
    --accent: #8B5CF6;
    --sidebar-tint: #0E0820;
    --sidebar-tint-mid: #1A1040;
    --sidebar-tint-end: #2A1860;
    --bg: #F8F5FF;
    --dark-text: #1F2937;
    --gray-text: #64748B;
    --light-gray: #E2E8F0;
}

/* Green Palette */
[data-palette="green"] {
    --primary: #15803D;
    --primary-dark: #14532D;
    --primary-light: #ECFDF5;
    --accent: #10B981;
    --sidebar-tint: #051A0C;
    --sidebar-tint-mid: #0B2D16;
    --sidebar-tint-end: #134222;
    --bg: #F0FDF4;
    --dark-text: #1F2937;
    --gray-text: #64748B;
    --light-gray: #E2E8F0;
}

/* Orange Palette */
[data-palette="orange"] {
    --primary: #C2410C;
    --primary-dark: #7C2D12;
    --primary-light: #FFEDD5;
    --accent: #F97316;
    --sidebar-tint: #1C0A02;
    --sidebar-tint-mid: #301406;
    --sidebar-tint-end: #4A200C;
    --bg: #FFF7ED;
    --dark-text: #1F2937;
    --gray-text: #64748B;
    --light-gray: #E2E8F0;
}

/* Red Palette */
[data-palette="red"] {
    --primary: #B91C1C;
    --primary-dark: #7F1D1D;
    --primary-light: #FEE2E2;
    --accent: #EF4444;
    --sidebar-tint: #1A0606;
    --sidebar-tint-mid: #2D0E0E;
    --sidebar-tint-end: #421616;
    --bg: #FEF2F2;
    --dark-text: #1F2937;
    --gray-text: #64748B;
    --light-gray: #E2E8F0;
}

/* Grey Palette */
[data-palette="grey"] {
    --primary: #334155;
    --primary-dark: #1E2937;
    --primary-light: #F1F5F9;
    --accent: #64748B;
    --sidebar-tint: #0C1015;
    --sidebar-tint-mid: #151C24;
    --sidebar-tint-end: #1E2832;
    --bg: #F8FAFC;
    --dark-text: #1E2937;
    --gray-text: #64748B;
    --light-gray: #E2E8F0;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg);
    color: var(--dark-text);
    overflow-x: hidden;
}

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

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg);
}
::-webkit-scrollbar-thumb {
    background: var(--light-gray);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--gray-text);
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--sidebar-tint, #0F172A) 0%, var(--sidebar-tint-mid, #162032) 50%, var(--sidebar-tint-end, #1E293B) 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 1000;
    transition: var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
}

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

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: var(--topbar-height);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #FFFFFF;
    white-space: nowrap;
    transition: var(--transition);
}

.sidebar.collapsed .sidebar-brand h4,
.sidebar.collapsed .sidebar-menu .menu-item span,
.sidebar.collapsed .sidebar-menu .menu-item .arrow,
.sidebar.collapsed .sidebar-submenu {
    display: none;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 5px;
}

.sidebar-toggle:hover {
    color: #FFFFFF;
}

.sidebar-menu {
    padding: 15px 0;
}

.menu-section {
    margin-bottom: 10px;
}

.menu-section-title {
    padding: 8px 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.35);
    white-space: nowrap;
}

.menu-item {
    position: relative;
}

.menu-item > a {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: rgba(255, 255, 255, 0.65);
    transition: var(--transition);
    white-space: nowrap;
}

.menu-item > a:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #FFFFFF;
}

.menu-item > a.active {
    background: rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
    border-right: 3px solid var(--accent);
}

.menu-item > a i {
    font-size: 1.1rem;
    min-width: 24px;
    text-align: center;
    margin-right: 12px;
}

.menu-item > a span {
    font-size: 0.9rem;
}

.menu-item > a .arrow {
    margin-left: auto;
    font-size: 0.7rem;
    transition: var(--transition);
}

.sidebar-submenu {
    list-style: none;
    padding: 0;
    background: rgba(0, 0, 0, 0.2);
    display: none;
}

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

.sidebar-submenu li a {
    display: block;
    padding: 8px 20px 8px 56px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    transition: var(--transition);
}

.sidebar-submenu li a:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.06);
}

/* Main Content */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content {
    margin-left: var(--sidebar-width);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    flex: 1;
}

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

/* Topbar */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--topbar-height);
    background: var(--white);
    padding: 0 24px;
    border-bottom: 1px solid var(--light-gray);
    position: sticky;
    top: 0;
    z-index: 999;
    margin-left: var(--sidebar-width);
    transition: var(--transition);
}

.sidebar.collapsed ~ .topbar {
    margin-left: var(--sidebar-collapsed-width);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-left .menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--dark-text);
    cursor: pointer;
}

.topbar-left .search-box {
    position: relative;
}

.topbar-left .search-box input {
    padding: 8px 16px 8px 36px;
    border: 1px solid var(--light-gray);
    border-radius: 8px;
    background: var(--bg);
    font-size: 0.85rem;
    width: 280px;
    outline: none;
    transition: var(--transition);
}

.topbar-left .search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(54, 81, 126, 0.1);
}

.topbar-left .search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-text);
    font-size: 0.85rem;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-icon {
    position: relative;
    background: none;
    border: none;
    font-size: 1.15rem;
    color: var(--gray-text);
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: var(--transition);
}

.topbar-icon:hover {
    background: var(--bg);
    color: var(--primary);
}

.topbar-icon .badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--danger);
    color: var(--white);
    font-size: 0.6rem;
    padding: 2px 5px;
    border-radius: 10px;
    font-weight: 600;
}

.user-dropdown {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: var(--transition);
}

.user-dropdown:hover {
    background: var(--bg);
}

.user-dropdown img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
}

.user-dropdown .user-info {
    line-height: 1.3;
}

.user-dropdown .user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dark-text);
}

.user-dropdown .user-role {
    font-size: 0.72rem;
    color: var(--gray-text);
}

/* Page Content */
.page-content {
    padding: 24px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--dark-text);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--gray-text);
}

.breadcrumb a {
    color: var(--gray-text);
    transition: var(--transition);
}

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

.breadcrumb .separator {
    color: var(--light-gray);
}

/* Cards */
.card-custom {
    background: var(--white);
    border: 1px solid var(--light-gray);
    border-radius: 12px;
    transition: var(--transition);
    margin-bottom: 20px;
}

.card-custom:last-child {
    margin-bottom: 0;
}

.card-custom:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.card-header-custom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--light-gray);
}

.card-header-custom h5 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark-text);
    margin: 0;
}

.card-body-custom {
    padding: 20px;
}

/* Stats Cards */
.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.stat-icon.primary {
    background: rgba(54, 81, 126, 0.1);
    color: var(--primary);
}

.stat-icon.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.stat-icon.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.stat-icon.danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.stat-icon.info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

.stat-info h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark-text);
    margin-bottom: 2px;
}

.stat-info p {
    font-size: 0.8rem;
    color: var(--gray-text);
    margin: 0;
}

.stat-info .stat-change {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 4px;
}

.stat-change.up {
    color: var(--success);
}

.stat-change.down {
    color: var(--danger);
}

/* Tables */
.table-custom {
    width: 100%;
    border-collapse: collapse;
}

.table-custom thead th {
    background: var(--bg);
    padding: 12px 16px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-text);
    border: none;
    white-space: nowrap;
}

.table-custom tbody td {
    padding: 12px 16px;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--light-gray);
    vertical-align: middle;
}

.table-custom tbody tr:hover {
    background: var(--primary-light);
}

.table-custom tbody tr:last-child td {
    border-bottom: none;
}

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

.table-actions button,
.table-actions a {
    padding: 4px 8px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
}

.btn-action-edit {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

.btn-action-edit:hover {
    background: var(--info);
    color: var(--white);
}

.btn-action-delete {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.btn-action-delete:hover {
    background: var(--danger);
    color: var(--white);
}

.btn-action-view {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.btn-action-view:hover {
    background: var(--success);
    color: var(--white);
}

/* Badges */
.badge-custom {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

.badge-primary {
    background: rgba(54, 81, 126, 0.1);
    color: var(--primary);
}

/* Forms */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dark-text);
    margin-bottom: 6px;
}

.form-group label .required {
    color: var(--danger);
}

.form-control-custom {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--light-gray);
    border-radius: 8px;
    font-size: 0.88rem;
    color: var(--dark-text);
    background: var(--white);
    outline: none;
    transition: var(--transition);
}

.form-control-custom:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(54, 81, 126, 0.1);
}

.form-control-custom::placeholder {
    color: #9CA3AF;
}

textarea.form-control-custom {
    resize: vertical;
    min-height: 100px;
}

select.form-control-custom {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748B' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-check-custom {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.form-check-custom input[type="checkbox"],
.form-check-custom input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.form-hint {
    font-size: 0.75rem;
    color: var(--gray-text);
    margin-top: 4px;
}

.form-error {
    font-size: 0.75rem;
    color: var(--danger);
    margin-top: 4px;
}

.form-control-custom.is-invalid {
    border-color: var(--danger);
}

.form-control-custom.is-valid {
    border-color: var(--success);
}

/* Input Group */
.input-group-custom {
    display: flex;
    align-items: center;
}

.input-group-custom .input-group-text {
    background: var(--bg);
    border: 1px solid var(--light-gray);
    padding: 10px 14px;
    font-size: 0.88rem;
    color: var(--gray-text);
    white-space: nowrap;
}

.input-group-custom .input-group-text:first-child {
    border-right: none;
    border-radius: 8px 0 0 8px;
}

.input-group-custom .form-control-custom {
    border-radius: 0;
}

.input-group-custom .input-group-text:last-child {
    border-left: none;
    border-radius: 0 8px 8px 0;
}

.input-group-custom .form-control-custom:first-child + .input-group-text {
    border-radius: 0 8px 8px 0;
}

/* Buttons */
.btn-custom {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

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

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

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

.btn-success-custom:hover {
    opacity: 0.9;
    color: var(--white);
}

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

.btn-danger-custom:hover {
    opacity: 0.9;
    color: var(--white);
}

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

.btn-warning-custom:hover {
    opacity: 0.9;
    color: var(--white);
}

.btn-outline-custom {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

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

.btn-light-custom {
    background: var(--bg);
    color: var(--dark-text);
}

.btn-light-custom:hover {
    background: var(--light-gray);
}

.btn-sm-custom {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.btn-lg-custom {
    padding: 14px 28px;
    font-size: 1rem;
}

/* Pagination */
.pagination-custom {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-custom button {
    padding: 6px 12px;
    border: 1px solid var(--light-gray);
    background: var(--white);
    color: var(--dark-text);
    border-radius: 6px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: var(--transition);
}

.pagination-custom button:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination-custom button.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.pagination-custom button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Alerts */
.alert-custom {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 8px;
    font-size: 0.88rem;
    margin-bottom: 16px;
}

.alert-custom i {
    font-size: 1.1rem;
}

.alert-custom .alert-close {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    opacity: 0.7;
}

.alert-custom .alert-close:hover {
    opacity: 1;
}

.alert-success-custom {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-danger-custom {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-warning-custom {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.alert-info-custom {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Modals */
.modal-custom .modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.modal-custom .modal-header {
    border-bottom: 1px solid var(--light-gray);
    padding: 16px 20px;
}

.modal-custom .modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark-text);
}

.modal-custom .modal-body {
    padding: 20px;
}

.modal-custom .modal-footer {
    border-top: 1px solid var(--light-gray);
    padding: 12px 20px;
}

.modal-custom .btn-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--gray-text);
    cursor: pointer;
}

/* Tabs */
.tabs-custom {
    display: flex;
    border-bottom: 2px solid var(--light-gray);
    margin-bottom: 20px;
    gap: 0;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--gray-text);
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    color: var(--primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary);
}

.tab-content-custom {
    display: none;
}

.tab-content-custom.active {
    display: block;
}

/* Dropdown */
.dropdown-custom {
    position: relative;
    display: inline-block;
}

.dropdown-menu-custom {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: var(--white);
    border: 1px solid var(--light-gray);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    min-width: 180px;
    z-index: 100;
    padding: 6px 0;
}

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

.dropdown-menu-custom a,
.dropdown-menu-custom button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 16px;
    border: none;
    background: none;
    font-size: 0.85rem;
    color: var(--dark-text);
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
}

.dropdown-menu-custom a:hover,
.dropdown-menu-custom button:hover {
    background: var(--bg);
    color: var(--primary);
}

.dropdown-divider {
    height: 1px;
    background: var(--light-gray);
    margin: 4px 0;
}

/* Avatar */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-sm {
    width: 32px;
    height: 32px;
}

.avatar-lg {
    width: 56px;
    height: 56px;
}

.avatar-xl {
    width: 80px;
    height: 80px;
}

.avatar-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: var(--white);
    font-weight: 600;
    font-size: 0.85rem;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 22px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--light-gray);
    border-radius: 22px;
    transition: var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    bottom: 3px;
    background: var(--white);
    border-radius: 50%;
    transition: var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* Progress Bar */
.progress-custom {
    height: 8px;
    background: var(--light-gray);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-custom {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-bar-primary {
    background: var(--primary);
}

.progress-bar-success {
    background: var(--success);
}

.progress-bar-warning {
    background: var(--warning);
}

.progress-bar-danger {
    background: var(--danger);
}

.progress-bar-info {
    background: var(--info);
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 28px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--light-gray);
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--white);
    box-shadow: 0 0 0 2px var(--primary);
}

.timeline-item.success::before {
    background: var(--success);
    box-shadow: 0 0 0 2px var(--success);
}

.timeline-item.warning::before {
    background: var(--warning);
    box-shadow: 0 0 0 2px var(--warning);
}

.timeline-item.danger::before {
    background: var(--danger);
    box-shadow: 0 0 0 2px var(--danger);
}

.timeline-date {
    font-size: 0.75rem;
    color: var(--gray-text);
    margin-bottom: 4px;
}

.timeline-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--dark-text);
}

.timeline-desc {
    font-size: 0.82rem;
    color: var(--gray-text);
    margin-top: 2px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 24px;
}

.empty-state i {
    font-size: 3rem;
    color: var(--light-gray);
    margin-bottom: 16px;
}

.empty-state h4 {
    font-size: 1.1rem;
    color: var(--dark-text);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.88rem;
    color: var(--gray-text);
    margin-bottom: 20px;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px 24px;
    font-size: 0.82rem;
    color: var(--gray-text);
    border-top: 1px solid var(--light-gray);
    margin-top: auto;
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    padding: 40px 32px;
}

.login-card .login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-card .login-header h3 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--dark-text);
    margin-bottom: 6px;
}

.login-card .login-header p {
    font-size: 0.88rem;
    color: var(--gray-text);
}

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

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

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

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

    .topbar-left .menu-toggle {
        display: block;
    }

    .topbar-left .search-box input {
        width: 200px;
    }

    .sidebar-brand .sidebar-toggle {
        display: none;
    }
}

@media (max-width: 767px) {
    .page-content {
        padding: 16px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar-left .search-box {
        display: none;
    }

    .user-dropdown .user-info {
        display: none;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-info h3 {
        font-size: 1.2rem;
    }

    .page-content > div[style*="grid-template-columns:repeat(4"] {
        grid-template-columns: 1fr 1fr !important;
    }

    .page-content > div[style*="grid-template-columns:2fr 1fr"],
    .page-content > div[style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    .card-header-custom {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .topbar-right {
        gap: 8px;
    }

    .palette-dropdown {
        right: -60px;
        width: 260px;
    }

    .palette-grid {
        grid-template-columns: 1fr;
    }

    .pagination-custom {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Print */
@media print {
    .sidebar, .topbar, .footer {
        display: none !important;
    }

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

    .page-content {
        padding: 0;
    }
}

/* Navbar */
.navbar-custom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--white);
    border: 1px solid var(--light-gray);
    border-radius: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.navbar-custom .navbar-brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar-custom .navbar-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.navbar-custom .nav-link {
    padding: 8px 14px;
    font-size: 0.88rem;
    color: var(--dark-text);
    border-radius: 8px;
    transition: var(--transition);
    cursor: pointer;
}

.navbar-custom .nav-link:hover {
    background: var(--primary-light);
    color: var(--primary);
}

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

.navbar-custom .navbar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--dark-text);
    cursor: pointer;
}

@media (max-width: 767px) {
    .navbar-custom .navbar-toggle { display: block; }
    .navbar-custom .navbar-nav {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 4px;
    }
    .navbar-custom .navbar-nav.show { display: flex; }
    .navbar-custom .nav-link { width: 100%; }
}

/* Accordion */
.accordion-custom {
    border: 1px solid var(--light-gray);
    border-radius: 12px;
    overflow: hidden;
}

.accordion-item-custom {
    border-bottom: 1px solid var(--light-gray);
}

.accordion-item-custom:last-child {
    border-bottom: none;
}

.accordion-header-custom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--white);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--dark-text);
    user-select: none;
}

.accordion-header-custom:hover {
    background: var(--primary-light);
}

.accordion-header-custom .accordion-icon {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
    color: var(--gray-text);
}

.accordion-item-custom.open .accordion-header-custom .accordion-icon {
    transform: rotate(180deg);
}

.accordion-body-custom {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.accordion-body-custom.open {
    max-height: 500px;
}

.accordion-content-custom {
    padding: 0 20px 16px;
    font-size: 0.88rem;
    color: var(--gray-text);
    line-height: 1.6;
}

/* Carousel */
.carousel-custom {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid var(--light-gray);
}

.carousel-inner-custom {
    display: flex;
    transition: transform 0.5s ease;
}

.carousel-slide-custom {
    min-width: 100%;
    padding: 24px 28px;
    background: var(--white);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 240px;
}

.carousel-slide-custom .carousel-quote {
    font-size: 1rem;
    color: var(--dark-text);
    line-height: 1.7;
    font-style: italic;
    margin-bottom: 16px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.carousel-slide-custom .carousel-author {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.carousel-slide-custom .carousel-author img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
}

.carousel-slide-custom .carousel-author-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--dark-text);
}

.carousel-slide-custom .carousel-author-role {
    font-size: 0.78rem;
    color: var(--gray-text);
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--white);
    border: 1px solid var(--light-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--dark-text);
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 2;
}

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

.carousel-btn-prev { left: 8px; }
.carousel-btn-next { right: 8px; }

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 8px;
}

.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--light-gray);
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.carousel-dot.active {
    background: var(--primary);
    width: 24px;
    border-radius: 4px;
}

/* Spinner */
.spinner-custom {
    display: inline-block;
    border: 3px solid var(--light-gray);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
.spinner-md { width: 24px; height: 24px; }
.spinner-lg { width: 40px; height: 40px; border-width: 4px; }

.spinner-primary { border-top-color: var(--primary); }
.spinner-success { border-top-color: var(--success); }
.spinner-danger { border-top-color: var(--danger); }
.spinner-warning { border-top-color: var(--warning); }

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

.spinner-grow-custom {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    animation: spinnerGrow 1s ease-in-out infinite;
}

.spinner-grow-custom:nth-child(2) { animation-delay: 0.2s; }
.spinner-grow-custom:nth-child(3) { animation-delay: 0.4s; }

@keyframes spinnerGrow {
    0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Tooltip */
.tooltip-custom {
    position: relative;
    display: inline-block;
}

.tooltip-custom .tooltip-text {
    visibility: hidden;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-dark);
    color: var(--white);
    font-size: 0.75rem;
    padding: 6px 10px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 100;
    pointer-events: none;
}

.tooltip-custom .tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--primary-dark);
}

.tooltip-custom:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

.tooltip-bottom .tooltip-text {
    bottom: auto;
    top: calc(100% + 8px);
}

.tooltip-bottom .tooltip-text::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: var(--primary-dark);
}

/* Popover */
.popover-custom {
    position: relative;
    display: inline-block;
}

.popover-content {
    display: none;
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--white);
    border: 1px solid var(--light-gray);
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    padding: 16px;
    width: 260px;
    z-index: 200;
}

.popover-content.show { display: block; }

.popover-content::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 7px solid transparent;
    border-top-color: var(--white);
}

.popover-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--dark-text);
    margin-bottom: 6px;
}

.popover-body {
    font-size: 0.82rem;
    color: var(--gray-text);
    line-height: 1.5;
}

/* List Group */
.list-group-custom {
    border: 1px solid var(--light-gray);
    border-radius: 10px;
    overflow: hidden;
}

.list-group-item-custom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--light-gray);
    font-size: 0.88rem;
    color: var(--dark-text);
    transition: var(--transition);
    cursor: pointer;
}

.list-group-item-custom:last-child { border-bottom: none; }
.list-group-item-custom:hover { background: var(--primary-light); }
.list-group-item-custom.active-item { background: var(--primary); color: var(--white); }

.list-group-item-custom .list-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
}

/* Offcanvas */
.offcanvas-custom {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    max-width: 100%;
    height: 100vh;
    background: var(--white);
    box-shadow: -4px 0 20px rgba(0,0,0,0.1);
    z-index: 2000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.offcanvas-custom.show { right: 0; }

.offcanvas-header-custom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--light-gray);
}

.offcanvas-header-custom h5 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    color: var(--dark-text);
}

.offcanvas-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--gray-text);
    cursor: pointer;
    padding: 4px;
}

.offcanvas-body-custom {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.offcanvas-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1999;
}

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

/* Toast */
.toast-container-custom {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast-custom {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: var(--white);
    border: 1px solid var(--light-gray);
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    min-width: 300px;
    max-width: 400px;
    animation: slideInRight 0.3s ease;
}

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

.toast-custom .toast-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.toast-custom .toast-body { flex: 1; }

.toast-custom .toast-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--dark-text);
    margin-bottom: 2px;
}

.toast-custom .toast-message {
    font-size: 0.8rem;
    color: var(--gray-text);
}

.toast-custom .toast-close {
    background: none;
    border: none;
    font-size: 1rem;
    color: var(--gray-text);
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}

.toast-success .toast-icon { color: var(--success); }
.toast-danger .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info .toast-icon { color: var(--info); }

/* Palette Switcher */
.palette-switcher {
    position: relative;
}

.palette-btn {
    background: none;
    border: 2px solid var(--light-gray);
    width: 34px;
    height: 34px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 1rem;
    color: var(--gray-text);
}

.palette-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.palette-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--white);
    border: 1px solid var(--light-gray);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    width: 280px;
    z-index: 1000;
    padding: 16px;
}

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

.palette-dropdown h6 {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray-text);
    margin: 0 0 12px;
    font-weight: 600;
}

.palette-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.palette-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border: 2px solid var(--light-gray);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    background: none;
    width: 100%;
    min-width: 0;
    text-align: left;
    overflow: hidden;
}

.palette-option:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.palette-option.active {
    border-color: var(--primary);
    background: var(--primary-light);
}

.palette-option .palette-preview {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
}

.palette-option .palette-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.palette-option > div:last-child {
    min-width: 0;
    overflow: hidden;
}

.palette-option .palette-name {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--dark-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.palette-option .palette-use {
    font-size: 0.62rem;
    color: var(--gray-text);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
