/* ============================================================
   File: assets/css/app.css
   Stylesheet utama aplikasi SaaS Mall Pass
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* ---- CSS Variables / Design Tokens ---- */
:root {
    --primary: #3b3486;       /* Deep Violet */
    --primary-light: #5247b9;
    --primary-dark: #2a2560;
    --primary-50: #efeeff;
    
    --secondary: #accf26;     /* Lime Green */
    --accent: #ed7123;        /* Bright Orange */
    
    --bg: #f5f7fb;
    --bg-card: #ffffff;
    --bg-sidebar: #0a0c12;    /* Near Black */
    --bg-sidebar-hover: rgba(255, 255, 255, 0.05);
    --bg-sidebar-active: rgba(172, 207, 38, 0.15);
    
    --text: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --text-sidebar: #94a3b8;
    --text-sidebar-active: #ffffff;
    
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-md: 0 12px 24px -4px rgba(0,0,0,0.12);
    --shadow-lg: 0 20px 40px -8px rgba(0,0,0,0.15);
    --shadow-xl: 0 32px 64px -12px rgba(0,0,0,0.25);
    
    --radius-sm: 8px;
    --radius: 12px;
    --radius-md: 16px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    
    --sidebar-width: 270px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    --success: #10b981;
    --success-bg: #d1fae5;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --danger: #ef4444;
    --danger-bg: #fee2e2;
    --info: #0ea5e9;
    --info-bg: #e0f2fe;
}

body {
    font-family: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ---- Utilities ---- */
.container-sm { max-width: 480px; margin: 0 auto; }
.container-md { max-width: 800px; margin: 0 auto; }
.container-lg { max-width: 1000px; margin: 0 auto; }

.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }

.text-right { text-align: right; }
.text-center { text-align: center; }
.w-full { width: 100%; }

.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2-1 { grid-template-columns: 2fr 1fr; }

.flex-col { flex-direction: column; }
.flex-start { justify-content: flex-start; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }
.mx-auto { margin-left: auto; margin-right: auto; }

.py-10 { padding-top: 40px; padding-bottom: 40px; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }

.uppercase { text-transform: uppercase; }
.d-none { display: none; }
.d-block { display: block; }
.border-t { border-top: 1px solid var(--border); }
.px-4 { padding-left: 16px; padding-right: 16px; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--text-muted); }
.fw-700 { font-weight: 700; }
.color-primary { color: var(--primary); }


a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ---- Login Page ---- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0f121b;
    position: relative;
    overflow: hidden;
    padding: 20px;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 900px;
    height: 900px;
    background: radial-gradient(circle, rgba(59, 52, 134, 0.4) 0%, transparent 65%);
    top: -300px;
    right: -300px;
    animation: blobPulse 10s infinite alternate cubic-bezier(0.4, 0, 0.2, 1);
}

.login-page::after {
    content: '';
    position: absolute;
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(237, 113, 35, 0.2) 0%, transparent 60%);
    bottom: -200px;
    left: -200px;
    animation: blobPulse 12s infinite alternate-reverse cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes blobPulse {
    0% { transform: scale(1) translate(0, 0); }
    100% { transform: scale(1.1) translate(-30px, 50px); }
}

.login-card {
    background: rgba(15, 18, 27, 0.65);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: var(--radius-xl);
    box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.8), inset 0 1px 2px rgba(255,255,255,0.08);
    padding: 60px 48px;
    width: 100%;
    max-width: 480px;
    position: relative;
    z-index: 10;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
}

.login-logo img.brand-logo {
    height: 72px;
    margin-bottom: 12px;
    display: inline-block;
}

.login-logo h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.5px;
}

.login-logo p {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: 4px;
}

.login-card .form-label {
    color: #cbd5e1;
}

.login-card .form-control {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.login-card .form-control:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(172, 207, 38, 0.15);
}

/* ---- Layout ---- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    pointer-events: auto !important;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-header .logo-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-logo-sidebar {
    height: 32px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
    transition: transform var(--transition);
}

.nav-item:hover .brand-logo-sidebar {
    transform: scale(1.05);
}

.sidebar-header .logo-mark {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-header .logo-mark svg {
    width: 20px;
    height: 20px;
    color: #fff;
}

.sidebar-header .brand h2 {
    font-size: 1rem;
    font-weight: 700;
    color: #f8fafc;
    line-height: 1.2;
}

.sidebar-header .brand span {
    font-size: 0.7rem;
    color: var(--text-light);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 16px;
    margin-bottom: 12px;
    opacity: 0.6;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin-bottom: 2px;
    border-radius: var(--radius-sm);
    color: var(--text-sidebar);
    cursor: pointer;
    transition: all var(--transition);
    font-weight: 500;
    position: relative;
    text-decoration: none;
    font-size: 0.85rem;
}

.nav-item:hover {
    background: var(--bg-sidebar-hover);
    color: #fff;
}

.nav-item.active {
    background: var(--bg-sidebar-active);
    color: #fff;
}

.nav-item.active::after {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    background: var(--secondary);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px var(--secondary);
}

.nav-icon {
    width: 16px;
    height: 16px;
    opacity: 0.7;
    flex-shrink: 0;
}

.nav-item.active .nav-icon {
    opacity: 1;
    color: var(--secondary);
}

.sidebar-footer {
    padding: 20px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    cursor: default;
}

.sidebar-user .avatar {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.sidebar-user .user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user .name {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user .role {
    font-size: 0.7rem;
    color: var(--text-light);
    text-transform: capitalize;
}

/* ---- Main Content ---- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    background: var(--bg);
}

/* ---- Top Bar ---- */
.topbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 28px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-left h1 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
}

.topbar-left .breadcrumb {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.topbar-left .breadcrumb span {
    color: var(--text-light);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-toggle {
    display: none;
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text);
    border-radius: var(--radius-sm);
}

.menu-toggle:hover {
    background: var(--bg);
}

/* ---- Page Content ---- */
.page-content {
    flex: 1;
    padding: 28px;
}

/* ---- Cards ---- */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 24px;
    animation: slideUp 0.6s ease-out backwards;
}
.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border-light);
    background: #fafbfc;
}

/* ---- Stat Cards ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    opacity: 0.05;
    transform: translate(20px, -20px);
}

.stat-card.stat-total::after {
    background: var(--primary);
}

.stat-card.stat-open::after {
    background: var(--info);
}

.stat-card.stat-checked::after {
    background: var(--warning);
}

.stat-card.stat-approved::after {
    background: var(--success);
}

.stat-card.stat-completed::after {
    background: var(--primary-dark);
}

.stat-card.stat-rejected::after {
    background: var(--danger);
}

.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 18px;
    height: 18px;
}

.stat-icon.total {
    background: var(--primary-50);
    color: var(--primary);
}

.stat-icon.open {
    background: var(--info-bg);
    color: var(--info);
}

.stat-icon.checked {
    background: var(--warning-bg);
    color: var(--warning);
}

.stat-icon.approved {
    background: var(--success-bg);
    color: var(--success);
}

.stat-icon.completed {
    background: #f0fdfa;
    color: var(--primary-dark);
}

.stat-icon.rejected {
    background: var(--danger-bg);
    color: var(--danger);
}

.stat-info .stat-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.1;
}

.stat-info .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
    font-weight: 500;
}

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.badge-open {
    background: var(--info-bg);
    color: #2563eb;
}

.badge-checked {
    background: var(--warning-bg);
    color: #d97706;
}

.badge-approved {
    background: var(--success-bg);
    color: #059669;
}

.badge-rejected {
    background: var(--danger-bg);
    color: #dc2626;
}

.badge-completed {
    background: var(--primary-50);
    color: var(--primary-dark);
}

.badge-cancelled {
    background: #f1f5f9;
    color: #64748b;
}

.badge-jenis {
    background: var(--bg);
    color: var(--text-muted);
    font-size: 0.68rem;
    padding: 2px 8px;
    border-radius: 4px;
}

/* ---- Table ---- */
.table-wrapper {
    overflow-x: auto;
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.83rem;
}

table.data-table thead {
    background: #f8fafc;
}

table.data-table th {
    padding: 16px 18px; /* Increased padding */
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8rem; /* Slightly larger */
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

table.data-table td {
    padding: 16px 18px; /* Increased padding */
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
    vertical-align: middle;
    font-size: 0.95rem; /* Larger font */
}

table.data-table tbody tr {
    transition: background var(--transition);
}

table.data-table tbody tr:hover {
    background: #f8fafc;
}

table.data-table .col-kode {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.78rem;
    white-space: nowrap;
}

table.data-table .col-dept {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.row-disabled {
    opacity: 0.65;
    background-color: #f8fafc;
}

.avatar-disabled {
    filter: grayscale(1);
    background: #cbd5e1 !important;
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
}

.user-meta {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.user-jabatan {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    font-size: 0.82rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    font-family: inherit;
    text-decoration: none;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.75rem;
    gap: 4px;
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover {
    background: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-outline {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    background: var(--bg);
    color: var(--text);
    border-color: #cbd5e1;
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    padding: 6px 10px;
}

.btn-ghost:hover {
    background: var(--bg);
    color: var(--text);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.75rem;
}

.btn-sm svg {
    width: 14px;
    height: 14px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 0.9rem;
}

.btn-icon {
    padding: 7px;
    border-radius: var(--radius-sm);
}

/* ---- Forms ---- */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.form-label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.85rem;
    font-family: inherit;
    color: var(--text);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

.form-control::placeholder {
    color: var(--text-light);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-hint {
    font-size: 0.72rem;
    color: var(--text-light);
    margin-top: 4px;
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg-card);
}

.checkbox-item:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.checkbox-item input[type="checkbox"] {
    display: none;
}

.checkbox-item.checked {
    background: var(--primary-50);
    border-color: var(--primary);
    color: var(--primary-dark);
    font-weight: 600;
}

.checkbox-item .check-icon {
    display: none;
    width: 14px;
    height: 14px;
}

.checkbox-item.checked .check-icon {
    display: block;
}

/* ---- Alerts / Flash ---- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.83rem;
    font-weight: 500;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideDown 0.3s ease;
}

.alert svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.alert-success {
    background: var(--success-bg);
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-warning {
    background: var(--warning-bg);
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-danger {
    background: var(--danger-bg);
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-info {
    background: var(--info-bg);
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- Modal ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.25s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.25s ease;
}

.modal-overlay.show .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all var(--transition);
}

.modal-close:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ---- Tabs ---- */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border-light);
    margin-bottom: 20px;
}

.tab-btn {
    padding: 10px 18px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    border: none;
    background: none;
    cursor: pointer;
    position: relative;
    transition: all var(--transition);
    font-family: inherit;
}

.tab-btn:hover {
    color: var(--text);
}

.tab-btn.active {
    color: var(--primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    border-radius: 2px 2px 0 0;
}

.tab-btn .tab-count {
    background: var(--bg);
    font-size: 0.68rem;
    padding: 1px 7px;
    border-radius: 10px;
    margin-left: 6px;
    color: var(--text-muted);
}

.tab-btn.active .tab-count {
    background: var(--primary-50);
    color: var(--primary);
}

/* ---- Filter Bar ---- */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.filter-bar .search-input {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.filter-bar .search-input input {
    width: 100%;
    padding: 9px 14px 9px 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.83rem;
    font-family: inherit;
    outline: none;
    background: var(--bg-card);
    transition: all var(--transition);
}

.filter-bar .search-input input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

.filter-bar .search-input svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-light);
}

.filter-bar select {
    padding: 9px 36px 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.83rem;
    font-family: inherit;
    background: var(--bg-card);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
    outline: none;
    color: var(--text);
}

.filter-bar select:focus {
    border-color: var(--primary);
}

/* ---- Pagination ---- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
    margin-top: 16px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.pagination .page-btns {
    display: flex;
    gap: 4px;
}

.pagination .page-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.pagination .page-btn:hover {
    background: var(--bg);
    color: var(--text);
}

.pagination .page-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.pagination .page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ---- Toast / Notification ---- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
    max-width: 420px;
    animation: toastIn 0.3s ease;
    font-size: 0.83rem;
}

.toast.toast-out {
    animation: toastOut 0.3s ease forwards;
}

.toast svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.toast-success {
    border-left: 3px solid var(--success);
}

.toast-success svg {
    color: var(--success);
}

.toast-error {
    border-left: 3px solid var(--danger);
}

.toast-error svg {
    color: var(--danger);
}

.toast-warning {
    border-left: 3px solid var(--warning);
}

.toast-warning svg {
    color: var(--warning);
}

.toast-info {
    border-left: 3px solid var(--info);
}

.toast-info svg {
    color: var(--info);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(40px);
    }
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--text-light);
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.empty-state p {
    font-size: 0.85rem;
}

/* ---- Detail Info Grid ---- */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.detail-item {}

.detail-item .detail-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 3px;
}

.detail-item .detail-value {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text);
}

/* ---- Timeline / Activity ---- */
.timeline {
    position: relative;
    padding-left: 24px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: 18px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -20px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--bg-card);
}

.timeline-dot.dot-success {
    border-color: var(--success);
    background: var(--success);
}

.timeline-dot.dot-warning {
    border-color: var(--warning);
    background: var(--warning);
}

.timeline-dot.dot-info {
    border-color: var(--info);
    background: var(--info);
}

.timeline-dot.dot-danger {
    border-color: var(--danger);
    background: var(--danger);
}

.timeline-content {
    font-size: 0.82rem;
}

.timeline-content .tl-title {
    font-weight: 600;
    color: var(--text);
}

.timeline-content .tl-desc {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.timeline-content .tl-time {
    color: var(--text-light);
    font-size: 0.72rem;
    margin-top: 2px;
}

/* ---- QR Scanner Area ---- */
.scan-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    background: #fafbfc;
    transition: all var(--transition);
}

.scan-area:focus-within {
    border-color: var(--primary);
    background: var(--primary-50);
}

.scan-area svg {
    width: 48px;
    height: 48px;
    color: var(--text-light);
    margin-bottom: 12px;
}

.scan-area h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.scan-area p {
    font-size: 0.83rem;
    color: var(--text-muted);
}

.scan-input-wrap {
    max-width: 400px;
    margin: 20px auto 0;
}

.scan-input-wrap input {
    width: 100%;
    padding: 14px 18px;
    font-size: 1.1rem;
    font-family: 'Courier New', monospace;
    font-weight: 700;
    text-align: center;
    letter-spacing: 2px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: all var(--transition);
}

.scan-input-wrap input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.15);
}

.scan-result {
    margin-top: 20px;
    padding: 18px;
    border-radius: var(--radius);
    font-size: 0.88rem;
    display: none;
}

.scan-result.show {
    display: block;
    animation: slideDown 0.3s ease;
}

.scan-result.result-success {
    background: var(--success-bg);
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.scan-result.result-error {
    background: var(--danger-bg);
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .page-content {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-info .stat-value {
        font-size: 1.3rem;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .tabs {
        overflow-x: auto;
    }
}

/* ---- Sidebar Overlay (mobile) ---- */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s ease;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ---- Misc ---- */
.text-primary {
    color: var(--primary);
}

.text-muted {
    color: var(--text-muted);
}

.text-danger {
    color: var(--danger);
}

.text-success {
    color: var(--success);
}

.text-center {
    text-align: center;
}

.fw-600 {
    font-weight: 600;
}

.fw-700 {
    font-weight: 700;
}

.mb-0 {
    margin-bottom: 0;
}

.mt-12 {
    margin-top: 12px;
}

.mt-18 {
    margin-top: 18px;
}

.gap-8 {
    gap: 8px;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.hidden {
    display: none !important;
}

/* ---- Print ---- */
.print-frame {
    position: fixed;
    top: -9999px;
    left: -9999px;
    width: 105mm;
}

/* ---- Loading Spinner ---- */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: inherit;
}

/* ---- Pulse animation for notification dot ---- */
.pulse-dot {
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    position: relative;
}

.pulse-dot::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid var(--danger);
    animation: pulse 1.5s ease infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    100% {
        opacity: 0;
        transform: scale(1.8);
    }
}

/* =========================================================
   Responsive Design / Media Queries 
   ========================================================= */

/* Mobile & Tablets (Up to 992px) */
@media screen and (max-width: 992px) {
    :root {
        --sidebar-width: 240px;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 0 0 50px rgba(0,0,0,0.5);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .topbar {
        padding: 0 20px;
    }
    
    .page-content {
        padding: 20px;
    }

    /* Cards */
    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .card-header .btn {
        margin-top: 10px;
        width: 100%;
    }
}

/* Phones (Up to 768px) */
@media screen and (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .modal {
        width: 95%;
        margin: 20px auto;
        padding: 20px;
        min-width: unset;
    }
    
    .topbar-left h1 {
        font-size: 1rem;
    }
    
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 0.85rem;
    }
}

/* Small Phones (Up to 480px) */
@media screen and (max-width: 480px) {
    .login-card {
        padding: 30px 24px;
        margin: 20px;
        border-radius: var(--radius-md);
    }
    
    .login-logo h1 {
        font-size: 1.25rem;
    }
    
    .page-content {
        padding: 16px;
    }
    
    #toast-container {
        left: 50%;
        bottom: 20px;
        transform: translateX(-50%);
        right: auto;
        width: 90%;
    }
}

/* ---- Modern UI Overrides & Additions ---- */
.card-modern {
    border: none;
    box-shadow: 0 10px 30px -5px rgba(0,0,0,0.05), 0 0 1px 0 rgba(0,0,0,0.1);
    background: #ffffff;
}

.header-with-icon {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-icon-box {
    width: 44px;
    height: 44px;
    background: var(--primary-50);
    color: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.header-icon-box svg {
    width: 22px;
    height: 22px;
}

.btn-primary-modern {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    padding: 10px 22px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.85rem;
    box-shadow: 0 8px 16px -4px rgba(59, 52, 134, 0.3);
    transition: all 0.3s ease;
}

.btn-primary-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 20px -4px rgba(59, 52, 134, 0.4);
    color: #fff;
}

.table-header-modern th {
    background: #f8fafc !important;
    border-bottom: 2px solid #e2e8f0 !important;
    color: var(--text-muted) !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.05em;
    padding: 14px 18px !important;
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar-small {
    width: 36px;
    height: 36px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary);
    flex-shrink: 0;
}

.user-meta {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    color: var(--text);
    font-size: 0.9rem;
    line-height:1.2;
}

.user-jabatan {
    font-size: 0.72rem;
    color: var(--text-light);
}

.badge-role {
    padding: 4px 10px;
    font-size: 0.65rem;
    border-radius: 8px;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    font-weight: 700;
}

.role-admin { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.role-gm { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.role-dept_head { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.role-tenant { background: #e0f2fe; color: #075985; border-color: #bae6fd; }

.alert-info-modern {
    background: #eff6ff;
    border: 1px solid #dbeafe;
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    gap: 16px;
}

.alert-info-modern .alert-icon {
    width: 40px;
    height: 40px;
    background: #fff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #3b82f6;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    flex-shrink: 0;
}

.alert-info-modern .alert-content strong {
    display: block;
    color: #1e3a8a;
    font-size: 0.95rem;
}

.alert-info-modern .alert-content p {
    margin: 4px 0 0;
    font-size: 0.85rem;
    color: #1e40af;
    opacity: 0.8;
}

.stats-card-mini {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.stats-card-mini .stats-info {
    display: flex;
    flex-direction: column;
}

.stats-card-mini .stats-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.stats-card-mini .stats-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    margin: 0;
}

.bg-warning-light { background: #fffbeb; }

/* Improve form row gap */
.form-row {
    margin-bottom: 20px !important;
    gap: 24px !important;
}

.form-group-modern {
    margin-bottom: 24px;
}

/* Sidebar Badge Premium Style */
.nav-badge {
    margin-left: auto;
    background: var(--accent);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 20px;
    box-shadow: 0 2px 6px rgba(237, 113, 35, 0.4);
    min-width: 18px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.2);
    display: inline-block;
    vertical-align: middle;
    animation: badgePop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.nav-item.active .nav-badge {
    background: #ffffff !important;
    color: #1e293b !important; /* Dark slate for contrast */
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

@keyframes badgePop {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Filter Bar styles */
.filter-bar-modern {
    padding: 16px 24px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.search-box-modern {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-box-modern svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    pointer-events: none;
}

.search-box-modern input {
    padding-left: 38px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    width: 100%;
    box-sizing: border-box;
}

.filter-select-modern {
    width: 180px;
    flex-shrink: 0;
}

@media (max-width: 576px) {
    .filter-bar-modern {
        flex-direction: column;
        align-items: stretch;
    }
    .search-box-modern {
        width: 100%;
        max-width: none;
    }
    .filter-select-modern {
        width: 100%;
        flex: 1 1 100%;
    }
}

/* Custom Checkbox Styles for Departemen */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    cursor: pointer;
    user-select: none;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    transition: all 0.2s;
}
.checkbox-item:hover {
    background: #f1f5f9;
}
.checkbox-item input[type="checkbox"] {
    display: none;
}
.checkbox-item.checked {
    background: var(--primary-50);
    border-color: var(--primary);
    color: var(--primary);
}
.checkbox-item .check-icon {
    width: 16px;
    height: 16px;
    display: none;
    color: var(--primary);
}
.checkbox-item.checked .check-icon {
    display: block;
}

.header-clickable {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.header-clickable:hover {
    background: #f1f5f9 !important;
}

.header-sort-icon {
    margin-left: 4px;
    opacity: 0.3;
}

.header-clickable:hover .header-sort-icon {
    opacity: 1;
}