/* ==========================================================================
   Order Video Recorder - Style Sheet
   Designed for packaging QA stations, warehouse terminals, and desktop browsers
   ========================================================================== */

:root {
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #24344d;
  --bg-input: #0b1120;
  --border-color: #334155;
  --border-focus: #3b82f6;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-primary: #3b82f6;
  --accent-primary-hover: #2563eb;
  --accent-success: #10b981;
  --accent-success-hover: #059669;
  --accent-danger: #ef4444;
  --accent-danger-hover: #dc2626;
  --accent-warning: #f59e0b;
  --accent-purple: #8b5cf6;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace, Consolas, Courier;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow-red: 0 0 25px rgba(239, 68, 68, 0.4);
  --shadow-glow-blue: 0 0 25px rgba(59, 130, 246, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* App Container */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #111c30;
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.75rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  width: 28px;
  height: 28px;
  color: var(--accent-primary);
}

.logo-text {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}

.logo-sub {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-primary);
  background: rgba(59, 130, 246, 0.15);
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 4px;
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-input);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.tab-icon {
  width: 16px;
  height: 16px;
}

.hotkey-hint {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.25);
  padding: 1px 5px;
  border-radius: 4px;
  opacity: 0.8;
}

.tab-badge {
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 1px 7px;
  border-radius: 999px;
}

.nav-tab:not(.active) .tab-badge {
  background: var(--border-color);
  color: var(--text-secondary);
}

/* Server Status Indicator */
.server-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 4px 10px;
  border-radius: 999px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-success);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-success);
}

/* Main Content Area */
.app-main {
  flex: 1;
  padding: 1.5rem 2rem;
  max-width: 1560px;
  width: 100%;
  margin: 0 auto;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.2s ease-out;
}

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

/* ==========================================================================
   TAB 1: RECORDER STATION LAYOUT
   ========================================================================== */

.recorder-layout {
  display: grid;
  grid-template-columns: 440px 1fr;
  gap: 1.75rem;
  align-items: start;
}

@media (max-width: 1080px) {
  .recorder-layout {
    grid-template-columns: 1fr;
  }
}

.control-card, .viewfinder-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.15);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--accent-primary);
  color: #fff;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 800;
}

.shortcut-tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-primary);
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 3px 8px;
  border-radius: 6px;
}

.card-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Inputs */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.input-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  pointer-events: none;
}

.order-input {
  width: 100%;
  padding: 1rem 2.8rem 1rem 2.75rem;
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  transition: all 0.2s ease;
}

.order-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
  background: #070d18;
}

.order-input.recording-active {
  border-color: var(--accent-danger);
  background: rgba(239, 68, 68, 0.05);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25);
}

.text-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: border-color 0.2s ease;
}

.text-input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.btn-clear {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.btn-clear:hover {
  color: #fff;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-primary-hover);
  box-shadow: var(--shadow-glow-blue);
}

.btn-record-action {
  width: 100%;
  padding: 1.1rem 1.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  box-shadow: var(--shadow-md);
}

.btn-record-action.state-recording {
  background: var(--accent-danger);
  animation: pulseButton 1.8s infinite;
  box-shadow: var(--shadow-glow-red);
}

.btn-record-action.state-recording:hover {
  background: var(--accent-danger-hover);
}

@keyframes pulseButton {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  70% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.rec-dot {
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  display: inline-block;
}

.btn-stop-icon {
  width: 18px;
  height: 18px;
  display: none;
}

.state-recording .rec-dot {
  display: none;
}

.state-recording .btn-stop-icon {
  display: inline-block;
}

.btn-secondary {
  background: #334155;
  color: #fff;
}

.btn-secondary:hover {
  background: #475569;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-outline:hover {
  border-color: var(--accent-primary);
  background: rgba(59, 130, 246, 0.1);
}

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.btn-danger {
  background: var(--accent-danger);
  color: #fff;
}

.btn-danger:hover {
  background: var(--accent-danger-hover);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.action-buttons-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Instructions */
.workflow-instructions {
  background: rgba(0, 0, 0, 0.2);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.825rem;
  color: var(--text-secondary);
}

.instruction-step {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.instruction-arrow {
  text-align: center;
  font-weight: bold;
  color: var(--accent-primary);
  line-height: 1;
}

kbd, .kbd-badge {
  font-family: var(--font-mono);
  background: #1e293b;
  border: 1px solid var(--border-color);
  border-bottom: 2px solid var(--border-color);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--accent-primary);
  font-weight: 700;
}

/* Device Settings Details */
.device-settings-details {
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
}

.device-settings-details summary {
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  user-select: none;
}

.device-settings-details summary:hover {
  color: var(--text-primary);
}

.summary-icon {
  width: 16px;
  height: 16px;
}

.device-settings-body {
  padding-top: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.select-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.select-group label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.form-select {
  padding: 0.5rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
}

.toggle-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
}

/* Upload Progress */
.upload-progress-container {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-primary);
}

.progress-bar-track {
  height: 8px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-primary), #60a5fa);
  transition: width 0.15s ease;
}

/* Last Saved Record Card */
.last-saved-card {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  animation: slideDown 0.25s ease-out;
}

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

.last-saved-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge-success {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-success);
}

.last-saved-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.last-saved-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.last-saved-order {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.last-saved-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.last-saved-actions {
  display: flex;
  gap: 0.5rem;
}

/* ==========================================================================
   VIEWFINDER SCREEN PANEL
   ========================================================================== */

.viewfinder-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.viewfinder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
}

.viewfinder-title-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.live-dot {
  width: 10px;
  height: 10px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all 0.2s ease;
}

.live-dot.active {
  background: var(--accent-success);
  box-shadow: 0 0 8px var(--accent-success);
}

.live-dot.recording {
  background: var(--accent-danger);
  box-shadow: 0 0 12px var(--accent-danger);
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.viewfinder-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.viewfinder-meta {
  display: flex;
  gap: 0.5rem;
}

.hud-pill {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Screen Viewfinder */
.viewfinder-container {
  position: relative;
  background: #000;
  width: 100%;
  aspect-ratio: 16 / 10;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#webcamPreview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#webcamPreview.mirrored {
  transform: scaleX(-1);
}

/* Inactive Overlay */
.camera-inactive-overlay {
  position: absolute;
  inset: 0;
  background: #0b1120;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  z-index: 5;
}

.camera-inactive-overlay.hidden {
  display: none;
}

.placeholder-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  max-width: 380px;
}

.placeholder-icon {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
}

.placeholder-content h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.placeholder-content p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Recording HUD Overlay */
.recording-hud {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.25rem;
  pointer-events: none;
  z-index: 10;
  background: radial-gradient(circle at center, transparent 60%, rgba(0, 0, 0, 0.4) 100%);
  border: 2px solid rgba(239, 68, 68, 0.4);
}

.hud-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hud-rec-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(239, 68, 68, 0.85);
  backdrop-filter: blur(4px);
  padding: 6px 12px;
  border-radius: 999px;
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
}

.rec-pulsing-dot {
  width: 10px;
  height: 10px;
  background: #fff;
  border-radius: 50%;
  animation: blink 0.8s infinite;
}

.hud-timer {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
  background: rgba(0, 0, 0, 0.5);
  padding: 4px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.hud-order-badge {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 6px 12px;
  border-radius: 8px;
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.hud-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 700;
}

.hud-value {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
}

.hud-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.audio-vu-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.6);
  padding: 6px 12px;
  border-radius: 8px;
}

.vu-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.vu-meter-bar {
  width: 90px;
  height: 8px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  overflow: hidden;
}

.vu-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #10b981 70%, #f59e0b 85%, #ef4444 100%);
  transition: width 0.08s ease;
}

.hud-stop-prompt {
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* Viewfinder Footer */
.viewfinder-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border-color);
}

.viewfinder-quick-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-mini-icon {
  width: 14px;
  height: 14px;
}

.status-summary {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ==========================================================================
   TAB 2: SEARCH & ARCHIVE LAYOUT
   ========================================================================== */

.search-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.search-header-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.search-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.search-title-row h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.search-controls-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.search-input {
  width: 100%;
  padding: 0.85rem 2.75rem 0.85rem 2.6rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.view-switcher {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 3px;
}

.view-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.view-btn svg {
  width: 18px;
  height: 18px;
}

.view-btn.active {
  background: var(--accent-primary);
  color: #fff;
}

.search-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding-top: 0.25rem;
}

/* Video Gallery Grid */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.video-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.video-card:hover {
  transform: translateY(-3px);
  border-color: #475569;
  box-shadow: var(--shadow-md);
}

.video-card-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #0b1120;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
}

.video-card-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-play-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.video-card-thumb:hover .thumb-play-overlay {
  opacity: 1;
}

.play-circle {
  width: 46px;
  height: 46px;
  background: var(--accent-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: var(--shadow-sm);
  transform: scale(0.9);
  transition: transform 0.2s ease;
}

.video-card-thumb:hover .play-circle {
  transform: scale(1);
}

.play-circle svg {
  width: 22px;
  height: 22px;
  margin-left: 2px;
}

.card-duration-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.75);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
}

.video-card-body {
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}

.video-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.video-order-title {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

.video-date-badge {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.video-meta-list {
  display: flex;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.video-notes-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg-input);
  padding: 4px 8px;
  border-radius: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.video-card-actions .btn {
  flex: 1;
}

/* Video Table View */
.video-table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

.video-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.video-table th {
  background: rgba(0, 0, 0, 0.2);
  padding: 1rem 1.25rem;
  font-weight: 700;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
}

.video-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.video-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.video-table .table-order-num {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-primary);
}

.text-right {
  text-align: right;
}

.table-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
}

/* Empty State */
.search-empty-state {
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 4rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.8rem;
}

.empty-icon-wrap svg {
  width: 54px;
  height: 54px;
  color: var(--text-muted);
}

.search-empty-state h3 {
  font-size: 1.2rem;
  font-weight: 700;
}

.search-empty-state p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  max-width: 420px;
}

/* ==========================================================================
   TAB 3: STATS & DASHBOARD
   ========================================================================== */

.stats-layout {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.stats-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
}

.stats-header .subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.metric-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.metric-icon-wrap svg {
  width: 26px;
  height: 26px;
}

.icon-blue { background: rgba(59, 130, 246, 0.15); color: var(--accent-primary); }
.icon-green { background: rgba(16, 185, 129, 0.15); color: var(--accent-success); }
.icon-purple { background: rgba(139, 92, 246, 0.15); color: var(--accent-purple); }
.icon-amber { background: rgba(245, 158, 11, 0.15); color: var(--accent-warning); }

.metric-value {
  font-size: 1.6rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #fff;
}

.metric-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.diagnostics-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.diagnostics-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.diagnostics-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.diagnostics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 0.5rem;
}

.diag-item {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.diag-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.diag-val {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-success);
}

/* ==========================================================================
   VIDEO PLAYBACK MODAL
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  z-index: 1000;
  animation: fadeIn 0.15s ease-out;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
}

.modal-title-group h3 {
  font-size: 1.2rem;
  font-family: var(--font-mono);
  font-weight: 700;
}

.modal-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.btn-close-modal:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.video-player-container {
  background: #000;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#modalVideoPlayer {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.modal-details-bar {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: rgba(0, 0, 0, 0.15);
  border-top: 1px solid var(--border-color);
}

.details-chips {
  display: flex;
  gap: 0.5rem;
}

.chip {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: 6px;
  color: var(--text-secondary);
}

.speed-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.speed-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.btn-speed {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 3px 8px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
}

.btn-speed.active {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
  animation: toastIn 0.2s ease-out;
  min-width: 280px;
  max-width: 420px;
}

.toast.toast-success {
  border-left: 4px solid var(--accent-success);
}

.toast.toast-error {
  border-left: 4px solid var(--accent-danger);
}

.toast.toast-warning {
  border-left: 4px solid var(--accent-warning);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Utilities */
.hidden {
  display: none !important;
}
