/* ==============================================================================
   📷 CAMDROP — HIGH-PERFORMANCE MINIMALIST DARK THEME
   Obsidian palette with electric cyan/cobalt accents
   ============================================================================== */

:root {
  --bg-main: #0a0c10;
  --bg-card: #12151c;
  --bg-card-hover: #181d26;
  --bg-glass: rgba(18, 21, 28, 0.82);
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(0, 229, 255, 0.4);
  --accent-cyan: #00e5ff;
  --accent-blue: #3b82f6;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --font-mono: "SF Mono", Monaco, Consolas, "Liberation Mono", monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 16px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-sans);
  display: flex;
  flex-direction: column;
}

/* TOP APP BAR */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 100;
  flex-shrink: 0;
  height: 54px;
}

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

.brand-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 1px solid rgba(0, 229, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
}

.brand-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-main);
}

.brand-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(0, 229, 255, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 229, 255, 0.25);
}

.mode-switcher {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
}

.mode-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.mode-btn.active {
  background: var(--accent-cyan);
  color: #06090e;
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.35);
}

/* MAIN CONTAINER */
.app-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 54px);
}

/* ==========================================================================
   VIEW 1: CAMERA VIEW (PHONE FOCUS)
   ========================================================================== */
#viewCamera {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: #000;
  overflow: hidden;
  z-index: 10;
}

.viewfinder-wrap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 104px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #050608;
}

#videoFeed {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Flash overlay animation */
.flash-overlay {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 50;
  transition: opacity 0.08s ease;
}

.flash-overlay.active {
  opacity: 0.85;
}

/* Viewfinder corner guides */
.viewfinder-bracket {
  position: absolute;
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  pointer-events: none;
  z-index: 10;
}
.bracket-tl { top: 20px; left: 20px; border-right: none; border-bottom: none; }
.bracket-tr { top: 20px; right: 20px; border-left: none; border-bottom: none; }
.bracket-bl { bottom: 20px; left: 20px; border-right: none; border-top: none; }
.bracket-br { bottom: 20px; right: 20px; border-left: none; border-top: none; }

/* Camera Live Pill */
.camera-status-pill {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 12, 16, 0.82);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
  padding: 5px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-main);
  z-index: 20;
  white-space: nowrap;
  max-width: 90%;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulseDot 2s infinite;
  flex-shrink: 0;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* Fallback Card when camera stream is pending, denied, or inactive */
.camera-fallback-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 88%;
  max-width: 320px;
  background: rgba(18, 21, 28, 0.94);
  border: 1px solid rgba(0, 229, 255, 0.35);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 35;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
}

.fallback-camera-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(0, 229, 255, 0.12);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.camera-fallback-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-main);
}

.camera-fallback-card p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.4;
}

.btn-hero-snap {
  width: 100%;
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent-cyan);
  color: #06090e;
  border-radius: var(--radius-full);
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.4);
  cursor: pointer;
  border: none;
}

/* Camera Controls Bottom Bar - ALWAYS FIXED & VISIBLE */
.camera-controls-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 104px;
  padding: 8px 16px max(12px, env(safe-area-inset-bottom, 12px));
  background: linear-gradient(180deg, rgba(10, 12, 16, 0.75) 0%, rgba(10, 12, 16, 0.98) 40%, #0a0c10 100%);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 50;
}

.control-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.ctrl-sublabel {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.bold-sublabel {
  color: var(--accent-cyan);
  font-weight: 800;
  letter-spacing: 1px;
}

/* Shutter Button */
.shutter-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 3.5px solid #fff;
  padding: 4px;
  cursor: pointer;
  position: relative;
  outline: none;
  transition: transform 0.12s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 24px rgba(0, 229, 255, 0.35);
}

.shutter-btn:active {
  transform: scale(0.9);
  box-shadow: 0 0 32px rgba(0, 229, 255, 0.6);
}

.shutter-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #06090e;
  transition: background 0.15s ease;
}

.shutter-btn:hover .shutter-inner {
  background: #fff;
}

/* Control Auxiliary Buttons */
.ctrl-aux-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ctrl-aux-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--border-focus);
}

.ctrl-aux-btn:active {
  transform: scale(0.92);
}

/* Recent Thumbnail Bubble */
.recent-thumb-bubble {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.recent-thumb-bubble img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Mobile Camera Banner (shown on Receiver view when on phone) */
.mobile-camera-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.12), rgba(59, 130, 246, 0.12));
  border: 1px solid rgba(0, 229, 255, 0.3);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  gap: 12px;
}

@media (min-width: 820px) {
  .mobile-camera-banner {
    display: none;
  }
}

.banner-cam-icon {
  font-size: 1.5rem;
}

/* ==========================================================================
   VIEW 2: LAPTOP RECEIVER STUDIO
   ========================================================================== */
#viewReceiver {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Receiver Hero / Status Card */
.receiver-hero {
  background: linear-gradient(135deg, rgba(24, 29, 38, 0.8), rgba(16, 19, 26, 0.9));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hero-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-title-group h2 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.hero-title-group p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.folder-connect-box {
  background: rgba(10, 12, 16, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.folder-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.folder-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-blue);
  flex-shrink: 0;
}

.folder-text-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  word-break: break-all;
}

.folder-text-sub {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.btn-primary {
  background: var(--accent-cyan);
  color: #05080d;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 229, 255, 0.3);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 10px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: var(--border-focus);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.12);
  color: var(--accent-rose);
  border: 1px solid rgba(244, 63, 94, 0.3);
  font-weight: 600;
  font-size: 0.8rem;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.2);
}

/* Stats / Status Badges Row */
.receiver-stats-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.stat-pill {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-pill.active {
  border-color: rgba(16, 185, 129, 0.4);
  color: var(--accent-emerald);
}

/* Stream Gallery Header */
.gallery-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.gallery-section-head h3 {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Photos Grid */
.photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

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

.photo-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-focus);
}

.photo-card-img-wrap {
  aspect-ratio: 4 / 3;
  width: 100%;
  background: #000;
  position: relative;
  overflow: hidden;
}

.photo-card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.photo-card:hover .photo-card-img-wrap img {
  transform: scale(1.03);
}

.photo-card-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.photo-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.photo-card-status {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--accent-emerald);
  font-weight: 600;
}

.photo-card-status.pending {
  color: var(--accent-amber);
}

/* Empty State */
.empty-state {
  grid-column: 1 / -1;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
}

/* TOAST NOTIFICATIONS */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: rgba(18, 21, 28, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 12px 18px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: toastSlideUp 0.25s ease-out;
}

.toast.success { border-color: rgba(16, 185, 129, 0.4); }
.toast.info { border-color: rgba(0, 229, 255, 0.4); }
.toast.error { border-color: rgba(244, 63, 94, 0.4); }

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

/* Responsive adjustments */
@media (max-width: 768px) {
  #viewReceiver {
    padding: 16px 14px 32px;
  }
  .folder-connect-box {
    flex-direction: column;
    align-items: stretch;
  }
  .folder-connect-box .btn-primary {
    justify-content: center;
  }
}

/* FULLSCREEN LIGHTBOX MODAL */
.lightbox-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.lightbox-content {
  position: relative;
  z-index: 10;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.lightbox-content img {
  max-width: 100%;
  max-height: calc(85vh - 60px);
  object-fit: contain;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.8);
}

.lightbox-toolbar {
  background: rgba(18, 21, 28, 0.95);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  flex-wrap: wrap;
}

.lightbox-filename {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

