/* ============================================
   SIMABA - Main Stylesheet
   ============================================ */

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

   :root {
       --primary: #667eea;
       --primary-dark: #5568d3;
       --secondary: #764ba2;
       --sidebar-bg: #1a202c;
       --sidebar-hover: rgba(255,255,255,0.08);
       --sidebar-active: rgba(102,126,234,0.2);
       --success: #48bb78;
       --danger: #f56565;
       --warning: #f6ad55;
       --gray: #718096;
       --light: #f7fafc;
       --border: #e2e8f0;
       --text: #2d3748;
       --text-muted: #718096;
       --radius: 10px;
       --shadow: 0 1px 4px rgba(0,0,0,0.08);
       --shadow-md: 0 4px 16px rgba(0,0,0,0.1);
   }
   
   body { font-family: 'Segoe UI', Arial, sans-serif; background: #f5f7fa; color: var(--text); overflow: hidden; }
   
   /* ---- LAYOUT ---- */
   .app-wrap { display: flex; height: 100vh; overflow: hidden; }
   
   /* SIDEBAR */
   .sidebar {
       width: 260px; flex-shrink: 0;
       background: linear-gradient(180deg, #2d3748 0%, #1a202c 100%);
       color: white; display: flex; flex-direction: column;
       transition: transform .3s; z-index: 100;
   }
   .sidebar-header {
       padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,.1);
       display: flex; align-items: center; justify-content: space-between; gap: 8px;
   }
   .sidebar-brand { display: flex; align-items: center; gap: 10px; overflow: hidden; flex: 1; }
   .brand-logo { width: 44px; height: 44px; object-fit: contain; flex-shrink: 0; display: block; max-width: 44px; max-height: 44px; }
   .brand-text { display: flex; flex-direction: column; overflow: hidden; }
   .brand-name { font-size: 1.1em; font-weight: 700; line-height: 1.2; white-space: nowrap; }
   .brand-sub { font-size: 10px; opacity: .6; line-height: 1.35; margin-top: 2px; }
   .btn-minimize-sidebar {
       background: rgba(255,255,255,.1); border: none; color: white;
       width: 26px; height: 26px; border-radius: 6px; cursor: pointer;
       font-size: 12px; display: flex; align-items: center; justify-content: center;
       transition: background .2s;
   }
   .btn-minimize-sidebar:hover { background: rgba(255,255,255,.2); }
   .btn-close-sidebar { display: none; background: none; border: none; color: white; font-size: 22px; cursor: pointer; flex-shrink: 0; }
   
   /* MINIMIZED STATE */
   .sidebar.minimized { width: 64px; }
   .sidebar.minimized .brand-text,
   .sidebar.minimized .brand-sub,
   .sidebar.minimized .user-info .user-name,
   .sidebar.minimized .user-info .user-role,
   .sidebar.minimized .nav-label,
   .sidebar.minimized .sidebar-credit,
   .sidebar.minimized .btn-logout span:last-child { display: none; }
   .sidebar.minimized .brand-logo { width: 36px; height: 36px; max-width: 36px; max-height: 36px; }
   .sidebar.minimized .sidebar-brand { justify-content: center; }
   .sidebar.minimized .sidebar-header { justify-content: center; flex-direction: column; gap: 8px; }
   .sidebar.minimized .btn-minimize-sidebar { transform: rotate(180deg); }
   .sidebar.minimized .user-info { justify-content: center; padding: 12px 0; }
   .sidebar.minimized .nav-item { justify-content: center; padding: 14px 0; }
   .sidebar.minimized .nav-icon { font-size: 1.3em; }
   .sidebar.minimized .sidebar-footer { padding: 12px 8px; }
   .sidebar.minimized .btn-logout { justify-content: center; }
   .sidebar.minimized .btn-logout span:first-child { display: block; }
   
   .sidebar-user {
       padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,.1);
       display: flex; align-items: center; gap: 12px;
   }
   .user-avatar {
       width: 44px; height: 44px; background: var(--primary); border-radius: 50%;
       display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0;
   }
   .user-name { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
   .user-role { font-size: 11px; opacity: .6; text-transform: uppercase; letter-spacing: .5px; }
   
   .sidebar-nav { flex: 1; padding: 10px 0; overflow-y: auto; }
   .nav-item {
       display: flex; align-items: center; gap: 12px;
       padding: 12px 20px; color: rgba(255,255,255,.75);
       text-decoration: none; transition: all .2s;
       border-left: 3px solid transparent;
   }
   .nav-item:hover { background: var(--sidebar-hover); color: white; }
   .nav-item.active { background: var(--sidebar-active); color: white; border-left-color: var(--primary); }
   .nav-icon { font-size: 1.1em; flex-shrink: 0; }
   .nav-label { font-size: 14px; }
   
   .sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.1); }
   .sidebar-credit {
       text-align: center; color: rgba(255,255,255,.5); font-size: 12px;
       margin-bottom: 12px; padding: 8px; background: rgba(255,255,255,.05);
       border-radius: 8px; line-height: 1.5;
   }
   .sidebar-credit strong { color: rgba(255,255,255,.85); }
   .btn-logout {
       display: flex; align-items: center; justify-content: center; gap: 8px;
       width: 100%; padding: 11px; background: rgba(255,255,255,.1);
       color: white; text-decoration: none; border-radius: 8px;
       font-size: 14px; transition: background .2s;
   }
   .btn-logout:hover { background: rgba(255,255,255,.2); }
   
   /* MAIN WRAP */
   .main-wrap { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
   .topbar {
       height: 64px; background: white; border-bottom: 1px solid var(--border);
       display: flex; align-items: center; padding: 0 28px; gap: 16px; flex-shrink: 0;
   }
   .btn-hamburger { display: none; background: none; border: none; font-size: 22px; cursor: pointer; padding: 6px; }
   .topbar-title { font-size: 1.4em; color: var(--text); font-weight: 600; }
   .main-content { flex: 1; overflow-y: auto; padding: 28px; }
   
   /* ---- CARDS ---- */
   .card {
       background: white; border-radius: 12px;
       box-shadow: var(--shadow); padding: 24px; margin-bottom: 20px;
   }
   .card-header {
       display: flex; align-items: center; justify-content: space-between;
       margin-bottom: 20px; flex-wrap: wrap; gap: 10px;
   }
   .card-header h2 { font-size: 1.2em; color: var(--text); }
   .card-title { font-size: 1.1em; font-weight: 600; color: var(--text); margin-bottom: 14px; }
   
   /* ---- STATS ---- */
   .stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
   .stat-card { background: white; padding: 20px; border-radius: 12px; box-shadow: var(--shadow); }
   .stat-card h3 { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; font-weight: 500; }
   .stat-card .stat-num { color: var(--primary); font-size: 2.2em; font-weight: 700; line-height: 1; }
   
   /* ---- BUTTONS ---- */
   .btn {
       display: inline-flex; align-items: center; gap: 6px;
       padding: 9px 18px; border: none; border-radius: 8px;
       font-size: 14px; font-weight: 600; cursor: pointer; transition: all .2s;
       text-decoration: none;
   }
   .btn-primary { background: var(--primary); color: white; }
   .btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(102,126,234,.3); }
   .btn-success { background: var(--success); color: white; }
   .btn-success:hover { background: #38a169; }
   .btn-danger { background: var(--danger); color: white; }
   .btn-danger:hover { background: #e53e3e; }
   .btn-secondary { background: var(--gray); color: white; }
   .btn-secondary:hover { background: #4a5568; }
   .btn-sm { padding: 5px 12px; font-size: 12px; }
   
   /* ---- TABLE ---- */
   .table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
   table { width: 100%; border-collapse: collapse; }
   thead { background: var(--light); }
   th { padding: 11px 14px; text-align: left; font-size: 12px; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid var(--border); white-space: nowrap; }
   td { padding: 13px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
   tbody tr:last-child td { border-bottom: none; }
   tbody tr:hover { background: var(--light); }
   
   /* ---- BADGES ---- */
   .badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
   .badge-aktif, .badge-active, .badge-approved { background: #c6f6d5; color: #22543d; }
   .badge-pending { background: #fef3c7; color: #78350f; }
   .badge-selesai, .badge-cancelled, .badge-dibatalkan { background: #fed7d7; color: #742a2a; }
   .badge-terdaftar { background: #dbeafe; color: #1e40af; }
   .badge-pkl { background: #fef3c7; color: #78350f; }
   .badge-magang { background: #dbeafe; color: #1e40af; }
   .badge-baik { background: #c6f6d5; color: #22543d; }
   .badge-kurang { background: #fef3c7; color: #78350f; }
   .badge-rusak { background: #fed7d7; color: #742a2a; }
   
   /* ---- TABS ---- */
   .tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 20px; flex-wrap: wrap; }
   .tab-btn {
       padding: 11px 22px; background: none; border: none; border-bottom: 3px solid transparent;
       font-size: 14px; font-weight: 600; color: var(--text-muted); cursor: pointer; transition: all .2s;
   }
   .tab-btn:hover { color: var(--primary); }
   .tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
   .tab-count {
       display: inline-block; background: #edf2f7; color: #4a5568;
       padding: 1px 7px; border-radius: 10px; font-size: 11px; margin-left: 5px;
   }
   .tab-btn.active .tab-count { background: var(--primary); color: white; }
   
   /* ---- FORM ---- */
   .form-group { margin-bottom: 16px; }
   .form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 13px; color: var(--text); }
   .form-group input,
   .form-group select,
   .form-group textarea {
       width: 100%; padding: 10px 14px; border: 2px solid var(--border);
       border-radius: 8px; font-size: 14px; transition: border-color .2s;
       font-family: inherit;
   }
   .form-group input:focus,
   .form-group select:focus,
   .form-group textarea:focus { outline: none; border-color: var(--primary); }
   .form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
   
   /* ---- MODAL ---- */
   .modal-overlay {
       display: none; position: fixed; inset: 0;
       background: rgba(0,0,0,.55); z-index: 500;
       align-items: center; justify-content: center; padding: 20px;
   }
   .modal-overlay.show { display: flex; }
   .modal-box {
       background: white; border-radius: 14px; width: 100%;
       max-width: 580px; max-height: 90vh; overflow-y: auto;
   }
   .modal-header {
       padding: 22px 24px; border-bottom: 1px solid var(--border);
       display: flex; align-items: center; justify-content: space-between;
   }
   .modal-header h2 { font-size: 1.2em; }
   .btn-close { background: none; border: none; font-size: 26px; cursor: pointer; color: var(--text-muted); line-height: 1; }
   .btn-close:hover { color: var(--text); }
   .modal-body { padding: 24px; }
   .modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
   
   /* ---- LOADING / EMPTY ---- */
   .loading { text-align: center; padding: 50px 20px; color: var(--text-muted); }
   .spinner {
       width: 40px; height: 40px; border: 4px solid var(--border);
       border-top-color: var(--primary); border-radius: 50%;
       animation: spin 1s linear infinite; margin: 0 auto 16px;
   }
   @keyframes spin { to { transform: rotate(360deg); } }
   .empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
   .empty-state .empty-icon { font-size: 3.5em; opacity: .4; margin-bottom: 12px; }
   
   /* ---- FILTERS ---- */
   .filter-bar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; align-items: center; }
   .filter-bar input, .filter-bar select {
       padding: 9px 14px; border: 2px solid var(--border);
       border-radius: 8px; font-size: 14px; min-width: 180px;
   }
   .filter-bar input:focus, .filter-bar select:focus { outline: none; border-color: var(--primary); }
   
   /* ---- CALENDAR ---- */
   .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 14px; }
   .cal-header { text-align: center; font-weight: 600; font-size: 12px; padding: 8px; background: var(--light); color: var(--text-muted); border-radius: 6px; }
   .cal-day {
       aspect-ratio: 1; padding: 6px; border: 2px solid var(--border);
       border-radius: 8px; font-size: 13px; font-weight: 600;
       display: flex; align-items: center; justify-content: center; flex-direction: column;
       cursor: pointer; transition: border-color .2s;
   }
   .cal-day:hover { border-color: var(--primary); }
   .cal-day.empty { border-color: transparent; background: none; cursor: default; }
   .cal-day.has-booking { background: #fef3c7; border-color: #f59e0b; }
   .cal-day.has-kunjungan { background: #dbeafe; border-color: #3b82f6; }
   .cal-nav { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
   .cal-nav h3 { flex: 1; text-align: center; font-size: 1.1em; }
   
   /* ---- CHARTS ---- */
   .charts-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 20px; }
   .chart-box { background: white; border-radius: 12px; box-shadow: var(--shadow); padding: 20px; }
   .chart-title { font-size: 14px; font-weight: 600; margin-bottom: 14px; color: var(--text); }
   .chart-wrap { height: 220px; position: relative; }
   
   /* ---- RESPONSIVE ---- */
   @media (max-width: 900px) {
       body { overflow: auto; }
       .app-wrap { flex-direction: column; height: auto; min-height: 100vh; }
       .sidebar {
           position: fixed; left: 0; top: 0; height: 100vh;
           transform: translateX(-100%);
       }
       .sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,.3); }
       .btn-close-sidebar { display: block; }
       .btn-hamburger { display: block; }
       .main-wrap { width: 100%; }
       .main-content { padding: 16px; }
       .stats-grid { grid-template-columns: repeat(2, 1fr); }
   }