/* ============================================
   Fluent Design — Windows 11 Dark Theme
   ============================================ */

:root {
  --bg-base: #1c1c1c;
  --bg-layer: #202020;
  --bg-card: #2b2b2b;
  --bg-hover: #323232;
  --bg-active: #3a3a3a;
  --mica: rgba(32, 32, 32, 0.85);

  --stroke: #3a3a3a;
  --stroke-subtle: #2e2e2e;
  --stroke-strong: #4a4a4a;

  --accent: #60cdff;
  --accent-hover: #4db8e8;
  --accent-pressed: #3aa3d1;
  --accent-subtle: rgba(96, 205, 255, 0.15);

  --text-primary: #ffffff;
  --text-secondary: #c5c5c5;
  --text-tertiary: #8a8a8a;
  --text-disabled: #5a5a5a;

  --success: #6ccb5f;
  --warning: #fce100;
  --error: #ff99a4;
  --info: #60cdff;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.4);
  --shadow-flyout: 0 8px 16px rgba(0, 0, 0, 0.5);

  --ease: cubic-bezier(0.33, 0, 0.67, 1);
  --duration: 150ms;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ============ Layout ============ */
.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  background: var(--bg-layer);
  border-right: 1px solid var(--stroke-subtle);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 8px;
}

.main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--stroke-subtle);
  background: var(--bg-layer);
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ============ Nav ============ */
.nav-section {
  padding: 12px 12px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  position: relative;
  transition: background var(--duration) var(--ease);
  cursor: pointer;
}

.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--bg-active); color: var(--text-primary); }

.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 16px;
  background: var(--accent);
  border-radius: 2px;
}

.nav-item .icon { width: 16px; height: 16px; flex-shrink: 0; }

/* ============ Cards ============ */
.fluent-card {
  background: var(--bg-card);
  border: 1px solid var(--stroke-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  text-decoration: none;
  font-family: inherit;
}

.btn-accent { background: var(--accent); color: #000; }
.btn-accent:hover { background: var(--accent-hover); }
.btn-accent:active { background: var(--accent-pressed); }
.btn-subtle { background: var(--bg-card); border-color: var(--stroke); color: var(--text-primary); }
.btn-subtle:hover { background: var(--bg-hover); }

/* ============ Inputs ============ */
.fluent-input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--stroke);
  border-bottom: 2px solid var(--stroke-strong);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  transition: border-color var(--duration) var(--ease);
}

.fluent-input:focus { outline: none; border-bottom-color: var(--accent); }
.fluent-input::placeholder { color: var(--text-tertiary); }

.fluent-label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

/* ============ Flash ============ */
.flash {
  padding: 10px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  font-size: 13px;
  border-left: 3px solid;
}

.flash.success { background: rgba(108, 203, 95, 0.1); border-color: var(--success); color: var(--success); }
.flash.error { background: rgba(255, 153, 164, 0.1); border-color: var(--error); color: var(--error); }
.flash.warning { background: rgba(252, 225, 0, 0.1); border-color: var(--warning); color: var(--warning); }
.flash.info { background: rgba(96, 205, 255, 0.1); border-color: var(--info); color: var(--info); }

/* ============ Auth ============ */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top left, #2a2a2a 0%, #1c1c1c 60%);
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--mica);
  backdrop-filter: blur(20px);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-flyout);
}

.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-title { font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.auth-subtitle { font-size: 12px; color: var(--text-tertiary); }
.form-group { margin-bottom: 14px; }

/* ============ Dev Badge ============ */
.dev-badge {
  padding: 3px 10px;
  background: rgba(255, 153, 164, 0.15);
  border: 1px solid var(--error);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--error);
  letter-spacing: 0.5px;
}

/* ============ Utilities ============ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.mt-4 { margin-top: 16px; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text-tertiary); }
.text-error { color: var(--error); }

/* ============================================
   RESPONSIVE — MOBILE FIRST
   ============================================ */

/* ============ MOBILE DEFAULT (< 768px) ============ */
@media (max-width: 768px) {
  /* ============ APP SHELL ============ */
  .app-shell {
    grid-template-columns: 1fr;      /* full width */
    grid-template-rows: 1fr auto;    /* content + bottom nav */
  }

  /* ============ SIDEBAR → DRAWER ============ */
  .sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 280px;
    height: 100vh;
    z-index: 1000;
    background: var(--bg-layer);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.6);
    transition: left 0.25s ease;
    padding: 16px 8px;
  }

  .sidebar.open {
    left: 0;
  }

  /* Overlay ketika drawer terbuka */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.25s;
  }

  .sidebar-overlay.show {
    display: block;
    opacity: 1;
  }

  /* ============ TOPBAR → COMPACT ============ */
  .topbar {
    height: 56px;
    padding: 0 12px;
    position: sticky;
    top: 0;
    z-index: 100;
  }

  .topbar .desktop-only {
    display: none !important;
  }

  .topbar .mobile-only {
    display: flex !important;
  }

  /* ============ CONTENT ============ */
  .content {
    padding: 16px;
    padding-bottom: 84px;   /* space untuk bottom nav */
    font-size: 15px;
    -webkit-overflow-scrolling: touch;
  }

  /* ============ FLUENT CARD ============ */
  .fluent-card {
    padding: 16px;
    border-radius: var(--radius-md);
  }

  /* ============ BUTTONS ============ */
  .btn {
    padding: 10px 16px;
    font-size: 14px;
    min-height: 44px;      /* touch target */
    min-width: 44px;
  }

  .btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    min-height: 32px;
  }

  /* ============ TABLE → CARD STACK ============ */
  .table-responsive table {
    display: block;
  }

  .table-responsive thead {
    display: none;
  }

  .table-responsive tbody,
  .table-responsive tr,
  .table-responsive td {
    display: block;
    width: 100%;
  }

  .table-responsive tr {
    background: var(--bg-card);
    border: 1px solid var(--stroke-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    padding: 12px;
    position: relative;
  }

  .table-responsive td {
    padding: 6px 0;
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
  }

  .table-responsive td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-tertiary);
    font-size: 11px;
    text-transform: uppercase;
    margin-right: 12px;
    flex-shrink: 0;
  }

  .table-responsive td:last-child {
    padding-top: 8px;
    border-top: 1px solid var(--stroke-subtle);
    margin-top: 4px;
    justify-content: flex-end;
  }

  /* ============ TAB FILTER ============ */
  .tab-filter {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .tab-filter::-webkit-scrollbar {
    display: none;
  }

  .tab-filter .btn {
    flex-shrink: 0;
    font-size: 13px;
    padding: 8px 14px;
  }

  /* ============ MODAL → BOTTOM SHEET ============ */
  .mobile-sheet {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    max-width: 100% !important;
    width: 100% !important;
    max-height: 90vh;
    border-radius: 20px 20px 0 0 !important;
    margin: 0 !important;
    animation: slideUp 0.25s ease;
  }

  @keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  /* ============ FORM GROUP ============ */
  .form-group {
    margin-bottom: 16px;
  }

  .fluent-input {
    font-size: 16px;    /* prevent iOS zoom */
    padding: 12px 14px;
  }

  /* ============ GRID → SINGLE COLUMN ============ */
  .grid-mobile-1 {
    grid-template-columns: 1fr !important;
  }

  /* ============ HEADER ============ */
  h1 { font-size: 20px !important; }
  h2 { font-size: 18px !important; }

  /* ============ HIDE DESKTOP ONLY ============ */
  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: block !important;
  }
}

/* ============ DESKTOP DEFAULT (>= 769px) ============ */
@media (min-width: 769px) {
  .mobile-only {
    display: none !important;
  }

  .mobile-nav {
    display: none !important;
  }

  .sidebar-overlay {
    display: none !important;
  }
}

/* ============================================
   BOTTOM NAVIGATION (MOBILE ONLY)
   ============================================ */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--mica);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--stroke-subtle);
  z-index: 900;
  padding-bottom: env(safe-area-inset-bottom);
}

@media (max-width: 768px) {
  .mobile-nav {
    display: flex;
  }
}

.mobile-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: var(--text-tertiary);
  font-size: 10px;
  font-weight: 500;
  transition: color 0.15s;
  padding: 8px 4px;
  position: relative;
}

.mobile-nav-item .icon {
  font-size: 20px;
  line-height: 1;
}

.mobile-nav-item.active {
  color: var(--accent);
}

.mobile-nav-item.active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: var(--accent);
  border-radius: 0 0 2px 2px;
}

/* ============================================
   MOBILE DRAWER TOGGLE
   ============================================ */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: flex;
  }
}

.mobile-menu-btn:hover {
  background: var(--bg-hover);
}

/* ============================================
   MICROSOFT LAUNCHER / WIN11 START STYLE
   Mobile Home Screen
   ============================================ */

/* ---------- Accent Palette untuk Tile ---------- */
:root {
  --tile-blue:    #0078d4;
  --tile-teal:    #038387;
  --tile-green:   #107c10;
  --tile-purple:  #8764b8;
  --tile-orange:  #ca5010;
  --tile-red:     #d13438;
  --tile-pink:    #e3008c;
  --tile-yellow:  #8e562e;
  --tile-indigo:  #4f6bed;
  --tile-cyan:    #0099bc;
}

/* ---------- Home Shell ---------- */
@media (max-width: 768px) {

  /* Hapus padding default, biar full-bleed */
  .content.home-content {
    padding: 0;
    padding-bottom: 84px;
    background: var(--bg-base);
  }

  /* ---------- Home Header (Launcher style) ---------- */
  .launcher-header {
    padding: 20px 20px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .launcher-greeting {
    flex: 1;
    min-width: 0;
  }

  .launcher-greeting .hello {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 2px;
  }

  .launcher-greeting .name {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .launcher-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
    border: 2px solid var(--stroke);
  }

  /* ---------- Search Bar (pill, Win11 style) ---------- */
  .launcher-search {
    margin: 0 20px 20px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--stroke-subtle);
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-tertiary);
    font-size: 14px;
    transition: background var(--duration) var(--ease);
  }

  .launcher-search:active {
    background: var(--bg-hover);
  }

  .launcher-search input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
  }

  /* ---------- Section Title ---------- */
  .launcher-section {
    padding: 0 20px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .launcher-section .title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
  }

  .launcher-section .more {
    font-size: 12px;
    color: var(--accent);
    text-decoration: none;
  }

  /* ---------- TILE GRID (Start Menu style) ---------- */
  .tile-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 0 20px 20px;
  }

  .tile-grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }

  .tile-grid.cols-4 {
    grid-template-columns: repeat(4, 1fr);
  }

  /* ---------- Individual Tile ---------- */
  .tile {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 96px;
    padding: 14px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--stroke-subtle);
    color: var(--text-primary);
    text-decoration: none;
    overflow: hidden;
    transition: transform 0.12s var(--ease),
                filter 0.12s var(--ease);
    -webkit-tap-highlight-color: transparent;
  }

  .tile:active {
    transform: scale(0.96);
    filter: brightness(1.15);
  }

  /* Tile icon di kiri atas */
  .tile .tile-icon {
    font-size: 22px;
    line-height: 1;
    margin-bottom: auto;
  }

  /* Tile label di bawah */
  .tile .tile-label {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    margin-top: 12px;
  }

  .tile .tile-sub {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.75);
    margin-top: 2px;
  }

  /* ---------- Tile Color Variants (filled) ---------- */
  .tile.blue    { background: var(--tile-blue);    border-color: transparent; }
  .tile.teal    { background: var(--tile-teal);    border-color: transparent; }
  .tile.green   { background: var(--tile-green);   border-color: transparent; }
  .tile.purple  { background: var(--tile-purple);  border-color: transparent; }
  .tile.orange  { background: var(--tile-orange);  border-color: transparent; }
  .tile.red     { background: var(--tile-red);     border-color: transparent; }
  .tile.pink    { background: var(--tile-pink);    border-color: transparent; }
  .tile.yellow  { background: var(--tile-yellow);  border-color: transparent; }
  .tile.indigo  { background: var(--tile-indigo);  border-color: transparent; }
  .tile.cyan    { background: var(--tile-cyan);    border-color: transparent; }

  .tile[class*="blue"] .tile-sub,
  .tile[class*="teal"] .tile-sub,
  .tile[class*="green"] .tile-sub,
  .tile[class*="purple"] .tile-sub,
  .tile[class*="orange"] .tile-sub,
  .tile[class*="red"] .tile-sub,
  .tile[class*="pink"] .tile-sub,
  .tile[class*="yellow"] .tile-sub,
  .tile[class*="indigo"] .tile-sub,
  .tile[class*="cyan"] .tile-sub {
    color: rgba(255, 255, 255, 0.8);
  }

  /* ---------- Wide tile (2x) ---------- */
  .tile.wide {
    grid-column: span 2;
    min-height: 96px;
  }

  /* ---------- Small icon tile (compact, 1x1 kecil) ---------- */
  .tile.compact {
    min-height: 72px;
    padding: 10px;
    align-items: center;
    justify-content: center;
  }

  .tile.compact .tile-icon { font-size: 24px; margin: 0; }
  .tile.compact .tile-label {
    font-size: 10px;
    text-align: center;
    margin-top: 6px;
    font-weight: 500;
  }

  /* ---------- Stat Tile (khusus qurban: jumlah, status) ---------- */
  .tile.stat {
    background: var(--bg-card);
    border: 1px solid var(--stroke-subtle);
  }

  .tile.stat .stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    color: var(--accent);
    margin: 6px 0 4px;
  }

  .tile.stat .stat-label {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  /* ---------- Bottom Nav = Taskbar Win11 ---------- */
  .mobile-nav {
    background: var(--bg-layer);
    backdrop-filter: blur(30px) saturate(180%);
    border-top: 1px solid var(--stroke-subtle);
    height: 60px;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.4);
  }

  .mobile-nav-item {
    color: var(--text-secondary);
    gap: 3px;
    font-size: 10px;
    padding: 6px 4px;
  }

  .mobile-nav-item .icon {
    font-size: 22px;
    transition: transform 0.15s var(--ease);
  }

  .mobile-nav-item.active .icon {
    transform: scale(1.1);
  }

  .mobile-nav-item.active {
    color: var(--accent);
  }

  .mobile-nav-item.active::before {
    width: 28px;
    height: 3px;
    border-radius: 2px;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
  }

  /* ---------- Quick Action FAB (opsional) ---------- */
  .launcher-fab {
    position: fixed;
    right: 16px;
    bottom: 76px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--accent);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(96, 205, 255, 0.4);
    z-index: 850;
    border: none;
    cursor: pointer;
    transition: transform 0.15s var(--ease);
    -webkit-tap-highlight-color: transparent;
  }

  .launcher-fab:active {
    transform: scale(0.9);
  }
}