/* =========================================================================
   MESS PURI INDAH - PREMIUM SAAS STYLE 
   Theme: Blue Crystal, Glassmorphism, Dark Mode Ready
   ========================================================================= */

   :root {
    /* Colors (Light Mode) */
    --primary: #3B82F6;
    --primary-hover: #2563EB;
    --secondary: #60A5FA;
    --bg-color: #EDF6FF; /* Very light blue background */
    --text-main: #1F2937;
    --text-muted: #6B7280;
    --panel-bg: rgba(255, 255, 255, 0.7);
    --panel-border: rgba(255, 255, 255, 0.4);
    
    /* Semantic Colors */
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --info: #0EA5E9;
  
    /* Shadows */
    --soft-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.1), 0 8px 10px -6px rgba(59, 130, 246, 0.1);
    --hover-shadow: 0 20px 25px -5px rgba(59, 130, 246, 0.15), 0 8px 10px -6px rgba(59, 130, 246, 0.1);
    
    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  
    /* Sizes */
    --sidebar-width: 260px;
    --header-height: 70px;
    --border-radius: 16px;
  }
  
  body.dark-mode {
    --bg-color: #0F172A;
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --panel-bg: rgba(30, 41, 59, 0.7);
    --panel-border: rgba(255, 255, 255, 0.05);
    --soft-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    --hover-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
  }
  
  /* ==================== GLOBAL STYLES ==================== */
  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
  }
  
  body {
    background-color: var(--bg-color);
    color: var(--text-main);
    background-image: radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.08), transparent 25%),
                      radial-gradient(circle at 85% 30%, rgba(96, 165, 250, 0.08), transparent 25%);
    background-attachment: fixed;
    transition: var(--transition);
    min-height: 100vh;
    overflow-x: hidden;
  }
  
  a { text-decoration: none; color: inherit; }
  ul { list-style: none; }
  
  /* Glassmorphism Panel */
  .glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: var(--border-radius);
    box-shadow: var(--soft-shadow);
    transition: var(--transition);
  }
  
  /* ==================== TYPOGRAPHY & UTILS ==================== */
  h1, h2, h3, h4 { color: var(--text-main); font-weight: 600; }
  p { color: var(--text-muted); }
  .text-primary { color: var(--primary) !important; }
  .text-danger { color: var(--danger) !important; }
  .text-success { color: var(--success) !important; }
  .text-warning { color: var(--warning) !important; }
  .text-dark { color: #1F2937 !important; }
  
  .flex-between { display: flex; justify-content: space-between; align-items: center; }
  .mt-4 { margin-top: 1.5rem; }
  .mb-4 { margin-bottom: 1.5rem; }
  .mb-2 { margin-bottom: 0.5rem; }
  .p-4 { padding: 1.5rem; }
  .text-center { text-align: center; }
  
  /* ==================== BUTTONS ==================== */
  .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
    outline: none;
  }
  
  .btn-primary { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: #fff; }
  .btn-primary:hover { box-shadow: 0 4px 12px rgba(59,130,246,0.4); transform: translateY(-2px); }
  
  .btn-success { background: linear-gradient(135deg, #10B981, #34D399); color: #fff; }
  .btn-success:hover { box-shadow: 0 4px 12px rgba(16,185,129,0.4); transform: translateY(-2px); }
  
  .btn-danger { background: linear-gradient(135deg, #EF4444, #F87171); color: #fff; }
  .btn-outline-primary {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
  }
  .btn-outline-primary:hover { background: var(--primary); color: #fff; }
  
  .btn-block { width: 100%; justify-content: center; }
  .icon-btn {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: var(--transition);
  }
  .icon-btn:hover { background: rgba(0,0,0,0.05); }
  body.dark-mode .icon-btn:hover { background: rgba(255,255,255,0.1); }
  
  /* ==================== FORM ELEMENTS ==================== */
  .form-group { margin-bottom: 1rem; text-align: left; }
  .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-main);
    font-weight: 500;
  }
  .form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #D1D5DB; /* Clearer border */
    border-radius: 8px;
    background: #FFFFFF; /* White background for inputs */
    color: var(--text-main);
    font-size: 0.95rem;
    transition: var(--transition);
  }
  body.dark-mode .form-group input, body.dark-mode .form-group select, body.dark-mode .form-group textarea {
    border-color: var(--panel-border);
    background: var(--panel-bg);
  }
  .form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
  }
  
  /* ==================== LOGIN PAGE ==================== */
  .login-container {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, rgba(59,130,246,0.1), rgba(96,165,250,0.1));
  }
  .login-card {
    width: 100%;
    max-width: 400px;
    padding: 40px 30px;
    text-align: center;
  }
  .login-logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 20px;
    color: white;
    font-size: 2rem;
    box-shadow: 0 8px 16px rgba(59,130,246,0.3);
  }
  .login-card h2 { margin-bottom: 5px; }
  .login-card .subtitle { margin-bottom: 30px; font-size: 0.9rem; }
  
  /* ==================== LAYOUT (SIDEBAR & HEADER) ==================== */
  .app-layout { display: flex; height: 100vh; overflow: hidden; }
  
  .sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    z-index: 1000;
    flex-shrink: 0;
    border-radius: 0; /* Attach to left */
    border-top: none; border-bottom: none; border-left: none;
    background: var(--panel-bg);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  .sidebar-overlay.show { display: block; opacity: 1; }
  
  .sidebar-header {
    display: flex;
    align-items: center;
    padding: 0 24px 30px;
    gap: 15px;
  }
  .logo-icon {
    font-size: 1.8rem;
    color: var(--primary);
    background: rgba(59,130,246,0.1);
    padding: 10px;
    border-radius: 12px;
  }
  .logo-text { font-size: 1.2rem; font-weight: 700; color: var(--text-main); letter-spacing: 1px; }
  
  .sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 5px; padding: 0 15px; }
  .nav-link {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 20px;
    color: var(--text-muted);
    border-radius: 10px;
    font-weight: 500;
    transition: var(--transition);
  }
  .nav-link i { font-size: 1.1rem; width: 20px; text-align: center; }
  .nav-link:hover { background: rgba(59,130,246,0.05); color: var(--primary); }
  .nav-link.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 12px rgba(59,130,246,0.3);
  }
  
  .sidebar-footer { padding: 20px 15px 0; }
  
  .main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
  }
  
  /* Header */
  .header {
    height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    margin: 15px 20px 0;
    z-index: 5;
  }
  
  .mobile-only { display: none; }
  
  .realtime-clock {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    color: var(--primary);
  }
  .date-divider { color: var(--text-muted); }
  
  .header-right { display: flex; align-items: center; gap: 20px; }
  .user-profile { display: flex; align-items: center; gap: 12px; }
  .avatar {
    width: 40px; height: 40px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    font-size: 1.2rem;
  }
  .user-info { display: flex; flex-direction: column; }
  .user-name { font-weight: 600; font-size: 0.95rem; line-height: 1.2; }
  .user-role { font-size: 0.8rem; color: var(--text-muted); }
  
  /* ==================== PAGES ==================== */
  .pages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
  }
  
  .page-section { display: none; animation: fadeIn 0.4s ease forwards; }
  .page-section.active { display: block; }
  @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
  
  .page-header { margin-bottom: 25px; }
  .page-header h2 { font-size: 1.8rem; margin-bottom: 5px; }
  
  /* ==================== DASHBOARD WIDGETS ==================== */
  .summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
  }
  .summary-card {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
  }
  .summary-card:hover { transform: translateY(-5px); box-shadow: var(--hover-shadow); }
  
  .card-icon {
    width: 50px; height: 50px;
    border-radius: 12px;
    background: rgba(255,255,255,0.2);
    display: flex; justify-content: center; align-items: center;
    font-size: 1.5rem;
    color: white;
  }
  .card-info h3 { font-size: 0.9rem; font-weight: 500; margin-bottom: 5px; opacity: 0.9; color: white; }
  .card-info h2 { font-size: 1.8rem; margin: 0; color: white; }
  
  /* Gradients for cards */
  .primary-gradient { background: linear-gradient(135deg, #3B82F6, #2563EB); color: white; border: none; }
  .danger-gradient { background: linear-gradient(135deg, #EF4444, #DC2626); color: white; border: none;}
  .warning-gradient { background: linear-gradient(135deg, #F59E0B, #D97706); color: white; border: none;}
  .success-gradient { background: linear-gradient(135deg, #10B981, #059669); color: white; border: none;}
  .info-gradient { background: linear-gradient(135deg, #0EA5E9, #0284C7); color: white; border: none;}
  
  .widget-container {
    display: flex;
    justify-content: space-around;
    padding: 15px;
    flex-wrap: wrap;
    gap: 15px;
  }
  .widget-item {
    text-align: center;
    flex: 1;
    min-width: 150px;
  }
  .widget-item span { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 5px; }
  .widget-item strong { font-size: 1.4rem; color: var(--primary); }
  
  .charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
  }
  .chart-card { padding: 20px; }
  .chart-card h3 { font-size: 1.1rem; margin-bottom: 15px; }
  
  .activity-list { max-height: 300px; overflow-y: auto; padding-right: 10px; }
  .activity-list li {
    padding: 12px;
    border-bottom: 1px solid var(--panel-border);
    display: flex; justify-content: space-between;
    font-size: 0.9rem;
  }
  .activity-list li:last-child { border-bottom: none; }
  .activity-list li .time { font-size: 0.8rem; color: var(--text-muted); }
  
  /* ==================== DATATABLES CUSTOMIZATION ==================== */
  .table-container { padding: 20px; overflow-x: auto; }
  .dataTables_wrapper .dataTables_length, .dataTables_wrapper .dataTables_filter, 
  .dataTables_wrapper .dataTables_info, .dataTables_wrapper .dataTables_processing, 
  .dataTables_wrapper .dataTables_paginate {
    color: var(--text-main) !important;
    margin-bottom: 15px;
  }
  .dataTables_wrapper .dataTables_filter input, .dataTables_wrapper .dataTables_length select {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    color: var(--text-main);
    border-radius: 6px;
    padding: 5px 10px;
  }
  
  table.dataTable { border-collapse: collapse; width: 100%; color: var(--text-main); }
  table.dataTable thead th {
    background: rgba(59,130,246,0.1);
    color: var(--text-main);
    padding: 12px;
    border-bottom: 2px solid var(--primary);
  }
  table.dataTable tbody td {
    padding: 12px;
    border-bottom: 1px solid var(--panel-border);
    background: transparent !important;
  }
  table.dataTable tbody tr:hover td { background: rgba(59,130,246,0.05) !important; }
  table.dataTable tbody tr { background: transparent !important; }
  
  .dataTables_wrapper .dataTables_paginate .paginate_button {
    background: transparent !important;
    border: 1px solid var(--panel-border) !important;
    color: var(--text-main) !important;
    border-radius: 6px;
  }
  .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
  }
  
  /* Badges */
  .badge { padding: 4px 10px; border-radius: 20px; font-size: 0.8rem; font-weight: 500; }
  .badge-success { background: rgba(16,185,129,0.15); color: var(--success); }
  .badge-danger { background: rgba(239,68,68,0.15); color: var(--danger); }
  .badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
  .badge-info { background: rgba(14,165,233,0.15); color: var(--info); }
  
  /* Settings Grid */
  .settings-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
  
  /* ==================== CUSTOM MODALS ==================== */
  .custom-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.3s ease;
  }
  .custom-modal {
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    background: #F8FAFC; /* Solid, clean background */
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  }
  body.dark-mode .custom-modal {
    background: #1E293B;
  }
  .modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: inherit;
    z-index: 10;
  }
  body.dark-mode .modal-header { border-bottom-color: rgba(255,255,255,0.05); }
  .modal-header h3 { margin: 0; font-size: 1.25rem; }
  .close-modal-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
  }
  .close-modal-btn:hover { color: var(--danger); }
  .modal-body { padding: 25px; }
  .modal-footer {
    padding: 15px 25px;
    border-top: 1px solid rgba(0,0,0,0.05);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    position: sticky;
    bottom: 0;
    background: inherit;
    z-index: 10;
  }
  body.dark-mode .modal-footer { border-top-color: rgba(255,255,255,0.05); }
  
  .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }
  .form-grid .form-group { margin-bottom: 0; }
  .form-grid .full-width { grid-column: span 2; }
  .bg-light { background: #E5E7EB !important; color: var(--text-muted); cursor: not-allowed; }
  body.dark-mode .bg-light { background: #334155 !important; }

  /* Responsive */
  @media (max-width: 1024px) {
    .charts-grid { grid-template-columns: 1fr; }
    .settings-grid { grid-template-columns: 1fr; }
  }
  @media (max-width: 768px) {
    .mobile-only { display: block; }
    .sidebar {
      position: fixed;
      top: 0;
      left: 0;
      transform: translateX(-100%);
      box-shadow: var(--hover-shadow);
      width: 280px;
    }
    .sidebar.open {
      transform: translateX(0);
    }
    .header { padding: 0 15px; margin: 10px 10px 0; }
    .user-name, .user-role, .date-divider, #dateDisplay { display: none; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .full-width { grid-column: span 1; }
  }
