/* === Reset === */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; font-family: system-ui, -apple-system, sans-serif; background: #f5f5f5; color: #222; }

/* === Screens === */
.screen { display: none; position: fixed; inset: 0; width: 100%; height: 100%; background: #fff; }
.screen.active { display: flex; flex-direction: column; }

/* === App Header (portrait screens) === */
.app-header { padding: 1rem 1.2rem 0.5rem; display: flex; align-items: center; justify-content: space-between; }
.logo-main { height: 36px; }
.header-bar { padding: 0.3rem 1.2rem 0.8rem; display: flex; align-items: center; gap: 1rem; border-bottom: 1px solid #eee; }
.powered-by { font-size: 0.8rem; color: #666; display: flex; align-items: center; gap: 0.4rem; }
.logo-camcom { height: 20px; vertical-align: middle; }
.logo-camcom-small { height: 24px; }

/* === Header Indicators === */
.header-indicators { display: flex; gap: 0.5rem; align-items: center; }
.wifi-pill { background: #f0f0f0; border: 1px solid #ddd; border-radius: 20px; padding: 0.2rem 0.7rem; font-size: 0.75rem; color: #333; display: inline-flex; align-items: center; gap: 0.3rem; }
.wifi-pill::before { content: "\\1F4F6"; font-size: 0.7rem; }

/* === Screen Body === */
.screen-body { flex: 1; display: flex; flex-direction: column; padding: 1.5rem 1.2rem; }

/* === Buttons === */
.btn-primary { background: #00C853; color: #fff; border: none; padding: 0.9rem 2.2rem; border-radius: 30px; font-size: 1.05rem; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 0.5rem; box-shadow: 0 2px 8px rgba(0,200,83,0.3); }
.btn-primary:active { opacity: 0.85; transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-sm { padding: 0.6rem 1.5rem; font-size: 0.9rem; }
.btn-secondary { background: #fff; color: #333; border: 1.5px solid #ccc; padding: 0.9rem 2.2rem; border-radius: 30px; font-size: 1.05rem; font-weight: 600; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.08); display: inline-flex; align-items: center; gap: 0.5rem; }
.btn-secondary:active { opacity: 0.85; transform: scale(0.98); }
.btn-secondary.btn-sm { padding: 0.6rem 1.5rem; font-size: 0.9rem; }
.btn-back { background: none; border: 1px solid #ddd; border-radius: 50%; width: 36px; height: 36px; font-size: 1.2rem; cursor: pointer; color: #333; }
.review-message { font-size: 0.75rem; color: #d32f2f; line-height: 1.3; margin: 0.3rem 0; }

/* === Landing Screen === */
.landing-body { justify-content: space-between; background: #f5f5f5; flex: 1; }
.lang-selector { align-self: flex-end; background: #fff; border: 1px solid #ccc; border-radius: 20px; padding: 0.3rem 0.8rem; font-size: 0.8rem; color: #555; }
.globe-icon { font-size: 0.9rem; }
.landing-content { margin-top: auto; margin-bottom: 4rem; }
.landing-title { font-size: 1.8rem; font-weight: 400; color: #222; line-height: 1.3; margin-bottom: 1.5rem; }

/* === Permissions Screen === */
.perm-title { font-size: 1rem; color: #444; margin-bottom: 1.5rem; text-align: center; }
.perm-cards { display: flex; gap: 1rem; justify-content: center; margin-bottom: 2rem; }
.perm-card { border: 1.5px solid #ddd; border-radius: 16px; padding: 1.5rem 2rem; text-align: center; min-width: 130px; }
.perm-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.perm-label { font-size: 1rem; font-weight: 600; color: #222; }
.perm-status { font-size: 0.85rem; color: #999; margin-top: 0.3rem; }
.perm-status.granted { color: #00C853; font-weight: 600; }
.error-text { color: #d32f2f; font-size: 0.85rem; margin-top: 1rem; text-align: center; }

/* === Instructions Screen === */
.instructions-body { align-items: center; justify-content: center; background: #fff; }
.instructions-illustration { width: 280px; max-width: 80%; margin-bottom: 2rem; }
.instructions-text { font-size: 1rem; color: #444; line-height: 1.5; max-width: 340px; text-align: left; margin-bottom: 2rem; }

/* === Orientation Screen === */
.orientation-header { padding: 1rem; display: flex; justify-content: space-between; align-items: center; }
.orientation-body { align-items: center; justify-content: center; }
.orientation-text { font-size: 1.2rem; color: #333; }

/* === Capture Screen (full-screen camera) === */
#screen-capture { background: #000; }
#screen-capture video, #screen-recapture video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#overlay-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.toast { position: absolute; top: 1rem; left: 50%; transform: translateX(-50%); padding: 0.5rem 1.5rem; border-radius: 20px; font-size: 0.85rem; font-weight: 600; z-index: 10; color: #fff; }
.toast.warning { background: rgba(200, 60, 60, 0.85); }
.toast.info { background: rgba(60, 120, 200, 0.85); }
.toast.success { background: rgba(40, 160, 80, 0.85); }
.toast.capture { background: rgba(40, 200, 120, 0.95); }
.toast.blur { background: rgba(200, 140, 40, 0.85); }

.btn-capture { position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%); z-index: 10; background: #00C853; color: #fff; border: none; padding: 0.8rem 2.5rem; border-radius: 30px; font-size: 1rem; font-weight: 600; min-width: 120px; cursor: pointer; }

#side-indicators { position: absolute; top: 1rem; right: 1rem; display: flex; flex-direction: column; gap: 4px; z-index: 10; }
.side-dot { width: 12px; height: 12px; border-radius: 50%; background: #555; }
.side-dot.captured { background: #00C853; }
.side-dot.partial { background: #FFC107; }

/* === Review / Closeup Screens (landscape) === */
.review-layout { display: flex; flex-direction: column; height: 100%; }
.review-stepper { display: flex; align-items: center; justify-content: center; padding: 0.6rem 1rem; gap: 0; background: #fff; border-bottom: 1px solid #eee; }
.step { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #ccc; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; color: #999; background: #fff; }
.step.active { background: #00C853; border-color: #00C853; color: #fff; }
.step.done { background: #00C853; border-color: #00C853; color: #fff; }
.step-line { width: 40px; height: 2px; background: #ddd; }

.review-content { display: flex; flex: 1; overflow: hidden; }
.review-sidebar { width: 180px; min-width: 180px; padding: 1rem; display: flex; flex-direction: column; gap: 0.6rem; border-right: 1px solid #eee; background: #fafafa; }
.step-label { font-size: 0.7rem; color: #888; font-weight: 700; letter-spacing: 0.5px; }
.step-desc { font-size: 0.85rem; color: #333; line-height: 1.4; }
.mandatory-note { font-size: 0.65rem; color: #999; margin-top: auto; }

.review-grid { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.6rem; padding: 0.8rem; overflow-y: auto; align-content: start; }

/* === Side Cards (Review grid) === */
.side-card { border-radius: 10px; border: 1.5px solid #e0e0e0; overflow: hidden; background: #fff; position: relative; cursor: pointer; }
.side-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.side-card .card-label { padding: 0.3rem 0.5rem; font-size: 0.7rem; font-weight: 600; color: #333; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-card.captured { border-color: #00C853; }
.side-card.partial { border-color: #FFC107; }
.side-card.missing { opacity: 0.6; }
.card-status-icon { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; color: #fff; }
.card-status-icon.full { background: #00C853; }
.card-status-icon.partial { background: #FFC107; }

/* === Closeup Grid Cards === */
.closeup-card { border-radius: 10px; border: 1.5px solid #e0e0e0; overflow: hidden; background: #fff; position: relative; cursor: pointer; }
.closeup-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.closeup-card .card-label { padding: 0.3rem 0.5rem; font-size: 0.65rem; font-weight: 600; color: #333; text-align: center; }
.closeup-card.selected { border-color: #1976D2; }

/* === Recapture Screen === */
.recapture-label { position: absolute; top: 1rem; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.7); color: #fff; padding: 0.5rem 1rem; border-radius: 8px; z-index: 10; font-size: 0.9rem; }

/* === Loading === */
.loading-indicator { text-align: center; padding: 0.5rem; }
.spinner { width: 24px; height: 24px; border: 3px solid #ddd; border-top: 3px solid #00C853; border-radius: 50%; margin: 0 auto 0.3rem; animation: spin-loader 0.8s linear infinite; }
.loading-text { font-size: 0.7rem; color: #888; }
.btn-spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.4); border-top: 2px solid #fff; border-radius: 50%; animation: spin-loader 0.8s linear infinite; vertical-align: middle; }
@keyframes spin-loader { to { transform: rotate(360deg); } }

/* === Complete Screen === */
.complete-body { align-items: flex-start; max-width: 500px; margin: 0 auto; overflow-y: auto; }
.complete-body h2 { font-size: 1.3rem; margin-bottom: 1rem; }
.complete-body h3 { margin-top: 1.2rem; margin-bottom: 0.4rem; font-size: 0.95rem; opacity: 0.6; }
.complete-body p { margin: 0.2rem 0; font-size: 0.9rem; }
.map-placeholder { margin-top: 1rem; height: 120px; background: #f0f0f0; border: 1px dashed #ccc; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #aaa; font-size: 0.9rem; width: 100%; }
.low-light-warning { background: rgba(255,193,7,0.15); border: 1px solid #FFC107; color: #8d6e00; padding: 0.5rem 0.8rem; border-radius: 6px; margin-top: 0.8rem; font-size: 0.8rem; }
