/* VeriLatch Components Styling */

/* --- Sweep Progress Banner --- */
.sweep-hero-card {
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sweep-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.sweep-hero-info h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.sweep-hero-info p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.ritual-select-dropdown {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.sweep-progress-container {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.progress-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0ea5e9, #10b981);
  border-radius: var(--radius-full);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.5);
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* --- Sweep Items Cards --- */
.sweep-items-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sweep-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 1.25rem;
  gap: 1.25rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.sweep-card.latched {
  background: rgba(16, 185, 129, 0.06);
  border-color: rgba(16, 185, 129, 0.3);
}

.sweep-card-left {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  flex: 1;
}

.sweep-category-indicator {
  width: 4px;
  height: 48px;
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 2px;
}
.cat-security { background: #0ea5e9; }
.cat-fire_safety { background: #f59e0b; }
.cat-water { background: #06b6d4; }
.cat-essentials { background: #a855f7; }
.cat-pets { background: #10b981; }
.cat-home { background: #64748b; }
.cat-energy { background: #eab308; }

.sweep-card-info {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
}

.sweep-card-title-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.sweep-card-number {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 700;
}

.sweep-card-title {
  font-size: 1.05rem;
  font-weight: 600;
}

.badge-timestamp {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 0.68rem;
}

.sweep-card-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.vocal-anchor-box {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.3rem;
  font-size: 0.75rem;
  color: #38bdf8;
  background: rgba(14, 165, 233, 0.08);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  width: fit-content;
}

/* Sweep Actions & Tactile Button */
.sweep-card-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.btn-action-photo {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-action-photo:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.btn-action-photo.has-photo {
  background: rgba(14, 165, 233, 0.15);
  color: #38bdf8;
  border-color: rgba(14, 165, 233, 0.35);
}

.btn-tactile-latch {
  position: relative;
  overflow: hidden;
  width: 160px;
  height: 48px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  user-select: none;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s ease, border-color 0.2s ease;
}

.btn-tactile-latch:active {
  transform: scale(0.97);
}

.latch-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0ea5e9, #10b981);
  z-index: 1;
}

.latch-btn-content {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text-main);
}

.btn-tactile-latch.btn-latched {
  background: #10b981;
  border-color: #059669;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.btn-tactile-latch.btn-latched .latch-text {
  color: #ffffff;
}

.icon-latch {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
}

/* Sweep Footer Toolbar */
.sweep-footer-toolbar {
  margin-top: 1.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* --- Doubt Buster Styles --- */
.doubt-buster-card {
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.doubt-header {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.status-shield {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.status-secure .status-shield {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #10b981;
}

.status-pending .status-shield {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #f59e0b;
}

.icon-shield {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
}

.status-headline {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0.35rem 0 0.2rem 0;
}

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

.search-input-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  gap: 0.75rem;
}

.search-input-wrapper input {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 0.95rem;
  width: 100%;
  outline: none;
}

.icon-search {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--text-dim);
  stroke-width: 2;
  flex-shrink: 0;
}

.doubt-items-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.doubt-item-card {
  display: flex;
  align-items: center;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  gap: 1rem;
}

.doubt-item-card.item-sealed {
  border-left: 4px solid #10b981;
}

.doubt-item-card.item-unsealed {
  border-left: 4px solid #f59e0b;
  opacity: 0.8;
}

.doubt-badge {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

.badge-ok {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

.badge-miss {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

.doubt-item-details {
  flex: 1;
}

.doubt-item-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.2rem;
}

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

.doubt-timestamp {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.doubt-phrase {
  font-size: 0.8rem;
  color: #38bdf8;
}

.btn-icon-small {
  padding: 0.4rem 0.75rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.doubt-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

/* --- Rituals Grid --- */
.rituals-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.rituals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.ritual-preset-card {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ritual-preset-card.preset-active {
  border-color: var(--border-highlight);
  box-shadow: var(--shadow-glow);
}

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

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

.preset-name {
  font-size: 1.1rem;
  font-weight: 700;
}

.preset-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
  flex: 1;
}

.preset-items-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.35rem 0;
}

.tag {
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.tag-more {
  font-size: 0.72rem;
  color: var(--text-dim);
  padding: 0.2rem 0.3rem;
}

.preset-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* --- History & Stats --- */
.history-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  padding: 1.25rem;
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent-primary);
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.history-timeline {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.history-timeline-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
}

.timeline-badge {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.timeline-content {
  flex: 1;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.2rem;
  font-size: 0.95rem;
}

.timeline-time {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.timeline-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* --- Settings --- */
.settings-card {
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border-color);
  gap: 1rem;
}

.settings-info strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}

.settings-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.15);
  transition: 0.2s;
  border-radius: 34px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--accent-emerald);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(22px);
}

.select-input {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  outline: none;
  font-size: 0.85rem;
}

.settings-divider {
  height: 1px;
  background: var(--border-color);
  margin: 0.5rem 0;
}

.settings-actions-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* --- Modals & Overlays --- */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-backdrop.active {
  display: flex;
}

.modal-window {
  width: 100%;
  max-width: 520px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
}

.modal-close-btn:hover {
  color: var(--text-main);
}

/* Camera & Photo Modal */
.camera-viewfinder-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

.camera-video {
  width: 100%;
  height: 280px;
  background: #000000;
  border-radius: var(--radius-md);
  object-fit: cover;
}

.photo-preview-container {
  text-align: center;
  position: relative;
}

.photo-proof-img {
  width: 100%;
  max-height: 340px;
  border-radius: var(--radius-md);
  object-fit: cover;
}

.photo-overlay-badge {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  color: #34d399;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

/* Celebration Modal */
.celebration-box {
  text-align: center;
  padding: 1rem 0;
}

.celebration-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 1.25rem auto;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 24px rgba(16, 185, 129, 0.35);
}

.celebration-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.celebration-message {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

/* Vocal Anchor Notification Bar */
.vocal-anchor-bar {
  position: fixed;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: rgba(14, 165, 233, 0.95);
  backdrop-filter: blur(10px);
  color: #ffffff;
  padding: 0.85rem 1.4rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  z-index: 2000;
  transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  max-width: 90%;
  text-align: center;
}

.vocal-anchor-bar.visible {
  transform: translateX(-50%) translateY(0);
}

/* Toast */
.global-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid var(--border-color);
  color: #ffffff;
  padding: 0.7rem 1.25rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  z-index: 2000;
  opacity: 0;
  transition: all 0.25s ease;
  pointer-events: none;
}

.global-toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Responsive */
@media (max-width: 640px) {
  .app-container {
    padding: 1rem 0.75rem 5rem 0.75rem;
  }
  .sweep-card {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  .sweep-card-actions {
    justify-content: space-between;
  }
  .btn-tactile-latch {
    flex: 1;
  }
  .history-stats-row {
    grid-template-columns: 1fr;
  }
}
