/* ============ ROOT VARIABLES ============ */
:root {
  --umt-blue: #1565C0;
  --umt-dark: #0D47A1;
  --umt-mid: #1976D2;
  --umt-gold: #F5C518;
  --sidebar-width: 260px;
  --sidebar-bg: #0a1855;
  --sidebar-text: rgba(255,255,255,0.75);
  --sidebar-hover: rgba(21,101,192,0.18);
  --sidebar-active: rgba(21,101,192,0.28);
  --topbar-height: 60px;
  --bg-main: #f0f2f5;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
}

/* ============ RESET & BASE ============ */
* { box-sizing: border-box; }
body { background: var(--bg-main); font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif; color: #1a1a2e; }

/* ============ LAYOUT ============ */
.wrapper { min-height: 100vh; }

/* ============ SIDEBAR ============ */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 1000;
  transition: transform .3s ease;
  overflow-y: auto;
}

.sidebar-header {
  padding: 1.25rem 1rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.logo {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
}

/* Logo icons row: UMT + WA badge */
.logo-icons {
  position: relative;
  flex-shrink: 0;
}
.logo-umt-img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--umt-gold);
  display: block;
  object-fit: cover;
}
.logo-wa-badge {
  position: absolute;
  bottom: -4px;
  right: -8px;
  width: 22px;
  height: 22px;
  background: #25D366;
  border-radius: 50%;
  border: 2px solid var(--sidebar-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .65rem;
  color: white;
}
.logo-text-wrap {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.logo-text-main {
  font-size: 1.1rem;
  font-weight: 800;
  color: white;
  letter-spacing: -.3px;
}
.logo-text-sub {
  font-size: .58rem;
  color: rgba(255,255,255,.45);
  letter-spacing: .5px;
  text-transform: uppercase;
}

/* Sidebar footer */
.sidebar-footer {
  padding: .85rem 1rem;
  border-top: 1px solid rgba(255,255,255,.06);
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: .6rem;
}
.sidebar-footer-logo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--umt-gold);
  object-fit: cover;
}
.sidebar-footer-text {
  font-size: .62rem;
  color: rgba(255,255,255,.4);
  line-height: 1.3;
}

.user-info {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem .75rem;
  background: rgba(255,255,255,.06);
  border-radius: 10px;
}

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

.user-detail { overflow: hidden; }
.user-name { font-size: .85rem; color: white; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge-sm { font-size: .6rem; }

/* Sidebar Menu */
.sidebar-menu {
  list-style: none;
  padding: .75rem 0;
  margin: 0;
  flex: 1;
}

.menu-label {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: rgba(255,255,255,.35);
  padding: .75rem 1.25rem .25rem;
  text-transform: uppercase;
}

.sidebar-menu li a {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1.25rem;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: .88rem;
  border-radius: 0;
  transition: all .2s;
  margin: 1px 0;
}

.sidebar-menu li a i { font-size: 1.05rem; width: 20px; text-align: center; }
.sidebar-menu li a:hover { background: var(--sidebar-hover); color: white; }
.sidebar-menu li a.active { background: var(--sidebar-active); color: var(--umt-gold); font-weight: 600; border-right: 3px solid var(--umt-gold); }
.sidebar-menu li a.text-danger-hover:hover { color: #ff6b6b !important; background: rgba(255,107,107,.1); }

/* ============ MAIN CONTENT ============ */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============ TOPBAR ============ */
.topbar {
  height: var(--topbar-height);
  background: white;
  border-bottom: 1px solid #e8ecf0;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 8px rgba(0,0,0,.06);
}

.sidebar-toggle { color: #666; padding: 0; }
.topbar-brand { display: flex; align-items: center; gap: .5rem; }
.topbar-logo { width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--umt-gold); object-fit: cover; }
.topbar-name { font-weight: 700; font-size: .95rem; color: var(--umt-dark); }
.topbar-title { font-weight: 600; color: #1a1a2e; flex: 1; font-size: .95rem; }
.topbar-actions { display: flex; align-items: center; gap: .5rem; }

/* ============ PAGE CONTENT ============ */
.page-content { flex: 1; }

/* ============ CARDS ============ */
.card { border-radius: 12px; }
.card-header { border-radius: 12px 12px 0 0 !important; padding: .85rem 1.25rem; }

/* ============ STAT CARDS ============ */
.stat-card {
  background: white;
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow);
  transition: transform .2s;
}
.stat-card:hover { transform: translateY(-2px); }

.stat-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-green .stat-icon { background: rgba(21,101,192,.12); color: var(--umt-blue); }
.stat-blue .stat-icon { background: rgba(13,110,253,.12); color: #0d6efd; }
.stat-orange .stat-icon { background: rgba(253,126,20,.12); color: #fd7e14; }
.stat-purple .stat-icon { background: rgba(111,66,193,.12); color: #6f42c1; }

.stat-value { font-size: 1.6rem; font-weight: 700; color: #1a1a2e; line-height: 1; }
.stat-label { font-size: .75rem; color: #8c96a3; font-weight: 500; margin-top: .2rem; }

.stat-icon-sm {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}
.bg-orange-soft { background: rgba(253,126,20,.12); }
.bg-blue-soft { background: rgba(21,101,192,.12); }
.bg-green-soft { background: rgba(21,101,192,.12); }
.text-orange { color: #fd7e14; }

/* ============ WA PREVIEW ============ */
.wa-preview {
  background: #ECE5DD;
  border-radius: 12px;
  padding: 1rem;
  min-height: 160px;
}

.wa-preview-sm {
  background: #ECE5DD;
  border-radius: 8px;
  padding: .75rem;
}

.wa-message-wrapper { display: flex; justify-content: flex-end; }

.wa-message {
  background: white;
  border-radius: 12px 0 12px 12px;
  padding: .6rem .8rem;
  max-width: 85%;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
  font-size: .82rem;
  line-height: 1.5;
}

.wa-msg-header {
  font-size: .85rem;
  margin-bottom: .4rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid #f0f0f0;
}

.wa-msg-body { color: #1a1a1a; white-space: pre-wrap; }
.wa-msg-footer { font-size: .72rem; color: #8c8c8c; margin-top: .3rem; }

.wa-var {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 3px;
  padding: 0 3px;
  font-size: .78rem;
  color: #856404;
}

/* ============ UPLOAD AREA ============ */
.upload-area {
  border: 2px dashed #ced4da;
  border-radius: 12px;
  padding: 2.5rem;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: #fafafa;
}

.upload-area:hover, .upload-area.dragging {
  border-color: var(--umt-blue);
  background: rgba(21,101,192,.05);
}

/* ============ STEP SECTIONS ============ */
.step-section { padding: 1.25rem; background: #f8f9fa; border-radius: 10px; }
.step-label {
  font-weight: 700;
  margin-bottom: .75rem;
  color: #1a1a2e;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.step-num {
  width: 24px; height: 24px;
  background: var(--umt-blue);
  color: white;
  border-radius: 50%;
  display: inline-flex;
  align-items: center; justify-content: center;
  font-size: .75rem;
  font-weight: 700;
}

/* ============ USER AVATAR ============ */
.user-avatar-sm {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--umt-blue), var(--umt-dark));
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: .8rem;
  flex-shrink: 0;
}

.avatar-lg {
  width: 72px; height: 72px;
  background: linear-gradient(135deg, var(--umt-blue), var(--umt-dark));
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 2rem;
}

/* ============ WA ICON BADGE ============ */
.wa-icon-badge {
  width: 44px; height: 44px;
  background: rgba(21,101,192,.12);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ============ BADGE UTILS ============ */
.badge { font-weight: 500; }
.bg-success-subtle { background: rgba(21,101,192,.1) !important; }

/* ============ TABLE ============ */
.table { font-size: .875rem; }
.table th { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: #6c757d; }
.table-hover tbody tr:hover { background: rgba(21,101,192,.05); cursor: default; }

/* ============ FORMS ============ */
.form-control:focus, .form-select:focus {
  border-color: var(--umt-blue);
  box-shadow: 0 0 0 .25rem rgba(21,101,192,.2);
}

.btn-success {
  background: var(--umt-blue);
  border-color: var(--umt-blue);
}
.btn-success:hover {
  background: var(--umt-dark);
  border-color: var(--umt-dark);
}

/* ============ CODE ============ */
code { font-size: .8rem; }

/* ============ PROGRESS ============ */
.progress { background: #e9ecef; }

/* ============ ALERTS ============ */
.alert { border: none; border-radius: 10px; }

/* ============ MODAL ============ */
.modal-content { border: none; border-radius: 14px; }
.modal-header { border-bottom: 1px solid #f0f0f0; }
.modal-footer { border-top: 1px solid #f0f0f0; }

/* ============ BTN XS ============ */
.btn-xs { padding: .15rem .4rem; font-size: .75rem; border-radius: 4px; }

/* ============ NOTIF TOAST ANIMATION ============ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .stat-value { font-size: 1.3rem; }
}
