/* ==========================================================
 * Letters Style System - Asrama BPVP Bantaeng Edition
 * Berdasarkan Spesifikasi design.md & Kaidah antislop.md
 * Warna: Obsidian (#070709), Paper White (#ffffff), Cloud Gray (#f5f5f5),
 * Sky Tint (#d7e6f5), Charcoal (#60606c), Surgical Blue (#2597d0)
 * ========================================================== */

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

:root {
  /* Colors - design.md specification */
  --color-obsidian: #070709;
  --color-paper-white: #ffffff;
  --color-cloud-gray: #f5f5f5;
  --color-sky-tint: #d7e6f5;
  --color-charcoal: #60606c;
  --color-slate: #8b8b8b;
  --color-ink: #151515;
  --color-surgical-blue: #2597d0;
  --color-surgical-blue-hover: #1c7ba9;
  --color-sky-gradient: #779bc1;
  --gradient-sky-hero: linear-gradient(180deg, #779bc1 0%, #9abfda 58%, #cbdcec 100%);
  --color-border-hairline: #e2e8f0;
  --color-border-subtle: #bebecc;

  /* Semantic Status Colors (Terkontrol & Aksesibel) */
  --color-success: #0d8744;
  --color-success-bg: rgba(13, 135, 68, 0.08);
  --color-warning: #b45309;
  --color-warning-bg: rgba(180, 83, 9, 0.08);
  --color-danger: #c5221f;
  --color-danger-bg: rgba(197, 34, 31, 0.08);

  /* Typography */
  --font-display: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;

  /* Typography - Scale */
  --text-caption: 12px;
  --text-body-sm: 14px;
  --text-body: 16px;
  --text-body-lg: 18px;
  --text-subheading: 20px;
  --text-heading-sm: 28px;
  --text-heading: 44px;
  --text-display: 80px;

  /* Border Radius */
  --radius-buttons: 100px;
  --radius-tags: 100px;
  --radius-nav-pills: 100px;
  --radius-inputs: 12px;
  --radius-icons: 8px;
  --radius-cards: 18px;
  --radius-large-cards: 32px;

  /* Elevation & Shadows */
  --shadow-subtle: rgba(228, 229, 231, 0.24) 0px 1px 2px 0px;
  --shadow-subtle-2: rgba(36, 36, 40, 0.1) 0px 1px 2px 0px, rgba(36, 36, 40, 0.09) 0px 3px 3px 0px, rgba(36, 36, 40, 0.05) 0px 6px 4px 0px, rgba(36, 36, 40, 0.01) 0px 11px 4px 0px;
  --shadow-subtle-3: rgba(23, 107, 197, 0.08) 0px 1px 1px 0px, rgba(23, 107, 197, 0.07) 0px 3px 3px 0px;
  --shadow-xl: rgba(16, 55, 132, 0.03) 0px 17px 37px 0px, rgba(16, 55, 132, 0.03) 0px 67px 67px 0px, rgba(16, 55, 132, 0.02) 0px 150px 90px 0px;
  --shadow-card-elevated: 0 10px 30px -10px rgba(16, 55, 132, 0.06), 0 4px 12px -2px rgba(16, 55, 132, 0.03);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  overflow-x: hidden !important;
  max-width: 100vw !important;
  width: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background-color: var(--color-paper-white);
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.5;
  background-color: var(--color-paper-white);
  color: var(--color-obsidian);
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden !important;
  max-width: 100vw !important;
  width: 100%;
  position: relative;
  overscroll-behavior-x: none;
  -webkit-overflow-scrolling: touch;
}

/* Headings with confident humanist geometric weight & tight negative tracking */
h1, h2, h3, h4, h5, h6, .font-heading {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--color-obsidian);
  letter-spacing: -0.035em;
}

.tracking-tight-display {
  letter-spacing: -0.04em;
}

/* Sky Gradient Hero Band */
.hero-sky-gradient {
  background: var(--gradient-sky-hero);
  color: var(--color-paper-white);
  position: relative;
}

/* Hairline borders & utility */
.border-hairline {
  border: 1px solid var(--color-border-hairline);
}

.contain-paint {
  contain: paint;
  clip-path: inset(0);
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* ==========================================================
 * CARDS & SURFACES (18px - 32px rounded, atmospheric shadows)
 * ========================================================== */
.dorm-card, .foodnoms-card, .gopay-card {
  background: var(--color-paper-white);
  border-radius: var(--radius-cards);
  border: 1px solid var(--color-border-hairline);
  box-shadow: var(--shadow-xl);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
  color: var(--color-obsidian);
}

.dorm-card:hover {
  box-shadow: var(--shadow-card-elevated);
  border-color: #cbd5e1;
}

.dorm-card-secondary {
  background: var(--color-cloud-gray);
  border-radius: var(--radius-cards);
  border: 1px solid var(--color-border-hairline);
  box-shadow: var(--shadow-subtle);
  color: var(--color-obsidian);
}

.dorm-card-interactive {
  cursor: pointer;
}
.dorm-card-interactive:active {
  transform: scale(0.99);
}

/* ==========================================================
 * BUTTONS (Pill 100px radius, Obsidian #070709 Primary)
 * ========================================================== */
.btn-pill-primary, .btn-primary-ember, .foodnoms-btn-primary {
  background-color: var(--color-obsidian) !important;
  color: var(--color-paper-white) !important;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: -0.01em;
  border-radius: var(--radius-buttons);
  padding: 0.75rem 1.6rem;
  border: 1px solid transparent !important;
  box-shadow: var(--shadow-subtle-2);
  transition: background-color 0.2s ease, transform 0.12s ease, opacity 0.2s ease, box-shadow 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  min-height: 44px; /* R-03: Minimum tap target */
  text-decoration: none;
}

.btn-pill-primary:hover, .btn-primary-ember:hover, .foodnoms-btn-primary:hover {
  background-color: #1a1a1f !important;
  opacity: 0.98;
  transform: translateY(-1px);
}

.btn-pill-primary:active, .btn-primary-ember:active, .foodnoms-btn-primary:active {
  transform: scale(0.985);
}

/* Outlined Ghost Button */
.btn-pill-ghost, .btn-secondary-fog, .foodnoms-btn-secondary {
  background-color: transparent !important;
  color: var(--color-obsidian) !important;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: -0.01em;
  border-radius: var(--radius-buttons);
  padding: 0.6875rem 1.4rem;
  border: 1px solid var(--color-border-subtle) !important;
  box-shadow: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  min-height: 44px;
  text-decoration: none;
}

.btn-pill-ghost:hover, .btn-secondary-fog:hover, .foodnoms-btn-secondary:hover {
  background-color: var(--color-cloud-gray) !important;
  border-color: #070709 !important;
}

.btn-pill-ghost:active, .btn-secondary-fog:active, .foodnoms-btn-secondary:active {
  transform: scale(0.985);
}

/* Small functional action button */
.btn-pill-sm {
  padding: 0.45rem 1rem;
  font-size: 0.8125rem;
  min-height: 38px;
}

/* ==========================================================
 * INPUTS & FORMS (12px radius, hairline border, focus surgical ring)
 * ========================================================== */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="datetime-local"],
select {
  background-color: var(--color-paper-white);
  border: 1px solid #cbd5e1;
  color: var(--color-obsidian);
  border-radius: var(--radius-inputs);
  padding: 0.75rem 1.15rem;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  min-height: 44px;
  width: 100%;
}

textarea {
  background-color: var(--color-paper-white);
  border: 1px solid #cbd5e1;
  color: var(--color-obsidian);
  border-radius: var(--radius-inputs);
  padding: 0.85rem 1.15rem;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  width: 100%;
}

/* R-32 Keyboard Accessibility & visible focus indicator */
input:focus, select:focus, textarea:focus {
  border-color: var(--color-surgical-blue) !important;
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(37, 151, 208, 0.18) !important;
}

button:focus-visible, a:focus-visible {
  outline: 2px solid var(--color-surgical-blue) !important;
  outline-offset: 2px !important;
}

::placeholder {
  color: var(--color-slate);
  opacity: 1;
}

/* ==========================================================
 * PILL TAGS & BADGES (100px radius, clear functional roles)
 * ========================================================== */
.pill-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  border-radius: var(--radius-tags);
  padding: 0.35rem 0.875rem;
  font-size: 0.75rem;
  font-weight: 600;
  background-color: var(--color-paper-white);
  border: 1px solid var(--color-border-hairline);
  color: var(--color-charcoal);
  line-height: 1.2;
}

.pill-tag-blue {
  background-color: #f0f7fc;
  border-color: #b9ddf0;
  color: #176ea3;
}

.pill-tag-blue svg, .pill-tag-blue .icon-dot {
  color: var(--color-surgical-blue);
}

.badge-verified {
  background-color: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid rgba(13, 135, 68, 0.2);
  border-radius: var(--radius-tags);
  font-weight: 600;
}

.badge-pending {
  background-color: var(--color-warning-bg);
  color: var(--color-warning);
  border: 1px solid rgba(180, 83, 9, 0.2);
  border-radius: var(--radius-tags);
  font-weight: 600;
}

.badge-outside {
  background-color: #f0f7fc;
  color: #176ea3;
  border: 1px solid #b9ddf0;
  border-radius: var(--radius-tags);
  font-weight: 600;
}

.badge-local {
  background-color: var(--color-cloud-gray);
  color: var(--color-charcoal);
  border: 1px solid var(--color-border-hairline);
  border-radius: var(--radius-tags);
  font-weight: 600;
}

/* Chip Selector */
.chip-option {
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: var(--radius-tags);
  padding: 0.5rem 1.15rem;
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1px solid var(--color-border-hairline);
  background-color: var(--color-cloud-gray);
  color: var(--color-charcoal);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chip-option:hover {
  border-color: #94a3b8;
  color: var(--color-obsidian);
}

.chip-option.active {
  border-color: var(--color-obsidian);
  background-color: var(--color-obsidian);
  color: var(--color-paper-white);
  box-shadow: var(--shadow-subtle-2);
}

/* ==========================================================
 * DORMITORY ROOM KEYCARD & BOARDING PASS (Themed & Modern)
 * ========================================================== */
.boarding-pass, .dorm-keycard {
  background: var(--color-paper-white);
  border-radius: var(--radius-cards);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--color-border-hairline);
  color: var(--color-obsidian);
  box-shadow: var(--shadow-xl);
  animation: dormKeycardDock 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.boarding-pass-cutout-left,
.boarding-pass-cutout-right {
  position: absolute;
  top: calc(100% - 130px);
  width: 20px;
  height: 20px;
  background-color: var(--color-cloud-gray);
  border-radius: 50%;
  z-index: 10;
}

.boarding-pass-cutout-left {
  left: -10px;
  border-right: 1px solid var(--color-border-hairline);
}

.boarding-pass-cutout-right {
  right: -10px;
  border-left: 1px solid var(--color-border-hairline);
}

.boarding-pass-dash {
  position: absolute;
  top: calc(100% - 120px);
  left: 20px;
  right: 20px;
  border-top: 1.5px dashed #cbd5e1;
}

/* ==========================================================
 * MODAL & BOTTOM SHEET (Sleek Clean White)
 * ========================================================== */
.bottom-sheet-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(7, 7, 9, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.bottom-sheet-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.bottom-sheet-content {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
  background: var(--color-paper-white);
  border-top-left-radius: var(--radius-large-cards);
  border-top-right-radius: var(--radius-large-cards);
  border: 1px solid var(--color-border-hairline);
  border-bottom: none;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.12);
  z-index: 51;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  color: var(--color-obsidian);
}

.bottom-sheet-backdrop.active .bottom-sheet-content {
  transform: translateY(0);
}

.sheet-drag-handle {
  width: 40px;
  height: 4px;
  background-color: #cbd5e1;
  border-radius: 9999px;
  margin: 12px auto 8px auto;
}

@media (min-width: 768px) {
  .bottom-sheet-content {
    top: 50%;
    bottom: auto;
    left: 50%;
    right: auto;
    margin: 0;
    transform: translate(-50%, -46%) scale(0.97);
    border-radius: var(--radius-large-cards);
    border: 1px solid var(--color-border-hairline);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
  }
  .bottom-sheet-backdrop.active .bottom-sheet-content {
    transform: translate(-50%, -50%) scale(1);
  }
  .sheet-drag-handle {
    display: none;
  }
}

/* ==========================================================
 * STICKY MOBILE ACTION BAR
 * ========================================================== */
.bottom-action-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 100%;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 0.875rem 1.25rem;
  border-top: 1px solid var(--color-border-hairline);
  z-index: 40;
}

@media (min-width: 768px) {
  .bottom-action-bar {
    position: static;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 1.5rem 0 0 0;
    border: none;
  }
}

/* ==========================================================
 * DORMITORY-THEMED ANIMATIONS (Kaidah antislop R-19)
 * Purposeful micro-interactions for dorm admission & room key
 * ========================================================== */

/* 1. Room Keycard Docking: Slide-in with tactile settling */
@keyframes dormKeycardDock {
  0% {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.anim-keycard-dock {
  animation: dormKeycardDock 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 2. Room Slot Pulse: Status ranjang & kamar aktif */
@keyframes roomSlotPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.08);
    opacity: 0.85;
  }
}

.anim-slot-pulse {
  animation: roomSlotPulse 2.4s ease-in-out infinite;
}

/* 3. Subtle Room Key Float: Tenang & elegan */
@keyframes dormKeyFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

.anim-key-float {
  animation: dormKeyFloat 3.5s ease-in-out infinite;
}

/* 4. Dorm Sync Rotation (Pemeliharaan & update data) */
@keyframes dormSyncRotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.anim-sync-rotate {
  animation: dormSyncRotate 12s linear infinite;
}

/* 5. Smooth Stepper Flow */
.smooth-fade {
  animation: smoothFadeIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes smoothFadeIn {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 6. Tombol Loading */
.btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.88;
}

.btn-loading::after {
  content: "";
  display: inline-block;
  width: 0.875rem;
  height: 0.875rem;
  margin-left: 0.5rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btnSpin 0.6s linear infinite;
  vertical-align: -2px;
}

@keyframes btnSpin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================
 * DATA TABLES (Admin & Preview)
 * ========================================================== */
.excel-preview-table {
  width: 100%;
  font-size: 0.8125rem;
  border-collapse: collapse;
}

.excel-preview-table th {
  background-color: var(--color-cloud-gray);
  color: var(--color-obsidian);
  font-family: var(--font-display);
  font-weight: 600;
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border-hairline);
  white-space: nowrap;
}

.excel-preview-table td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  color: var(--color-charcoal);
  white-space: nowrap;
}

.excel-preview-table tr:hover td {
  background-color: #f8fafc;
}

/* Skeleton Loading */
.skeleton-pulse {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-inputs);
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Ticker Announcement */
.ticker-wrap {
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  box-sizing: border-box;
  display: flex;
  user-select: none;
}

.ticker-move {
  display: inline-flex;
  white-space: nowrap;
  animation: ticker-slide 32s linear infinite;
  will-change: transform;
}

.ticker-wrap:hover .ticker-move,
.ticker-wrap:active .ticker-move {
  animation-play-state: paused;
}

@keyframes ticker-slide {
  0% {
    transform: translate3d(0, 0, 0);
  }
  100% {
    transform: translate3d(-50%, 0, 0);
  }
}
