/* ==========================================================================
   PrivacyCam — camera screen
   Full-viewport, dark, touch-first. Works portrait, landscape, tablet, desktop.
   ========================================================================== */

body.camera-page {
    overflow: hidden;
    background: #000;
}

.cam-app {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: #000;
    /* iOS safe areas */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

/* ------------------------------------------------------------------ topbar */

.cam-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #000;
    z-index: 10;
}

.cam-title {
    color: #fff;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: .3px;
}

/* Gallery entry: pill with icon + label, not a bare round icon. */
.cam-topbar .icon-btn {
    width: auto;
    padding: 0 16px;
    border-radius: 999px;
    gap: 8px;
    text-decoration: none;
}

.icon-btn-label {
    font-size: 14px;
    font-weight: 700;
}

/* ------------------------------------------------------------------- stage */

.cam-stage {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    background: #000;
}

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

#liveView.mirrored { transform: scaleX(-1); }

.cam-flash {
    position: absolute;
    inset: 0;
    background: #fff;
    animation: camflash .25s ease-out forwards;
    z-index: 5;
    pointer-events: none;
}

@keyframes camflash {
    from { opacity: .9; }
    to { opacity: 0; }
}

/* --------------------------------------------------------- recording state */

.rec-indicator {
    position: absolute;
    top: 14px;
    left: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    font-variant-numeric: tabular-nums;
    padding: 7px 14px;
    border-radius: 999px;
    z-index: 6;
}

.rec-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--danger);
    animation: blink 1.1s ease-in-out infinite;
}

@keyframes blink { 50% { opacity: .25; } }

/* ---------------------------------------------------------------- overlays */

.cam-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 6px;
    padding: 28px;
    background: #0a0a0a;
    color: #fff;
    z-index: 7;
}

.cam-overlay h2 { margin: 10px 0 4px; font-size: 21px; }
.cam-overlay p { margin: 0 0 16px; color: #b9c0cc; max-width: 420px; }
.cam-overlay svg { color: #8a93a3; }

.overlay-hint {
    font-size: 13px;
    color: #6d7686 !important;
}

/* ----------------------------------------------------------- upload state */

.upload-progress {
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: 24px;
    height: 30px;
    background: rgba(255, 255, 255, .15);
    border-radius: 999px;
    overflow: hidden;
    z-index: 9;
}

.upload-progress-bar {
    height: 100%;
    width: 0;
    background: var(--accent);
    border-radius: 999px;
    transition: width .15s linear;
}

.upload-progress-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

/* ---------------------------------------------------------------- controls */

.cam-controls {
    background: #000;
    padding: 12px 20px 20px;
    z-index: 10;
}

.mode-switch {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 18px;
}

.mode-btn {
    border: 0;
    background: transparent;
    color: #8a93a3;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    padding: 10px 22px;
    border-radius: 999px;
    cursor: pointer;
    transition: background .15s, color .15s;
    min-height: 44px;
}

.mode-btn.active { background: rgba(255, 255, 255, .16); color: #fff; }
.mode-btn:disabled { opacity: .4; cursor: not-allowed; }

.shutter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 340px;
    margin: 0 auto;
}

/* Small last-capture thumbnail linking to the gallery, Android camera style. */
.cam-thumb {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    border: 2px solid rgba(255, 255, 255, .85);
    overflow: hidden;
    background: #1a1a1a;
    display: block;
    flex: none;
}

/* Stays in the layout (invisible) when empty so the shutter keeps centered. */
.cam-thumb[hidden] { visibility: hidden; }

.cam-thumb img,
.cam-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.shutter {
    width: 78px;
    height: 78px;
    border-radius: 50%;
    border: 5px solid #fff;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: transform .08s;
}

.shutter:active { transform: scale(.93); }
.shutter:disabled { opacity: .4; cursor: not-allowed; }

.shutter-inner {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #fff;
    transition: all .18s;
}

/* video mode: red disc */
.shutter.video-mode .shutter-inner { background: var(--danger); }

/* recording: red rounded square */
.shutter.recording { border-color: var(--danger); }
.shutter.recording .shutter-inner {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--danger);
}

/* ------------------------------------------------------- landscape/desktop */

@media (orientation: landscape) and (max-height: 500px) {
    .cam-controls { padding: 6px 20px 10px; }
    .mode-switch { margin-bottom: 8px; }
    .mode-btn { padding: 6px 18px; min-height: 38px; }
    .shutter { width: 62px; height: 62px; border-width: 4px; }
    .shutter-inner { width: 46px; height: 46px; }
    .shutter.recording .shutter-inner { width: 24px; height: 24px; }
}
