/* =========================================================================
   CAR CURE UAE — CUSTOM CAMERA OVERLAY STYLES

   Full-screen camera capture interface.
   Premium black theme with emerald green accents.
   ========================================================================= */

/* ── Design Tokens ── */
:root {
  --cam-green:       #10b981;
  --cam-green-dim:   rgba(16, 185, 129, 0.15);
  --cam-green-glow:  rgba(16, 185, 129, 0.3);
  --cam-red:         #ef4444;
  --cam-red-dim:     rgba(239, 68, 68, 0.15);
  --cam-glass:       rgba(18, 18, 24, 0.75);
  --cam-glass-border: rgba(255, 255, 255, 0.08);
  --cam-radius:      14px;
  --cam-font:        'Supreme', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Overlay Backdrop ── */
.cam-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: #000;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
  padding:
    env(safe-area-inset-top)
    env(safe-area-inset-right)
    env(safe-area-inset-bottom)
    env(safe-area-inset-left);
}

.cam-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ── Top Bar ── */
.cam-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, transparent 100%);
}

.cam-topbar__title {
  font-family: var(--cam-font);
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  letter-spacing: 0.03em;
}

/* ── Shared Button Base ── */
.cam-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  font-family: var(--cam-font);
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.cam-btn:focus-visible {
  outline: 2px solid var(--cam-green);
  outline-offset: 2px;
}

.cam-btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ── Close Button ── */
.cam-btn--close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--cam-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--cam-glass-border);
  color: #fff;
  font-size: 1.1rem;
}

.cam-btn--close:hover {
  background: rgba(255,255,255,0.12);
}

/* ── Switch Camera Button ── */
.cam-btn--switch {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--cam-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--cam-glass-border);
  color: #fff;
  font-size: 1.1rem;
}

.cam-btn--switch:hover {
  background: rgba(255,255,255,0.12);
}

/* ── Camera Preview ── */
.cam-preview {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.cam-preview__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cam-preview__canvas {
  display: none;
}

/* ── Recording Indicator ── */
.cam-rec-indicator {
  position: absolute;
  top: calc(70px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(239, 68, 68, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 20px;
}

.cam-rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cam-red);
  animation: camRecPulse 1s ease-in-out infinite;
}

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

.cam-rec-timer {
  font-family: var(--cam-font);
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

/* ── Controls Bar ── */
.cam-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 24px 16px;
  padding-bottom: calc(32px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, transparent 100%);
}

/* ── Capture Photo Button ── */
.cam-btn--capture {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: transparent;
  padding: 0;
  position: relative;
}

.cam-capture-ring {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 4px solid #fff;
  display: block;
  position: relative;
  transition: all 0.15s ease;
}

.cam-capture-ring::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: #fff;
  transition: all 0.15s ease;
}

.cam-btn--capture:hover .cam-capture-ring {
  border-color: var(--cam-green);
}

.cam-btn--capture:hover .cam-capture-ring::after {
  background: var(--cam-green);
}

.cam-btn--capture:active .cam-capture-ring {
  transform: scale(0.92);
}

.cam-btn--capture:active .cam-capture-ring::after {
  background: var(--cam-green-dim);
}

/* ── Record Video Button ── */
.cam-btn--record {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: transparent;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cam-record-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--cam-red);
  border: 3px solid rgba(255,255,255,0.3);
  transition: all 0.2s ease;
}

.cam-btn--record:hover .cam-record-dot {
  border-color: rgba(255,255,255,0.5);
  box-shadow: 0 0 16px var(--cam-red-dim);
}

.cam-btn--record.cam-btn--recording {
  background: rgba(239, 68, 68, 0.15);
  border: 2px solid var(--cam-red);
}

/* ── Text Button (Retake / Use) ── */
.cam-btn--text {
  padding: 8px 16px;
  border-radius: 8px;
  background: transparent;
  color: rgba(255,255,255,0.8);
  font-size: 0.9rem;
  font-weight: 500;
}

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

.cam-btn--use {
  background: var(--cam-green);
  color: #fff;
  font-weight: 600;
}

.cam-btn--use:hover {
  background: #0ea472;
}

/* ── Retry / Cancel Buttons ── */
.cam-btn--retry {
  padding: 12px 28px;
  border-radius: var(--cam-radius);
  background: var(--cam-green);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
}

.cam-btn--retry:hover {
  background: #0ea472;
}

.cam-btn--cancel {
  padding: 12px 28px;
  border-radius: var(--cam-radius);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.8);
  font-size: 0.95rem;
  font-weight: 500;
}

.cam-btn--cancel:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

/* ── Permission / No Camera Screen ── */
.cam-permission,
.cam-nocamera {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  background: #0a0a0c;
}

.cam-permission__icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: rgba(255,255,255,0.4);
  margin-bottom: 1.5rem;
}

.cam-permission__title {
  font-family: var(--cam-font);
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 0.6rem;
}

.cam-permission__text {
  font-family: var(--cam-font);
  font-size: 0.88rem;
  color: rgba(255,255,255,0.5);
  line-height: 1.6;
  max-width: 300px;
  margin: 0 0 1.5rem;
}

.cam-permission__actions {
  display: flex;
  gap: 12px;
}

/* ── Preview Screen (Photo / Video) ── */
.cam-preview-screen {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  background: #0a0a0c;
}

.cam-preview-screen__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: linear-gradient(to bottom, rgba(0,0,0,0.8) 0%, transparent 100%);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
}

.cam-preview-screen__label {
  font-family: var(--cam-font);
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(255,255,255,0.8);
}

.cam-preview-screen__media {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.cam-preview-screen__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cam-preview-screen__video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ── Upload Status ── */
.cam-upload-status {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.cam-upload-status__spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--cam-green);
  border-radius: 50%;
  animation: camSpin 0.8s linear infinite;
}

@keyframes camSpin {
  to { transform: rotate(360deg); }
}

.cam-upload-status__text {
  font-family: var(--cam-font);
  font-size: 0.9rem;
  font-weight: 500;
  color: rgba(255,255,255,0.8);
}

/* ═══════════════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
  .cam-controls {
    gap: 24px;
    padding: 20px 16px;
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
  }

  .cam-btn--capture {
    width: 64px;
    height: 64px;
  }

  .cam-capture-ring {
    width: 64px;
    height: 64px;
  }

  .cam-btn--record {
    width: 64px;
    height: 64px;
  }

  .cam-topbar {
    padding: 10px 14px;
    padding-top: calc(10px + env(safe-area-inset-top));
  }

  .cam-btn--close,
  .cam-btn--switch {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
}

/* ── Landscape orientation ── */
@media (orientation: landscape) and (max-height: 500px) {
  .cam-controls {
    gap: 20px;
    padding: 12px 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }

  .cam-btn--capture {
    width: 56px;
    height: 56px;
  }

  .cam-capture-ring {
    width: 56px;
    height: 56px;
  }

  .cam-btn--record {
    width: 56px;
    height: 56px;
  }

  .cam-rec-indicator {
    top: calc(56px + env(safe-area-inset-top));
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   REDUCED MOTION
   ═══════════════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  .cam-overlay,
  .cam-btn,
  .cam-capture-ring,
  .cam-record-dot,
  .cam-upload-status__spinner {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   LIGHT THEME OVERRIDE (for preview screens only — camera is always dark)
   ═══════════════════════════════════════════════════════════════════════ */

[data-theme="light"] .cam-overlay {
  background: #000;
}

[data-theme="light"] .cam-preview-screen {
  background: #0a0a0c;
}
