/* ==========================================================================
   Picta: Assistive Camera & Color Vision Deficiency Engine
   Responsive Mobile-First Material Design Stylesheet
   ========================================================================== */

:root {
  --picta-bg: #090d16;
  --picta-surface: #131b2e;
  --picta-card-bg: rgba(19, 27, 46, 0.88);
  --picta-border: rgba(255, 255, 255, 0.12);
  --picta-primary: #3b82f6;
  --picta-primary-glow: rgba(59, 130, 246, 0.35);
  --picta-accent: #f43f5e;
  --picta-text: #f8fafc;
  --picta-text-muted: #94a3b8;
  --picta-pill-active: #2563eb;
  --picta-shutter: #ef4444;
  --picta-shutter-glow: rgba(239, 68, 68, 0.4);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--picta-bg);
  color: var(--picta-text);
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

.picta-body {
  display: flex;
  flex-direction: column;
}

.picta-app-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  position: relative;
  overflow: hidden;
  background: #000;
}

/* ==========================================================================
   Top Navigation Header
   ========================================================================== */

.picta-header {
  height: 56px;
  background: rgba(9, 13, 22, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--picta-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 50;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
}

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

.brand-icon {
  font-size: 24px;
  color: var(--picta-primary);
  background: rgba(59, 130, 246, 0.15);
  padding: 6px;
  border-radius: 10px;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #fff;
  line-height: 1.1;
}

.brand-tag {
  font-size: 11px;
  color: var(--picta-text-muted);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--picta-border);
  color: var(--picta-text);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.icon-btn:hover, .icon-btn:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.icon-btn:active {
  transform: scale(0.94);
}

.icon-btn i {
  font-size: 20px;
}

/* ==========================================================================
   Main Viewport & Camera Stream
   ========================================================================== */

.picta-viewport {
  flex: 1;
  position: relative;
  background: #05070a;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: crosshair;
}

.camera-stream, .fallback-stream {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: filter 0.25s ease-out;
}

/* Camera Flash Overlay */
.camera-flash {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 100;
  transition: opacity 0.05s ease-out;
}

.camera-flash.flash-active {
  opacity: 0.85;
  transition: none;
}

/* Status / Permission Overlay */
.camera-status-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 14, 23, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
  z-index: 30;
  backdrop-filter: blur(8px);
}

.status-icon {
  font-size: 54px;
  color: var(--picta-accent);
  margin-bottom: 16px;
}

.camera-status-overlay h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #fff;
}

.camera-status-overlay p {
  font-size: 14px;
  color: var(--picta-text-muted);
  max-width: 380px;
  line-height: 1.5;
  margin-bottom: 24px;
}

.status-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Interactive Color Eyedropper Reticle */
.color-reticle {
  position: absolute;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 20;
  transition: transform 0.15s ease-out;
}

.reticle-ring {
  position: absolute;
  inset: 0;
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.8), 0 4px 12px rgba(0, 0, 0, 0.5);
  animation: pulse-ring 2s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

.reticle-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background-color: #808080;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6);
}

.reticle-hint {
  position: absolute;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.75);
  color: #e2e8f0;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  pointer-events: none;
  opacity: 0.7;
}

@keyframes pulse-ring {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.1); opacity: 0.6; }
}

/* Floating Color Inspector Card */
.color-inspector-card {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  max-width: 440px;
  margin: 0 auto;
  background: var(--picta-card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--picta-border);
  border-radius: 16px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  z-index: 40;
}

.color-swatch-box {
  flex-shrink: 0;
}

.swatch-circle {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background-color: #808080;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.color-details {
  flex: 1;
  min-width: 0;
}

.color-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.color-name {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.speak-btn {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--picta-primary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}

.speak-btn:hover {
  background: rgba(59, 130, 246, 0.25);
  color: #fff;
}

.speak-btn i {
  font-size: 18px;
}

.color-specs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.spec-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  padding: 2px 7px;
  border-radius: 6px;
}

.mood-pill {
  font-family: 'Roboto', sans-serif;
  color: #94a3b8;
  font-weight: 400;
  background: transparent;
  border: none;
  padding: 0;
  margin-left: 2px;
}

/* ==========================================================================
   Filter Pill Carousel
   ========================================================================== */

.filter-carousel-wrapper {
  background: rgba(9, 13, 22, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--picta-border);
  padding: 10px 14px;
  z-index: 50;
  flex-shrink: 0;
}

.filter-carousel {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 2px 0;
}

.filter-carousel::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  flex-shrink: 0;
  height: 38px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--picta-border);
  color: var(--picta-text-muted);
  border-radius: 20px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.filter-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

.filter-pill.active {
  background: var(--picta-pill-active);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 4px 14px var(--picta-primary-glow);
  font-weight: 600;
}

.pill-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.3);
}

.pill-badge {
  font-size: 9px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 5px;
  border-radius: 4px;
}

.pill-badge.sim {
  background: rgba(234, 179, 8, 0.25);
  color: #fef08a;
}

/* ==========================================================================
   Bottom Shutter & Navigation Bar
   ========================================================================== */

.picta-bottom-bar {
  height: 76px;
  background: #090d16;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 24px;
  z-index: 50;
  flex-shrink: 0;
  position: relative;
}

.nav-tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--picta-text-muted);
  text-decoration: none;
  font-size: 11px;
  gap: 3px;
  padding: 6px 12px;
  border-radius: 12px;
  position: relative;
  transition: all 0.2s;
  min-width: 64px;
}

.nav-tab-btn i {
  font-size: 24px;
}

.nav-tab-btn:hover, .nav-tab-btn.active {
  color: #fff;
}

.nav-badge {
  position: absolute;
  top: 2px;
  right: 14px;
  background: var(--picta-accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.shutter-wrapper {
  position: relative;
  top: -12px;
}

.shutter-btn {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: #ffffff;
  border: 4px solid var(--picta-bg);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6), 0 0 0 2px var(--picta-border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease-out, box-shadow 0.15s;
}

.shutter-btn:active {
  transform: scale(0.92);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.shutter-inner {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--picta-shutter);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.35);
}

.shutter-icon {
  font-size: 26px;
  color: #fff;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */

.toast-container {
  position: absolute;
  bottom: 86px;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  z-index: 1000;
}

.picta-toast {
  background: rgba(15, 23, 42, 0.95);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--picta-border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(10px) scale(0.95);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.picta-toast.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ==========================================================================
   Secondary Pages (History & Settings)
   ========================================================================== */

.picta-page-container {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--picta-bg);
  color: var(--picta-text);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.page-header {
  height: 56px;
  background: rgba(9, 13, 22, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--picta-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-title {
  font-size: 18px;
  font-weight: 700;
}

.page-content-area {
  flex: 1;
  padding: 20px 16px 80px;
  max-width: 860px;
  margin: 0 auto;
  width: 100%;
}

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

.snapshot-card {
  background: var(--picta-surface);
  border: 1px solid var(--picta-border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
}

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

.snapshot-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.snapshot-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  backdrop-filter: blur(4px);
}

.snapshot-meta {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.snapshot-color-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.chip-circle {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid #fff;
}

.snapshot-time {
  font-size: 11px;
  color: var(--picta-text-muted);
}

.snapshot-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.snapshot-btn {
  background: transparent;
  border: none;
  color: var(--picta-text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
}

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

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--picta-text-muted);
}

.empty-state i {
  font-size: 48px;
  color: rgba(255, 255, 255, 0.2);
  margin-bottom: 12px;
}

/* Settings Cards */
.settings-section {
  background: var(--picta-surface);
  border: 1px solid var(--picta-border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--picta-primary);
  margin-bottom: 16px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.setting-row:last-child {
  border-bottom: none;
}

.setting-info h4 {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 3px;
}

.setting-info p {
  font-size: 12px;
  color: var(--picta-text-muted);
  line-height: 1.4;
}

.cvd-info-card {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 12px;
  padding: 14px;
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.5;
  color: #cbd5e1;
}

.cvd-info-card strong {
  color: #60a5fa;
}
