:root {
  --bg-dark: #090a0f;
  --panel-bg: rgba(22, 27, 38, 0.75);
  --panel-border: rgba(255, 255, 255, 0.08);
  --accent-cyan: #00f2fe;
  --accent-blue: #4facfe;
  --accent-green: #00e676;
  --accent-red: #ff3366;
  --text-main: #f0f4f8;
  --text-muted: #8a99ad;
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
  --glass-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.45);
}

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

body {
  font-family: var(--font-family);
  background: var(--bg-dark);
  background-image: 
    radial-gradient(at 10% 20%, rgba(79, 172, 254, 0.08) 0px, transparent 50%),
    radial-gradient(at 90% 80%, rgba(0, 242, 254, 0.06) 0px, transparent 50%);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  padding: 16px;
  gap: 16px;
}

/* Header Styles */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 12px 24px;
  box-shadow: var(--glass-shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #090a0f;
  box-shadow: 0 4px 14px rgba(0, 242, 254, 0.3);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff, #c2d6ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.badge-tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  background: rgba(0, 242, 254, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 242, 254, 0.25);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 20px;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.control-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.custom-select {
  background: rgba(10, 14, 23, 0.8);
  color: var(--text-main);
  border: 1px solid var(--panel-border);
  padding: 8px 14px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 180px;
}

.custom-select:hover {
  border-color: rgba(79, 172, 254, 0.4);
}

.custom-select:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 242, 254, 0.15);
}

/* Status Pill */
.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(10, 14, 23, 0.8);
  border: 1px solid var(--panel-border);
  padding: 6px 14px;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 500;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  transition: background 0.3s ease;
}

.status-pill.recording {
  border-color: rgba(255, 51, 102, 0.4);
  background: rgba(255, 51, 102, 0.1);
}

.status-pill.recording .pulse-dot {
  background: var(--accent-red);
  box-shadow: 0 0 10px var(--accent-red);
  animation: pulse-ring 1.2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.5; }
  100% { transform: scale(0.95); opacity: 1; }
}

.timer-display {
  font-family: monospace;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
}

.status-pill.recording .timer-display {
  color: #ffffff;
}

/* Viewport Section */
.viewport-section {
  flex: 1;
  display: flex;
  position: relative;
  min-height: 0;
}

.video-card {
  width: 100%;
  height: 100%;
  background: #000;
  border-radius: 20px;
  border: 1px solid var(--panel-border);
  overflow: hidden;
  position: relative;
  box-shadow: var(--glass-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-wrapper {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

#video-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.placeholder-overlay {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.placeholder-overlay.hidden {
  display: none;
}

/* Control Dock */
.control-dock {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 14px 24px;
  box-shadow: var(--glass-shadow);
}

.dock-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.directory-selector {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

.folder-path-display {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(10, 14, 23, 0.8);
  border: 1px solid var(--panel-border);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
  overflow: hidden;
  flex: 1;
  min-width: 0;
  transition: all 0.2s ease;
}

.folder-path-display.active {
  border-color: rgba(0, 242, 254, 0.4);
  color: var(--accent-cyan);
}

.path-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  outline: none;
  white-space: nowrap;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid var(--panel-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.btn-record {
  background: linear-gradient(135deg, #00e676, #00b0ff);
  color: #090a0f;
  padding: 12px 28px;
  font-size: 0.95rem;
  box-shadow: 0 4px 16px rgba(0, 230, 118, 0.35);
}

.btn-record:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 230, 118, 0.5);
}

.btn-record:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-record.recording-active {
  background: linear-gradient(135deg, #ff3366, #ff0044);
  color: white;
  box-shadow: 0 4px 16px rgba(255, 51, 102, 0.4);
}

.btn-record.recording-active:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(255, 51, 102, 0.6);
}

.rec-icon {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
}

.btn-record.recording-active .rec-icon {
  border-radius: 2px;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 90px;
  right: 24px;
  background: rgba(22, 27, 38, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--accent-cyan);
  color: var(--text-main);
  padding: 12px 20px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  font-size: 0.88rem;
  z-index: 1000;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateY(0);
  opacity: 1;
}

.toast.hidden {
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
}

/* Mobile & Tablet Responsiveness */
@media (max-width: 768px) {
  body {
    height: 100vh;
    overflow-y: auto;
  }

  .app-container {
    height: auto;
    min-height: 100vh;
    padding: 12px;
    gap: 12px;
  }

  .app-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px 16px;
  }

  .header-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .control-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    width: 100%;
  }

  .custom-select {
    width: 100%;
    min-width: unset;
  }

  .status-pill {
    justify-content: center;
    width: 100%;
  }

  .viewport-section {
    min-height: 320px;
    height: 50vh;
  }

  .control-dock {
    padding: 14px 16px;
  }

  .dock-content {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .directory-selector {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .folder-path-display {
    width: 100%;
  }

  .action-controls {
    width: 100%;
  }

  .btn {
    width: 100%;
    padding: 12px 16px;
  }

  .toast {
    bottom: 20px;
    left: 16px;
    right: 16px;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .brand-title {
    font-size: 1rem;
  }

  .badge-tag {
    font-size: 0.65rem;
  }

  .viewport-section {
    min-height: 260px;
    height: 42vh;
  }
}

