/* ============================================================
   VMS SMKN 1 Blitar — Professional NOC Theme v2.0
   Design: ENERGY 1 / RHYTHM 2 / MOTION 1
   Identity: Calm command center — ruled lines, precise chrome
   ============================================================ */

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  --color-canvas:    #090d14;
  --color-surface:   #111622;
  --color-inset:     #0d111a;
  --color-raised:    #182030;
  --color-border:    #1e2638;
  --color-border-md: #2a3a52;
  --color-focus:     #334155;
  --color-text-hi:   #f1f5f9;
  --color-text-md:   #94a3b8;
  --color-text-lo:   #64748b;
  --color-action:    #2563eb;
  --color-action-h:  #1d4ed8;
  --color-live:      #10b981;
  --color-offline:   #ef4444;
  --color-rec:       #f59e0b;
  --color-net:       #06b6d4;
}

/* ── Base Reset ────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
}

/* ── Scrollbars — thin, muted ──────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--color-inset); }
::-webkit-scrollbar-thumb {
  background: var(--color-focus);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ── Alpine Cloaking ───────────────────────────────────────── */
[x-cloak] { display: none !important; }

/* ── Micro-Animations (MOTION 1 — functional only) ────────── */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60%  { transform: translateX(-3px); }
  40%, 80%  { transform: translateX(3px); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.animate-shake {
  animation: shake 0.3s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.animate-fade-in {
  animation: fadeIn 0.18s ease forwards;
}

.animate-slide-down {
  animation: slideDown 0.18s ease forwards;
}

/* ── Touch Targets (R-03, min 44x44px) ────────────────────── */
.touch-target {
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Typography Utilities ──────────────────────────────────── */
.font-data {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}

/* ── Component: Section Ruled Header ──────────────────────── */
/* Identity motif: ruled line separating header from content */
.section-header {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-lo);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 12px;
}

/* ── Component: Status Indicator (no glow, R-13) ──────────── */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.live    { background: var(--color-live); }
.status-dot.offline { background: var(--color-offline); }
.status-dot.rec     { background: var(--color-rec); }
.status-dot.unknown { background: #475569; }

/* ── Component: Inline Status Badge ───────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: 'JetBrains Mono', monospace;
}

.status-badge.live {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.status-badge.offline {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.status-badge.rec {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.status-badge.net {
  background: rgba(6, 182, 212, 0.12);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.25);
}

/* ── Component: Login Card Left Stripe ────────────────────── */
/* Identity: cobalt stripe = protected access entry point */
.login-card-stripe {
  position: relative;
  border-left: 3px solid var(--color-action);
  border-radius: 0 8px 8px 0;
}

/* ── Component: Nav Tab (segmented control) ───────────────── */
.nav-tab {
  padding: 6px 10px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.1s ease, color 0.1s ease;
  cursor: pointer;
  white-space: nowrap;
}

.nav-tab:not(.active) {
  color: var(--color-text-md);
}

.nav-tab:not(.active):hover {
  background: var(--color-raised);
  color: var(--color-text-hi);
}

.nav-tab.active {
  background: var(--color-action);
  color: #fff;
  font-weight: 600;
}

/* ── Component: Data Row ───────────────────────────────────── */
.data-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 12px;
  border-bottom: 1px solid var(--color-border);
  transition: background 0.1s ease;
}

.data-row:last-child { border-bottom: none; }
.data-row:hover { background: var(--color-raised); }

/* ── Component: Toggle Switch ─────────────────────────────── */
.toggle-track {
  position: relative;
  display: inline-flex;
  width: 36px;
  height: 20px;
  border-radius: 10px;
  transition: background 0.15s ease;
  cursor: pointer;
  flex-shrink: 0;
}

.toggle-track.on  { background: var(--color-action); }
.toggle-track.off { background: var(--color-raised); }

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  transition: transform 0.15s ease;
  pointer-events: none;
}

.toggle-track.on .toggle-thumb { transform: translateX(16px); }

/* ── Video Slot ─────────────────────────────────────────────── */
.video-slot {
  position: relative;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  transition: border-color 0.12s ease;
  display: flex;
  flex-direction: column;
  min-height: 0 !important;
  min-width: 0 !important;
  height: 100% !important;
  width: 100% !important;
}

.video-slot:hover {
  border-color: var(--color-focus);
}

/* Active slot: crisp blue frame, no glow (R-13) */
.video-slot.slot-active {
  border-color: var(--color-action) !important;
  outline: 2px solid var(--color-action);
  outline-offset: -2px;
}

/* ── Video OSD Overlay Bar ─────────────────────────────────── */
.slot-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  /* Gradient fade: opaque at top, transparent going down */
  background: linear-gradient(180deg,
    rgba(9, 13, 20, 0.94) 0%,
    rgba(9, 13, 20, 0.7) 70%,
    transparent 100%);
  padding: 6px 8px 10px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
  z-index: 20;
}

/* Bottom gradient for timestamp/channel info */
.slot-overlay-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(0deg,
    rgba(9, 13, 20, 0.90) 0%,
    rgba(9, 13, 20, 0.5) 60%,
    transparent 100%);
  padding: 10px 8px 6px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
  z-index: 20;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--color-text-lo);
}

.video-slot:hover .slot-overlay,
.video-slot.slot-active .slot-overlay,
.video-slot:hover .slot-overlay-bottom,
.video-slot.slot-active .slot-overlay-bottom {
  opacity: 1;
  pointer-events: auto;
}

.video-slot.hide-osd .slot-overlay,
.video-slot.hide-osd .slot-overlay-bottom {
  opacity: 0;
  pointer-events: none;
}

.video-slot.hide-osd:hover .slot-overlay,
.video-slot.hide-osd:hover .slot-overlay-bottom,
.video-slot.hide-osd.slot-active .slot-overlay,
.video-slot.hide-osd.slot-active .slot-overlay-bottom {
  opacity: 1;
  pointer-events: auto;
}

/* ── Video Fit Modes ───────────────────────────────────────── */
.video-slot iframe {
  overflow: hidden !important;
  border: 0 !important;
}
.video-slot iframe.video-cover   { transform: scale(1.02); }
.video-slot iframe.video-contain { object-fit: contain; }

/* ── Video Wall Container (Zero Overflow Guarantee) ───────── */
.video-wall-container {
  height: 100% !important;
  max-height: 100% !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow: hidden !important;
  min-height: 0 !important;
  min-width: 0 !important;
}

/* ── Grid Layouts ──────────────────────────────────────────── */
.grid-layout-1x1 {
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: minmax(0, 1fr) !important;
}
.grid-layout-2x2 {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  grid-template-rows: repeat(2, minmax(0, 1fr)) !important;
}
.grid-layout-3x2 {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  grid-template-rows: repeat(2, minmax(0, 1fr)) !important;
}
.grid-layout-3x3 {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  grid-template-rows: repeat(3, minmax(0, 1fr)) !important;
}
.grid-layout-4x2 {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  grid-template-rows: repeat(2, minmax(0, 1fr)) !important;
}
.grid-layout-4x3 {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  grid-template-rows: repeat(3, minmax(0, 1fr)) !important;
}
.grid-layout-4x4 {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  grid-template-rows: repeat(4, minmax(0, 1fr)) !important;
}
.grid-layout-5x5 {
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  grid-template-rows: repeat(5, minmax(0, 1fr)) !important;
}
.grid-layout-6x6 {
  grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  grid-template-rows: repeat(6, minmax(0, 1fr)) !important;
}

/* ── Asymmetric Focus Layouts ─────────────────────────────── */
.grid-layout-1plus5 {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  grid-template-rows: repeat(3, minmax(0, 1fr)) !important;
}
.grid-layout-1plus5 .slot-focus {
  grid-column: span 2 / span 2 !important;
  grid-row: span 2 / span 2 !important;
}
.grid-layout-1plus7 {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  grid-template-rows: repeat(4, minmax(0, 1fr)) !important;
}
.grid-layout-1plus7 .slot-focus {
  grid-column: span 3 / span 3 !important;
  grid-row: span 3 / span 3 !important;
}

/* ── Mobile Responsive Grid Fallbacks (R-03) ──────────────── */
@media (max-width: 640px) {
  .grid-layout-3x2,
  .grid-layout-3x3,
  .grid-layout-4x2,
  .grid-layout-4x3,
  .grid-layout-4x4,
  .grid-layout-5x5,
  .grid-layout-6x6 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-template-rows: auto !important;
    overflow-y: auto !important;
  }
}

/* ── Mobile Sidebar Drawer ─────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar-mobile-drawer {
    position: fixed !important;
    top: 3.5rem;
    bottom: 0;
    left: 0;
    width: 18rem !important;
    max-width: 88vw !important;
    z-index: 40 !important;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
  }
}

/* ── Carousel / Patrol Progress Bar ───────────────────────── */
.carousel-progress-container {
  height: 2px;
  background: var(--color-raised);
  position: relative;
  overflow: hidden;
  width: 100%;
}

.carousel-progress-bar {
  height: 100%;
  background: var(--color-action);
  transition: width 0.1s linear;
}

/* ── Kiosk Mode (Full-screen TV Satpam) ────────────────────── */
body.kiosk-mode {
  overflow: hidden !important;
  background: #000 !important;
}

body.kiosk-mode .main-header,
body.kiosk-mode .main-sidebar,
body.kiosk-mode .main-footer {
  display: none !important;
}

body.kiosk-mode .video-wall-container {
  height: 100vh !important;
  height: 100dvh !important;
  width: 100vw !important;
  padding: 3px !important;
  gap: 3px !important;
  margin: 0 !important;
}

body.kiosk-mode .video-slot {
  border-radius: 4px !important;
  border-width: 1px !important;
}

/* ── Night Dim Shift (Burn-in & Eye Strain Protection with Variable Brightness) ── */
body.night-dim-active .video-wall-container {
  filter: brightness(var(--night-dim-brightness, 0.52)) contrast(0.92);
  transition: filter 0.8s ease-in-out;
}

/* ── Kiosk Floating Bar ─────────────────────────────────────── */
.kiosk-floating-bar {
  position: fixed;
  top: 8px;
  left: 50%;
  transform: translateX(-50%) translateY(-140%);
  z-index: 100;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 6px 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
  transition: transform 0.15s ease, opacity 0.15s ease;
  opacity: 0;
  pointer-events: none;
}

.kiosk-hotzone:hover ~ .kiosk-floating-bar,
.kiosk-floating-bar:hover,
.kiosk-floating-bar.show-temporarily {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* ── Timeline Scrubber ─────────────────────────────────────── */
.timeline-track {
  background: var(--color-inset);
  border: 1px solid var(--color-border);
  position: relative;
  height: 36px;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
}

/* ── Modal Backdrop ────────────────────────────────────────── */
.modal-backdrop {
  background: rgba(5, 7, 12, 0.82);
  backdrop-filter: blur(2px);
}

/* ── Focus Ring — visible, not hidden (R-32) ──────────────── */
:focus-visible {
  outline: 2px solid var(--color-action);
  outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}

/* ── Utility: Monospace Number ─────────────────────────────── */
.mono { font-family: 'JetBrains Mono', monospace; }

/* ── Utility: Truncate ─────────────────────────────────────── */
.truncate-2 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ── Brand Identity Chip (topbar) ─────────────────────────── */
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(37, 99, 235, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #60a5fa;
  flex-shrink: 0;
}

/* ── Divider: thin ruled line (identity motif) ────────────── */
.ruled-divider {
  height: 1px;
  background: var(--color-border);
  width: 100%;
  margin: 0;
}

/* ── Topbar Nav — in-flow di antara blok kiri & kanan.
   Dulu absolute dead-center: menabrak kontrol grid saat sisi kanan lebar. ── */
.topbar-nav-center {
  position: static;
  z-index: 20;
}

/* ── Print / Snapshot isolation ───────────────────────────── */
@media print {
  .main-header, .main-sidebar, .kiosk-floating-bar { display: none !important; }
}

/* ── Modul 2: Night Auto-Dimming for Kiosk Monitor ────────── */
.kiosk-night-dim {
  filter: brightness(var(--night-dim-brightness, 0.65)) contrast(0.95);
  transition: filter 1.5s ease-in-out;
}

