/* ============================================================
   SIMKOPDES — Custom Stylesheet (Red & White Theme)
   Bootstrap 5 base, light theme with red accents
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* ---------- CSS Variables ---------- */
:root {
  --primary:        #dc2626; /* Red 600 */
  --primary-light:  #ef4444; /* Red 500 */
  --primary-dark:   #991b1b; /* Red 800 */
  --secondary:      #2563eb; /* Blue for contrast/info */
  --accent:         #f59e0b;
  --success:        #10b981;
  --danger:         #ef4444;
  --warning:        #f59e0b;
  --info:           #06b6d4;

  --bg-dark:        #f8fafc; /* Light Gray Background (Renamed variable for compatibility) */
  --bg-card:        #ffffff; /* White Card */
  --bg-card2:       #f1f5f9;
  --border-color:   #e2e8f0;
  --text-main:      #0f172a;
  --text-muted:     #64748b;
  --text-light:     #334155;

  --sidebar-w:      260px;
  --radius:         14px;
  --radius-sm:      8px;
  --shadow:         0 4px 24px rgba(0,0,0,.08);
  --shadow-sm:      0 2px 10px rgba(0,0,0,.05);
  --transition:     all .25s ease;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.65;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: rgba(220, 38, 38, 0.5); border-radius: 99px; }

/* ============================================================
   AUTH PAGES (login, register, lupa password)
   ============================================================ */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(220, 38, 38, .1) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(37, 99, 235, .05) 0%, transparent 50%),
    var(--bg-dark);
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.auth-brand {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  padding: 36px 32px 28px;
  text-align: center;
}

.auth-brand .logo-icon {
  width: 60px; height: 60px;
  background: rgba(255,255,255,.2);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  font-size: 28px;
}

.auth-brand h1 {
  font-size: 1.5rem; font-weight: 800;
  color: #fff; margin-bottom: 4px;
}

.auth-brand p { color: rgba(255,255,255,.9); font-size: .85rem; }

.auth-body { padding: 32px; }

/* Nav tabs for auth */
.auth-tabs .nav-link {
  color: var(--text-muted); font-weight: 600;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  padding: .6rem 1.2rem;
  border: none; background: transparent;
  transition: var(--transition);
}
.auth-tabs .nav-link.active {
  background: var(--primary);
  color: #fff;
}

/* ============================================================
   LAYOUT — SIDEBAR + CONTENT
   ============================================================ */
.app-wrapper { display: flex; min-height: 100vh; }

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 1000;
  transition: transform .3s ease;
  box-shadow: 2px 0 10px rgba(0,0,0,.02);
}

.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}

.sidebar-brand .brand-name {
  font-size: 1.1rem; font-weight: 800;
  color: #fff; letter-spacing: .5px;
}

.sidebar-brand .brand-sub {
  font-size: .72rem; color: rgba(255,255,255,.8);
  font-weight: 500;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 16px 12px; }

.nav-section-label {
  font-size: .65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-muted);
  padding: 16px 8px 6px;
}

.sidebar-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-light);
  font-weight: 600; font-size: .88rem;
  margin-bottom: 2px;
  transition: var(--transition);
  position: relative;
}

.sidebar-link:hover {
  background: var(--bg-card2);
  color: var(--primary);
}

.sidebar-link.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  box-shadow: 0 4px 15px rgba(220, 38, 38, .3);
}

.sidebar-link .icon {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  flex-shrink: 0;
  background: var(--bg-card2);
  color: var(--text-muted);
  transition: var(--transition);
}

.sidebar-link:hover .icon {
  background: rgba(220,38,38,.1);
  color: var(--primary);
}

.sidebar-link.active .icon { 
  background: rgba(255,255,255,.2); 
  color: #fff;
}

.sidebar-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff; font-size: .65rem; font-weight: 700;
  padding: 2px 7px; border-radius: 99px;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border-color);
}

.user-info-sidebar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: var(--radius-sm);
  background: var(--bg-card2);
}

.user-avatar {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem; color: #fff;
  flex-shrink: 0;
}

.user-name-sidebar { font-weight: 700; font-size: .85rem; line-height: 1.2; color: var(--text-main); }
.user-role-sidebar { font-size: .7rem; color: var(--text-muted); font-weight: 500; }

/* --- Main Content --- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex; flex-direction: column;
  min-height: 100vh;
}

/* --- Top Bar --- */
.topbar {
  height: 64px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 900;
  box-shadow: 0 2px 5px rgba(0,0,0,.02);
}

.page-title { font-size: 1.1rem; font-weight: 800; color: var(--text-main); }
.page-breadcrumb { font-size: .8rem; color: var(--text-muted); font-weight: 500; }

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.btn-icon {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--bg-card2);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer; transition: var(--transition);
}
.btn-icon:hover { background: var(--border-color); color: var(--text-main); }

/* --- Page Content --- */
.page-content { padding: 28px; flex: 1; }

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--primary-light);
}

.stat-card::before {
  content: '';
  position: absolute; inset: 0;
  opacity: 0; transition: opacity .3s;
  border-radius: inherit;
}

.stat-card:hover::before { opacity: 1; }

.stat-icon {
  width: 50px; height: 50px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; margin-bottom: 14px;
}

.stat-icon.purple  { background: rgba(220,38,38,.1);  color: var(--primary); }
.stat-icon.cyan    { background: rgba(37,99,235,.1);  color: var(--secondary); }
.stat-icon.green   { background: rgba(16,185,129,.1); color: var(--success); }
.stat-icon.amber   { background: rgba(245,158,11,.1); color: var(--warning); }
.stat-icon.red     { background: rgba(239,68,68,.1);  color: var(--danger); }

.stat-value {
  font-size: 1.6rem; font-weight: 800;
  color: var(--text-main); line-height: 1.1;
  margin-bottom: 4px;
}

.stat-label { font-size: .8rem; color: var(--text-muted); font-weight: 600; }

.stat-trend {
  position: absolute; top: 18px; right: 18px;
  font-size: .75rem; font-weight: 700; padding: 3px 8px;
  border-radius: 99px;
}
.stat-trend.up   { background: rgba(16,185,129,.15); color: var(--success); }
.stat-trend.down { background: rgba(239,68,68,.15);  color: var(--danger); }

/* ============================================================
   CARDS (Renamed from dark to light implicitly)
   ============================================================ */
.card-dark {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.card-dark .card-header-dark {
  padding: 18px 22px;
  background: var(--bg-card2);
  border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
}

.card-dark .card-title-dark {
  font-weight: 800; font-size: .95rem; color: var(--text-main);
}

.card-dark .card-body-dark { padding: 22px; }

/* ============================================================
   TABLES
   ============================================================ */
.table-dark-custom {
  width: 100%; border-collapse: separate;
  border-spacing: 0;
  color: var(--text-main);
}

.table-dark-custom thead th {
  background: var(--bg-card2);
  color: var(--text-muted);
  font-size: .75rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .7px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.table-dark-custom tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  font-size: .875rem;
  color: var(--text-main);
}

.table-dark-custom tbody tr:last-child td { border-bottom: none; }

.table-dark-custom tbody tr:hover { background: var(--bg-card2); }

/* ============================================================
   FORMS
   ============================================================ */
.form-control-dark, .form-select-dark {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: var(--text-main) !important;
  border-radius: var(--radius-sm) !important;
  padding: .625rem .875rem !important;
  transition: var(--transition) !important;
  font-size: .875rem !important;
}

.form-control-dark:focus, .form-select-dark:focus {
  background: #ffffff !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(220,38,38,.15) !important;
  outline: none !important;
}

.form-control-dark::placeholder { color: #94a3b8 !important; }
.form-label-dark { font-size: .82rem; font-weight: 700; color: var(--text-light); margin-bottom: 6px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary-custom {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border: none; color: #fff; font-weight: 700;
  border-radius: var(--radius-sm); padding: .6rem 1.4rem;
  transition: var(--transition); cursor: pointer;
  font-size: .875rem;
  box-shadow: 0 2px 8px rgba(220,38,38,.25);
}
.btn-primary-custom:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(220,38,38,.4);
  color: #fff;
}

.btn-success-custom {
  background: linear-gradient(135deg, #059669, var(--success));
  border: none; color: #fff; font-weight: 700;
  border-radius: var(--radius-sm); padding: .45rem 1rem;
  transition: var(--transition); cursor: pointer; font-size: .8rem;
  box-shadow: 0 2px 8px rgba(16,185,129,.25);
}
.btn-success-custom:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(16,185,129,.4); color: #fff; }

.btn-danger-custom {
  background: linear-gradient(135deg, #dc2626, var(--danger));
  border: none; color: #fff; font-weight: 700;
  border-radius: var(--radius-sm); padding: .45rem 1rem;
  transition: var(--transition); cursor: pointer; font-size: .8rem;
  box-shadow: 0 2px 8px rgba(239,68,68,.25);
}
.btn-danger-custom:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(239,68,68,.4); color: #fff; }

.btn-wa {
  background: linear-gradient(135deg, #16a34a, #22c55e);
  border: none; color: #fff; font-weight: 700;
  border-radius: var(--radius-sm); padding: .45rem 1rem;
  transition: var(--transition); cursor: pointer; font-size: .8rem;
  display: inline-flex; align-items: center; gap: 5px;
  box-shadow: 0 2px 8px rgba(34,197,94,.25);
}
.btn-wa:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(34,197,94,.4); color: #fff; }

/* ============================================================
   BADGES
   ============================================================ */
.badge { font-size: .72rem; font-weight: 800; padding: .4em .8em; border-radius: 99px; }

/* ============================================================
   PREVIEW KALKULASI
   ============================================================ */
.kalkulator-preview {
  background: rgba(220,38,38,.05);
  border: 1px solid rgba(220,38,38,.2);
  border-radius: var(--radius);
  padding: 20px;
  display: none;
}
.kalkulator-preview.show { display: block; }

.calc-row {
  display: flex; justify-content: space-between;
  padding: 7px 0; font-size: .875rem;
  border-bottom: 1px solid var(--border-color);
}
.calc-row:last-child { border-bottom: none; }
.calc-row.total {
  font-weight: 800; font-size: 1.1rem; color: var(--text-main);
  padding-top: 12px;
}
.calc-label { color: var(--text-muted); font-weight: 600; }
.calc-value { color: var(--text-main); font-weight: 700; }
.calc-value.highlight { color: var(--primary); font-size: 1.1rem; }

/* ============================================================
   UPLOAD AREA
   ============================================================ */
.upload-area {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius);
  padding: 40px 20px; text-align: center;
  cursor: pointer; transition: var(--transition);
  position: relative;
  background: #f8fafc;
}
.upload-area:hover { border-color: var(--primary); background: rgba(220,38,38,.05); }
.upload-area input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}
.upload-icon { font-size: 2.5rem; margin-bottom: 10px; opacity: .8; }
.upload-preview img { max-height: 200px; border-radius: var(--radius-sm); object-fit: cover; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center; padding: 60px 20px;
}
.empty-state .empty-icon { font-size: 3.5rem; opacity: .5; margin-bottom: 14px; }
.empty-state p { color: var(--text-muted); font-size: .95rem; font-weight: 600; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-content {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius) !important;
  color: var(--text-main) !important;
  box-shadow: 0 10px 40px rgba(0,0,0,.1) !important;
}
.modal-header { border-bottom: 1px solid var(--border-color) !important; }
.modal-footer { border-top: 1px solid var(--border-color) !important; }

/* ============================================================
   LIGHTBOX IMAGE PREVIEW
   ============================================================ */
.bukti-thumb {
  width: 60px; height: 60px; border-radius: var(--radius-sm);
  object-fit: cover; cursor: pointer;
  border: 2px solid var(--border-color);
  transition: var(--transition);
}
.bukti-thumb:hover { border-color: var(--primary); transform: scale(1.05); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 40px rgba(0,0,0,.15);
  }
  .main-content {
    margin-left: 0;
  }
  
  .page-content { padding: 16px; }
  .topbar { padding: 0 16px; }
  
  .stat-value { font-size: 1.3rem; }
  .stat-card { padding: 16px; }
  
  .card-dark .card-header-dark { padding: 14px 16px; }
  .card-dark .card-body-dark { padding: 16px; }
  
  .auth-body { padding: 20px; }
  .auth-brand { padding: 24px 20px 20px; }
  
  /* Helper overrides for inline styles on mobile */
  .p-md-28 { padding: 16px 16px !important; }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.text-muted-custom { color: var(--text-muted) !important; }
.text-primary-custom { color: var(--primary) !important; }
.border-dark-custom { border-color: var(--border-color) !important; }
.bg-card { background: var(--bg-card) !important; }
.rounded-custom { border-radius: var(--radius) !important; }
.fw-800 { font-weight: 800 !important; }
.gap-2 { gap: .5rem; }

/* Gradient text */
.gradient-text {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Pulse animation for pending */
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}
.pulse { animation: pulse-dot 1.5s ease infinite; }

/* Shimmer loading skeleton */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
