/* ==========================================================================
   RETURN CONTROL CENTER — COLOR SYSTEM & MODERN UI SPECIFICATIONS
   ========================================================================== */

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --background: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0284c7;
  --purple: #9333ea;
  --radius: 10px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  background-color: var(--background);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* UTILITIES & HELPER CLASSES */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-2 { margin-top: 0.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.p-0 { padding: 0 !important; }
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }
.span-2 { grid-column: span 2; }
.muted { color: var(--muted); font-size: 0.875rem; }
.text-danger { color: var(--danger); }

/* TOAST NOTIFICATIONS */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #ffffff;
  border-left: 4px solid var(--primary);
  padding: 12px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  animation: slideIn 0.3s ease;
}

.toast.toast-success { border-left-color: var(--success); }
.toast.toast-danger { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary { background: var(--primary); color: #ffffff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #ffffff; border-color: var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--background); }
.btn-light { background: #ffffff; color: var(--primary); font-weight: 700; }
.btn-danger { background: var(--danger); color: #ffffff; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { background: transparent; border: none; cursor: pointer; color: var(--muted); padding: 4px; border-radius: 4px; }
.btn-icon:hover { color: var(--text); background: var(--border); }

/* BADGES & KONDISI */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #e0f2fe; color: #075985; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-purple { background: #f3e8ff; color: #6b21a8; }

/* LOGIN PAGE */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
  padding: 20px;
}

.login-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.3);
}

.login-brand { text-align: center; margin-bottom: 30px; }
.brand-logo-icon {
  width: 56px;
  height: 56px;
  background: var(--primary);
  color: white;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.login-brand h1 { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.5px; }
.login-brand p { font-size: 0.85rem; color: var(--muted); }

/* APP LAYOUT */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: #ffffff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: all 0.3s ease;
}

.sidebar-header {
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo { display: flex; align-items: center; gap: 12px; }
.sidebar-logo i { color: var(--primary); }
.sidebar-logo h2 { font-size: 0.95rem; font-weight: 800; }
.sidebar-logo span { font-size: 0.7rem; color: var(--muted); display: block; }

.mobile-close-btn { display: none; background: none; border: none; cursor: pointer; }

.sidebar-menu {
  padding: 16px 12px;
  flex: 1;
  overflow-y: auto;
}

.menu-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.05em;
  margin: 16px 12px 6px 12px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius);
  transition: all 0.15s ease;
}

.menu-item:hover { background: var(--background); color: var(--text); }
.menu-item.active { background: #e0e7ff; color: var(--primary); }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-info { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.user-details p { font-size: 0.8rem; font-weight: 700; line-height: 1.1; }
.user-role-badge { font-size: 0.65rem; color: var(--muted); text-transform: uppercase; font-weight: 600; }

.btn-logout { background: none; border: none; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 6px; }
.btn-logout:hover { color: var(--danger); background: #fee2e2; }

/* MAIN CONTENT CONTAINER */
.main-content {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.top-header {
  height: 64px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.header-left { display: flex; align-items: center; gap: 16px; }
.mobile-menu-btn { display: none; background: none; border: none; cursor: pointer; }
.top-header h2 { font-size: 1.1rem; font-weight: 700; }
.date-display { font-size: 0.85rem; color: var(--muted); font-weight: 500; }

.content-body { padding: 28px; flex: 1; }

/* QUICK ACTION BAR */
.quick-action-bar {
  background: linear-gradient(135deg, var(--primary) 0%, #3730a3 100%);
  border-radius: 12px;
  padding: 24px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.quick-text h3 { font-size: 1.2rem; font-weight: 700; }
.quick-text p { font-size: 0.85rem; opacity: 0.8; }
.action-buttons { display: flex; gap: 12px; }

/* METRICS GRID */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.metric-card {
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.metric-icon {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}
.bg-blue { background: var(--primary); }
.bg-warning { background: var(--warning); }
.bg-info { background: var(--info); }
.bg-success { background: var(--success); }
.bg-danger { background: var(--danger); }
.bg-purple { background: var(--purple); }

.metric-label { font-size: 0.75rem; color: var(--muted); font-weight: 600; }
.metric-data h2 { font-size: 1.4rem; font-weight: 800; line-height: 1; margin-top: 2px; }

/* CHARTS GRID */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.chart-card { padding: 20px; }
.card-header { margin-bottom: 16px; }
.card-header h3 { font-size: 0.95rem; font-weight: 700; }
.card-header-actions {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* FORMS & SECTIONS */
.form-section {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}
.section-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.8rem; font-weight: 600; margin-bottom: 6px; }

.form-control {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
  outline: none;
  transition: all 0.2s ease;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1); }

.input-icon-wrapper { position: relative; display: flex; align-items: center; }
.input-icon-wrapper i { position: absolute; left: 12px; color: var(--muted); pointer-events: none; width: 18px; }
.input-icon-wrapper .form-control { padding-left: 38px; }
.btn-toggle-pwd { position: absolute; right: 10px; background: none; border: none; cursor: pointer; color: var(--muted); }

.input-group { display: flex; gap: 8px; }
.input-group .form-control { flex: 1; }

.photo-preview-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.photo-thumb {
  width: 70px;
  height: 70px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border);
}

/* TABLES */
.table-responsive { width: 100%; overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}
.table th { background: #f8fafc; padding: 12px 16px; font-weight: 700; color: var(--muted); border-bottom: 1px solid var(--border); }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover { background: #f1f5f9; }
.table-bordered { border: 1px solid var(--border); }
.table-bordered th, .table-bordered td { border: 1px solid var(--border); }

.filter-panel { padding: 16px 20px; background: #f8fafc; border-bottom: 1px solid var(--border); }
.filter-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

/* MODALS */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6); z-index: 1000; }
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  z-index: 1001;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-lg { max-width: 800px; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-body { padding: 20px; max-height: 75vh; overflow-y: auto; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; background: #f8fafc; }

/* TABS */
.tabs-header { display: flex; border-bottom: 1px solid var(--border); gap: 4px; margin-bottom: 16px; }
.tab-btn {
  padding: 10px 18px;
  background: none;
  border: none;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* PRINT STYLES */
@media print {
  body * { visibility: hidden; }
  #detail-modal-body, #detail-modal-body * { visibility: visible; }
  #detail-modal-body { position: absolute; left: 0; top: 0; width: 100%; }
  .modal-footer, .top-header, .sidebar, .toast-container { display: none !important; }
}

/* RESPONSIVE DESIGN */
@media (max-width: 1024px) {
  .charts-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .form-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .mobile-close-btn, .mobile-menu-btn { display: block; }
  .main-content { margin-left: 0; }
  .form-grid-2, .form-grid-3, .filter-grid { grid-template-columns: 1fr; }
  .quick-action-bar { flex-direction: column; text-align: center; gap: 16px; }
  .col-span-3 { grid-column: span 1; }
}