/*
 * style.css — ChromaSense Fase 2 Additions
 * Styles untuk Color Info Panel, History Strip, Toast Notification.
 * Prinsip desain (dari PRD §7.3):
 * - Minimalis, fokus pada fungsi
 * - Kontras tinggi untuk panel info
 * - Warna UI netral (abu, putih, gelap)
 * - Font size min 16px, tombol min 44x44px
 */

/* ─────────────────────────────────────────────
   RESET & BASE
───────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  background-color: #1a1a1a;
  color: #f0f0f0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─────────────────────────────────────────────
   HEADER
───────────────────────────────────────────── */
#app-header {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #111;
  border-bottom: 1px solid #333;
}

#app-header h1 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff;
}

#app-header .tagline {
  font-size: 0.8rem;
  color: #888;
}

/* ─────────────────────────────────────────────
   CAMERA ZONE
───────────────────────────────────────────── */
#camera-zone {
  position: relative;
  width: 100%;
  background: #000;
  overflow: hidden;
  flex-shrink: 0;
}

#video-feed {
  display: block;
  width: 100%;
  height: auto;
  max-height: 60vh;
  object-fit: cover;
  cursor: crosshair;
}

#crosshair-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#error-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  color: #ff6b6b;
  font-size: 1rem;
  font-weight: 500;
  padding: 20px;
  text-align: center;
}

/* ─────────────────────────────────────────────
   CONTROLS BAR
───────────────────────────────────────────── */
#controls-bar {
  display: flex;
  gap: 10px;
  padding: 10px 16px;
  background: #111;
  border-bottom: 1px solid #2a2a2a;
  flex-wrap: wrap;
}

#controls-bar button {
  min-height: 44px;
  min-width: 44px;
  padding: 0 18px;
  border: 1px solid #444;
  border-radius: 8px;
  background: #222;
  color: #f0f0f0;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

#controls-bar button:hover {
  background: #333;
  border-color: #666;
}

#controls-bar button.btn-active {
  background: #2a5caa;
  border-color: #3a7cd5;
  color: #fff;
}

/* ─────────────────────────────────────────────
   COLOR INFO PANEL
───────────────────────────────────────────── */
#color-panel {
  padding: 16px;
  background: #111;
  transition: opacity 0.2s;
}

#color-panel.panel-hidden {
  opacity: 0.3;
  pointer-events: none;
}

#color-panel.panel-visible {
  opacity: 1;
  pointer-events: auto;
}

/* Kotak preview warna besar */
#color-preview {
  width: 100%;
  height: 80px;
  border-radius: 12px;
  border: 2px solid #333;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  transition: background-color 0.25s ease;
}

/* Nama warna */
#color-names {
  margin-bottom: 12px;
}

#name-id {
  display: block;
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}

#name-en {
  display: block;
  font-size: 0.9rem;
  color: #999;
  margin-top: 2px;
}

/* Nilai warna HEX / RGB / HSL */
#color-values {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  padding: 12px;
  background: #1e1e1e;
  border-radius: 8px;
  border: 1px solid #2a2a2a;
}

#color-values span {
  font-family: 'Courier New', 'Consolas', monospace;
  font-size: 0.95rem;
  color: #e0e0e0;
  letter-spacing: 0.03em;
}

#val-hex {
  color: #7dd3fc !important; /* Biru muda untuk HEX */
  font-weight: 600;
  font-size: 1.05rem !important;
}

/* Tombol Copy HEX */
#btn-copy-hex {
  width: 100%;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid #3a7cd5;
  border-radius: 8px;
  background: #1a3a6a;
  color: #7dd3fc;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  letter-spacing: 0.03em;
}

#btn-copy-hex:hover {
  background: #2a5caa;
}

#btn-copy-hex:active {
  transform: scale(0.97);
}

/* ─────────────────────────────────────────────
   HISTORY STRIP
───────────────────────────────────────────── */
#history-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #0e0e0e;
  border-top: 1px solid #2a2a2a;
  overflow-x: auto;
  min-height: 56px;
}

.history-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #444;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s, border-color 0.15s;
  padding: 0;
}

.history-swatch:hover {
  transform: scale(1.2);
  border-color: #fff;
}

.history-empty {
  font-size: 0.8rem;
  color: #555;
  white-space: nowrap;
}

/* ─────────────────────────────────────────────
   TOAST NOTIFICATION
───────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1e4d2b;
  color: #6ee7b7;
  border: 1px solid #34d399;
  padding: 10px 22px;
  border-radius: 24px;
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
  pointer-events: none;
}

#toast.toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─────────────────────────────────────────────
   RESPONSIVE — MOBILE (< 768px)
───────────────────────────────────────────── */
@media (max-width: 767px) {
  #app-main {
    display: flex;
    flex-direction: column;
  }

  #video-feed {
    max-height: 55vw;
  }

  #color-panel {
    padding: 14px;
  }

  #color-preview {
    height: 70px;
  }
}

/* ─────────────────────────────────────────────
   RESPONSIVE — DESKTOP (> 1024px)
───────────────────────────────────────────── */
@media (min-width: 1024px) {
  #app-main {
    display: grid;
    grid-template-columns: 65fr 35fr;
    grid-template-rows: auto auto 1fr;
    grid-template-areas:
      "camera  panel"
      "controls panel"
      "history  panel";
    height: calc(100vh - 60px);
  }

  #camera-zone {
    grid-area: camera;
  }

  #controls-bar {
    grid-area: controls;
  }

  #history-strip {
    grid-area: history;
    align-self: start;
  }

  #color-panel {
    grid-area: panel;
    overflow-y: auto;
    border-left: 1px solid #2a2a2a;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 20px;
  }

  #video-feed {
    max-height: none;
    height: 100%;
    object-fit: cover;
  }

  #color-preview {
    height: 100px;
    margin-bottom: 20px;
  }

  #name-id {
    font-size: 1.6rem;
  }
}

/* ─────────────────────────────────────────────
   UTILITY
───────────────────────────────────────────── */
[hidden] {
  display: none !important;
}
