/* ============================================
   JASAPANDA - MAIN STYLESHEET
   ============================================ */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ============================================
   CSS VARIABLES (TEMA WARNA)
   ============================================ */
:root {
    --primary:        #6366f1;
    --primary-dark:   #4f46e5;
    --primary-light:  #a5b4fc;
    --secondary:      #10b981;
    --secondary-dark: #059669;
    --danger:         #ef4444;
    --warning:        #f59e0b;
    --info:           #3b82f6;
    --dark:           #1e293b;
    --gray:           #64748b;
    --light:          #f1f5f9;
    --white:          #ffffff;
    --sidebar-width:  260px;
    --topbar-height:  65px;
    --border-radius:  12px;
    --shadow-sm:      0 1px 3px rgba(0,0,0,0.08);
    --shadow-md:      0 4px 16px rgba(0,0,0,0.10);
    --shadow-lg:      0 8px 32px rgba(0,0,0,0.12);
    --transition:     all 0.25s ease;
}

/* ============================================
   HAMBURGER MENU (MOBILE)
   ============================================ */
.topbar-btn-mobile {
    display: none; /* Default hidden, JS akan tampilkan di mobile */
}

@media (max-width: 768px) {
    .topbar-btn-mobile {
        display: flex !important;
    }
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: #f8fafc;
    color: var(--dark);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

img { max-width: 100%; }

/* ============================================
   SCROLLBAR CUSTOM
   ============================================ */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ============================================
   LAYOUT WRAPPER
   ============================================ */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    overflow: hidden;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: linear-gradient(180deg, #1e1b4b 0%, #312e81 50%, #3730a3 100%);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(99,102,241,0.4);
    flex-shrink: 0;
}

.sidebar-logo-text h1 {
    font-size: 18px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.sidebar-logo-text span {
    font-size: 10px;
    color: rgba(255,255,255,0.5);
    font-weight: 400;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Navigasi Sidebar */
.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-section-title {
    padding: 8px 20px 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.35);
    margin-top: 8px;
}

.nav-item {
    padding: 2px 12px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 10px;
    color: rgba(255,255,255,0.65);
    font-size: 13.5px;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    white-space: nowrap;
}

.nav-link:hover {
    background: rgba(255,255,255,0.08);
    color: #ffffff;
    transform: translateX(2px);
}

.nav-link.active {
    background: linear-gradient(135deg, rgba(99,102,241,0.35), rgba(139,92,246,0.25));
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--primary-light);
    border-radius: 0 3px 3px 0;
}

.nav-link .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 14px;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    line-height: 1.4;
}

/* User info di bawah sidebar */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    overflow: hidden;
}

.sidebar-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar-user-info { flex: 1; min-width: 0; }

.sidebar-user-name {
    font-size: 12.5px;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 10.5px;
    color: rgba(255,255,255,0.45);
    text-transform: capitalize;
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--transition);
}

/* ============================================
   TOPBAR
   ============================================ */
.topbar {
    height: var(--topbar-height);
    background: var(--white);
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.topbar-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--dark);
}

.topbar-subtitle {
    font-size: 12px;
    color: var(--gray);
    font-weight: 400;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Tombol icon di topbar */
.topbar-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: var(--gray);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.topbar-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.topbar-notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 16px;
    height: 16px;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* Dropdown user di topbar */
.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: 10px;
    cursor: pointer;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    transition: var(--transition);
    position: relative;
}

.topbar-user:hover { background: #f1f5f9; }

.topbar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: white;
    overflow: hidden;
    flex-shrink: 0;
}

.topbar-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.topbar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--dark);
}

/* Dropdown Menu */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 200;
    display: none;
    overflow: hidden;
}

.dropdown-menu.show { display: block; animation: dropdownIn 0.2s ease; }

@keyframes dropdownIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.dropdown-header {
    padding: 14px 16px;
    background: linear-gradient(135deg, #f8faff, #f0f4ff);
    border-bottom: 1px solid #e2e8f0;
}

.dropdown-header .name {
    font-size: 13px;
    font-weight: 600;
    color: var(--dark);
}

.dropdown-header .role {
    font-size: 11px;
    color: var(--gray);
    text-transform: capitalize;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--dark);
    transition: var(--transition);
    cursor: pointer;
}

.dropdown-item:hover { background: #f8fafc; color: var(--primary); }

.dropdown-item i { width: 16px; text-align: center; color: var(--gray); }

.dropdown-item:hover i { color: var(--primary); }

.dropdown-divider { height: 1px; background: #e2e8f0; margin: 4px 0; }

.dropdown-item.text-danger { color: var(--danger); }
.dropdown-item.text-danger i { color: var(--danger); }
.dropdown-item.text-danger:hover { background: #fef2f2; }

/* ============================================
   PAGE CONTENT
   ============================================ */
.page-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid #e8edf5;
    transition: var(--transition);
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
    padding: 18px 20px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title i {
    color: var(--primary);
    font-size: 14px;
}

.card-body { padding: 20px; }

.card-footer {
    padding: 14px 20px;
    border-top: 1px solid #f1f5f9;
    background: #fafbfc;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

/* ============================================
   STAT CARDS (DASHBOARD)
   ============================================ */
.stat-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 20px;
    border: 1px solid #e8edf5;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}

.stat-card.green::before  { background: linear-gradient(90deg, #10b981, #059669); }
.stat-card.red::before    { background: linear-gradient(90deg, #ef4444, #dc2626); }
.stat-card.blue::before   { background: linear-gradient(90deg, #3b82f6, #2563eb); }
.stat-card.purple::before { background: linear-gradient(90deg, #8b5cf6, #7c3aed); }
.stat-card.orange::before { background: linear-gradient(90deg, #f59e0b, #d97706); }

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-icon.green  { background: #d1fae5; color: #059669; }
.stat-icon.red    { background: #fee2e2; color: #dc2626; }
.stat-icon.blue   { background: #dbeafe; color: #2563eb; }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-icon.orange { background: #fef3c7; color: #d97706; }

.stat-info { flex: 1; min-width: 0; }

.stat-label {
    font-size: 12px;
    color: var(--gray);
    font-weight: 500;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--dark);
    line-height: 1.2;
    margin-bottom: 6px;
}

.stat-change {
    font-size: 11.5px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-change.up   { color: #059669; }
.stat-change.down { color: #dc2626; }
.stat-change.neutral { color: var(--gray); }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: 9px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(99,102,241,0.4);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(16,185,129,0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 4px 12px rgba(239,68,68,0.3);
}

.btn-danger:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(239,68,68,0.4);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    box-shadow: 0 4px 12px rgba(245,158,11,0.3);
}

.btn-warning:hover:not(:disabled) {
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}

.btn-outline:hover:not(:disabled) {
    background: var(--primary);
    color: white;
}

.btn-light {
    background: #f8fafc;
    color: var(--gray);
    border: 1px solid #e2e8f0;
}

.btn-light:hover:not(:disabled) {
    background: #f1f5f9;
    color: var(--dark);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 7px;
}

.btn-lg {
    padding: 13px 28px;
    font-size: 15px;
    border-radius: 11px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 8px;
}

.btn-icon.btn-sm {
    width: 30px;
    height: 30px;
    border-radius: 6px;
}

/* ============================================
   FORMS
   ============================================ */
.form-group { margin-bottom: 18px; }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 7px;
}

.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 9px;
    font-size: 13.5px;
    color: var(--dark);
    background: #ffffff;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

.form-control:disabled {
    background: #f8fafc;
    color: var(--gray);
    cursor: not-allowed;
}

.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-valid   { border-color: var(--secondary); }

.form-select {
    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 10px center;
    background-repeat: no-repeat;
    background-size: 18px;
    appearance: none;
    cursor: pointer;
}

.form-textarea { resize: vertical; min-height: 90px; }

.form-text {
    font-size: 11.5px;
    color: var(--gray);
    margin-top: 5px;
}

.invalid-feedback {
    font-size: 11.5px;
    color: var(--danger);
    margin-top: 4px;
    display: none;
}

.is-invalid ~ .invalid-feedback { display: block; }

/* Input dengan icon */
.input-group { position: relative; }

.input-group .form-control {
    padding-left: 40px;
}

.input-group .input-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
    font-size: 13px;
    pointer-events: none;
}

.input-group .input-icon-right {
    left: auto;
    right: 13px;
    pointer-events: auto;
    cursor: pointer;
}

/* ============================================
   TABLES
   ============================================ */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--border-radius);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.table thead th {
    padding: 13px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.table tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--dark);
    vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }

.table tbody tr:hover td { background: #fafbff; }

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-purple  { background: #ede9fe; color: #5b21b6; }
.badge-gray    { background: #f1f5f9; color: #475569; }
.badge-primary { background: #e0e7ff; color: #3730a3; }

/* ============================================
   ALERTS / FLASH MESSAGES
   ============================================ */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 10px;
    border-left: 4px solid;
    margin-bottom: 16px;
    font-size: 13.5px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.alert-success { background: #f0fdf4; border-color: #22c55e; color: #15803d; }
.alert-danger  { background: #fef2f2; border-color: #ef4444; color: #dc2626; }
.alert-warning { background: #fffbeb; border-color: #f59e0b; color: #b45309; }
.alert-info    { background: #eff6ff; border-color: #3b82f6; color: #1d4ed8; }

.alert-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    padding: 0;
    font-size: 14px;
    flex-shrink: 0;
}

.alert-close:hover { opacity: 1; }

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.5);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(2px);
}

.modal-overlay.show {
    display: flex;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.25s ease;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-lg { max-width: 700px; }
.modal-xl { max-width: 900px; }

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(-20px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}

.modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--gray);
    transition: var(--transition);
    flex-shrink: 0;
}

.modal-close:hover { background: var(--danger); color: white; border-color: var(--danger); }

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
    background: #fafbfc;
    border-radius: 0 0 16px 16px;
}

/* ============================================
   PAGE HEADER
   ============================================ */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-header-left h2 {
    font-size: 22px;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 4px;
}

.page-header-left p {
    font-size: 13px;
    color: var(--gray);
}

.page-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--gray);
    margin-bottom: 4px;
}

.breadcrumb a { color: var(--primary); }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .separator { color: #cbd5e1; }

/* ============================================
   LOADING & EMPTY STATE
   ============================================ */
.loading-spinner {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--gray);
    font-size: 13px;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid #e2e8f0;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
}

.empty-state-icon {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 13px;
    margin-bottom: 20px;
}

/* ============================================
   UTILITIES
   ============================================ */
.text-primary { color: var(--primary); }
.text-success { color: var(--secondary); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-gray    { color: var(--gray); }
.text-dark    { color: var(--dark); }
.text-muted   { color: #94a3b8; }

.text-right  { text-align: right; }
.text-center { text-align: center; }

.fw-bold   { font-weight: 700; }
.fw-medium { font-weight: 500; }

.d-flex         { display: flex; }
.align-center   { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.w-full { width: 100%; }

.rounded    { border-radius: 8px; }
.rounded-lg { border-radius: var(--border-radius); }
.rounded-full { border-radius: 9999px; }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }

/* Grid sistem sederhana */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ============================================
   RESPONSIVE DESIGN — TABLET & MOBILE
   ============================================ */

/* ────────────────────────────────────────────
   TABLET LANDSCAPE (max 1280px)
   ──────────────────────────────────────────── */
@media (max-width: 1280px) {

    .page-content { padding: 20px; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    
    /* Layout 2-kolom dengan sidebar 340px jadi 1 kolom */
    .grid[style*="340px"] {
        grid-template-columns: 1fr !important;
    }
}

/* ────────────────────────────────────────────
   TABLET (max 1024px)
   ──────────────────────────────────────────── */
@media (max-width: 1024px) {
    
    :root {
        --sidebar-width: 240px;
        --topbar-height: 60px;
    }
    
    .page-content { padding: 18px; }
    
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    
    .stat-value { font-size: 18px; }
    .stat-card { padding: 16px; }
    
    /* Sidebar text lebih kecil */
    .sidebar-logo-text h1 { font-size: 16px; }
    .nav-link { font-size: 13px; padding: 10px 12px; }
    
    /* Page header */
    .page-header-left h2 { font-size: 20px; }
    
    /* Card */
    .card-body { padding: 16px; }
    .card-header { padding: 14px 18px; }
}

/* ────────────────────────────────────────────
   MOBILE LANDSCAPE / TABLET PORTRAIT (max 768px)
   ──────────────────────────────────────────── */
@media (max-width: 768px) {
    
    :root {
        --sidebar-width: 0px;
        --topbar-height: 56px;
    }

    body {
        padding-bottom: env(safe-area-inset-bottom);
    }

    .topbar {
        padding-top: env(safe-area-inset-top);
        height: calc(var(--topbar-height) + env(safe-area-inset-top));
    }
    
    /* ═════════════════════════════════════
       SIDEBAR — HIDDEN BY DEFAULT, SLIDE IN
       ═════════════════════════════════════ */
    .sidebar {
        width: 280px;
        transform: translateX(-280px);
        transition: transform 0.3s ease;
        z-index: 1000;
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 4px 0 30px rgba(0,0,0,0.3);
    }
    
    /* ═════════════════════════════════════
       MAIN CONTENT — FULL WIDTH
       ═════════════════════════════════════ */
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    /* ═════════════════════════════════════
       TOPBAR
       ═════════════════════════════════════ */
    .topbar {
        padding: 0 14px;
        gap: 10px;
    }
    
    .topbar-left {
        gap: 10px;
        min-width: 0;
    }
    
    .topbar-title {
        font-size: 14px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 150px;
    }
    
    .topbar-subtitle {
        display: none; /* Sembunyikan tanggal di mobile */
    }
    
    .topbar-right {
        gap: 6px;
    }
    
    .topbar-btn {
        width: 36px;
        height: 36px;
    }
    
    .topbar-user {
        padding: 5px 8px;
    }
    
    .topbar-user-name {
        display: none; /* Hanya tampilkan avatar di mobile */
    }
    
    /* Hide chevron icon di mobile */
    .topbar-user > i.fas.fa-chevron-down {
        display: none;
    }
    
    /* Dropdown menu position fix */
    .dropdown-menu {
        right: 0;
        min-width: 220px;
    }
    
    /* ═════════════════════════════════════
       PAGE CONTENT
       ═════════════════════════════════════ */
    .page-content { 
        padding: 14px; 
    }
    
    /* ═════════════════════════════════════
       PAGE HEADER (STACK)
       ═════════════════════════════════════ */
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .page-header-left h2 {
        font-size: 18px;
    }
    
    .page-header-left p {
        font-size: 12px;
    }
    
    .page-header-right {
        width: 100%;
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .page-header-right .btn {
        flex: 1;
        min-width: calc(50% - 4px);
        justify-content: center;
        font-size: 12.5px;
        padding: 9px 14px;
    }
    
    /* Hide breadcrumb di mobile (terlalu panjang) */
    .breadcrumb {
        font-size: 11px;
        gap: 4px;
        flex-wrap: wrap;
    }
    
    /* ═════════════════════════════════════
       GRID — STACK DI MOBILE
       ═════════════════════════════════════ */
    .grid-2, 
    .grid-3, 
    .grid-4 { 
        grid-template-columns: 1fr; 
        gap: 12px;
    }
    
    .grid {
        gap: 12px;
    }
    
    /* Grid custom (2 kolom misal 340px) */
    .grid[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
    
    /* ═════════════════════════════════════
       STAT CARDS
       ═════════════════════════════════════ */
    .stat-card {
        padding: 14px;
        gap: 12px;
    }
    
    .stat-icon {
        width: 42px;
        height: 42px;
        font-size: 16px;
    }
    
    .stat-value {
        font-size: 18px;
    }
    
    .stat-label {
        font-size: 11px;
    }
    
    .stat-change {
        font-size: 10.5px;
    }
    
    /* ═════════════════════════════════════
       CARD
       ═════════════════════════════════════ */
    .card-header {
        padding: 14px 16px;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .card-title {
        font-size: 14px;
    }
    
    .card-body {
        padding: 16px;
    }
    
    .card-footer {
        padding: 12px 16px;
    }
    
    /* ═════════════════════════════════════
       BUTTONS
       ═════════════════════════════════════ */
    .btn {
        font-size: 12.5px;
        padding: 9px 14px;
        min-height: 36px; /* Touch-friendly */
    }
    
    .btn-sm {
        padding: 6px 10px;
        font-size: 11.5px;
        min-height: 30px;
    }
    
    .btn-lg {
        padding: 12px 20px;
        font-size: 14px;
        min-height: 44px;
    }
    
    .btn-icon {
        min-width: 36px;
        min-height: 36px;
        padding: 0;
    }
    
    /* ═════════════════════════════════════
       FORM
       ═════════════════════════════════════ */
    .form-control {
        font-size: 14px; /* PENTING: 14px+ supaya iOS tidak zoom saat focus */
        padding: 11px 14px;
    }
    
    .form-label {
        font-size: 12.5px;
    }
    
    .form-textarea {
        min-height: 80px;
    }
    
    /* ═════════════════════════════════════
       TABLES — SCROLL HORIZONTAL
       ═════════════════════════════════════ */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -16px; /* Full bleed di mobile */
    }
    
    .table {
        font-size: 12px;
        min-width: 600px; /* Force scroll */
    }
    
    .table thead th {
        padding: 10px 10px;
        font-size: 10.5px;
        white-space: nowrap;
    }
    
    .table tbody td {
        padding: 10px 10px;
    }
    
    /* Tombol di tabel lebih kecil */
    .table .btn-icon.btn-sm {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }
    
    /* ═════════════════════════════════════
       BADGES
       ═════════════════════════════════════ */
    .badge {
        font-size: 10.5px;
        padding: 3px 8px;
    }
    
    /* ═════════════════════════════════════
       MODAL
       ═════════════════════════════════════ */
    .modal-overlay {
        padding: 12px;
        align-items: flex-end; /* Bottom sheet di mobile */
    }
    
    .modal {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 16px 16px 0 0;
        animation: modalSlideUp 0.3s ease;
    }
    
    @keyframes modalSlideUp {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }
    
    .modal-header {
        padding: 16px 18px;
    }
    
    .modal-title {
        font-size: 15px;
    }
    
    .modal-body {
        padding: 16px 18px;
    }
    
    .modal-footer {
        padding: 14px 18px;
        flex-wrap: wrap;
    }
    
    .modal-footer .btn {
        flex: 1;
        min-width: calc(50% - 4px);
    }
    
    /* ═════════════════════════════════════
       ALERT
       ═════════════════════════════════════ */
    .alert {
        font-size: 12.5px;
        padding: 12px 14px;
    }
    
    /* ═════════════════════════════════════
       PAGINATION
       ═════════════════════════════════════ */
    .card-footer > div {
        flex-direction: column;
        gap: 12px;
    }
    
    /* Hide hint "Menampilkan halaman X dari Y" di mobile */
    .card-footer > div > p {
        font-size: 11px;
        text-align: center;
    }
}

/* ────────────────────────────────────────────
   MOBILE PORTRAIT (max 480px)
   ──────────────────────────────────────────── */
@media (max-width: 480px) {
    
    .page-content { 
        padding: 10px; 
    }
    
    .topbar { 
        padding: 0 10px; 
    }
    
    .topbar-title {
        font-size: 13px;
        max-width: 120px;
    }
    
    /* Page header — buttons jadi full width */
    .page-header-right .btn {
        min-width: 100%;
    }
    
    /* Stat card stack vertikal */
    .stat-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .stat-icon {
        width: 38px;
        height: 38px;
        font-size: 15px;
    }
    
    .stat-value {
        font-size: 20px; /* Lebih besar karena vertikal */
    }
    
    /* Card lebih compact */
    .card-header {
        padding: 12px 14px;
    }
    
    .card-body {
        padding: 14px;
    }
    
    /* Form lebih compact */
    .form-group {
        margin-bottom: 14px;
    }
    
    /* Modal full screen di mobile kecil */
    .modal-overlay {
        padding: 0;
    }
    
    .modal {
        max-height: 100vh;
        border-radius: 0;
        height: 100vh;
    }
    
    /* Login page padding */
    .login-page {
        padding: 12px;
    }
    
    .login-card {
        padding: 30px 22px;
    }
    
    .login-logo {
        width: 60px;
        height: 60px;
        font-size: 26px;
    }
    
    .login-header h1 {
        font-size: 22px;
    }
}

/* ────────────────────────────────────────────
   MOBILE SANGAT KECIL (max 360px)
   ──────────────────────────────────────────── */
@media (max-width: 360px) {
    
    .page-content { 
        padding: 8px; 
    }
    
    .stat-value { 
        font-size: 18px; 
    }
    
    .btn { 
        font-size: 11.5px;
        padding: 8px 12px;
    }
    
    .card-body, .card-header {
        padding: 12px;
    }
}

/* ────────────────────────────────────────────
   DARK MODE (BONUS — UNCOMMENT JIKA INGIN AKTIF)
   ──────────────────────────────────────────── */
/*
@media (prefers-color-scheme: dark) {
    body { background: #0f172a; color: #e2e8f0; }
    .card { background: #1e293b; border-color: #334155; }
}
*/

/* ────────────────────────────────────────────
   TOUCH DEVICE OPTIMIZATIONS
   ──────────────────────────────────────────── */
@media (hover: none) and (pointer: coarse) {
    
    /* Disable hover transform di touch (cegah glitch) */
    .stat-card:hover,
    .btn:hover {
        transform: none !important;
    }
    
    /* Buat touch target lebih besar */
    .nav-link {
        padding: 13px 14px;
    }
    
    .dropdown-item {
        padding: 12px 16px;
    }
    
    /* Disable tooltip di touch (annoying) */
    [data-tooltip]:hover::before,
    [data-tooltip]:hover::after {
        display: none !important;
    }
}

/* ────────────────────────────────────────────
   LANDSCAPE ORIENTATION (HP miring)
   ──────────────────────────────────────────── */
@media (max-width: 900px) and (orientation: landscape) {
    
    .login-card {
        padding: 24px 30px;
        max-height: 95vh;
        overflow-y: auto;
    }
    
    .login-header {
        margin-bottom: 18px;
    }
    
    .login-logo {
        width: 50px;
        height: 50px;
        font-size: 22px;
        margin-bottom: 10px;
    }
}

/* ────────────────────────────────────────────
   PRINT (UNTUK INVOICE/LAPORAN)
   ──────────────────────────────────────────── */
@media print {
    
    .sidebar, 
    .topbar, 
    .no-print,
    #sidebarOverlay,
    .page-header-right,
    .breadcrumb {
        display: none !important;
    }
    
    .main-content { 
        margin-left: 0; 
    }
    
    .page-content { 
        padding: 0; 
    }
    
    body { 
        background: white; 
        font-size: 11pt;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #e2e8f0;
        break-inside: avoid;
    }
    
    a {
        color: inherit;
        text-decoration: none;
    }
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 40%, #4338ca 70%, #6366f1 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-bg-shapes {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.login-shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.08;
}

.login-shape-1 {
    width: 400px; height: 400px;
    background: white;
    top: -100px; right: -100px;
}

.login-shape-2 {
    width: 300px; height: 300px;
    background: white;
    bottom: -80px; left: -80px;
}

.login-shape-3 {
    width: 200px; height: 200px;
    background: white;
    top: 50%; left: 30%;
}

.login-card {
    background: white;
    border-radius: 20px;
    padding: 44px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.25);
    position: relative;
    z-index: 10;
    animation: loginCardIn 0.5s ease;
}

@keyframes loginCardIn {
    from { opacity: 0; transform: translateY(30px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-header { text-align: center; margin-bottom: 32px; }

.login-logo {
    width: 70px; height: 70px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    margin: 0 auto 16px;
    box-shadow: 0 8px 24px rgba(99,102,241,0.35);
}

.login-header h1 {
    font-size: 26px;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 6px;
}

.login-header p {
    font-size: 13.5px;
    color: var(--gray);
}

.login-divider {
    text-align: center;
    margin: 6px 0 20px;
    position: relative;
    font-size: 12px;
    color: var(--gray);
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #f1f5f9;
    font-size: 12px;
    color: var(--gray);
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .sidebar, .topbar, .no-print { display: none !important; }
    .main-content { margin-left: 0; }
    .page-content { padding: 0; }
    body { background: white; }
}