/* DOORPA Visitor — Mobile-First Design */

:root {
    --bg: #0A0A0C;
    --surface: #16161A;
    --border: rgba(255,255,255,0.07);
    --text: #F0ECE5;
    --dim: #8A8490;
    --muted: #5C5760;
    --green: #34D068;
    --green-bg: rgba(52,208,104,0.12);
    --red: #F04438;
    --red-bg: rgba(240,68,56,0.12);
    --amber: #F5A623;
    --amber-bg: rgba(245,166,35,0.10);
    --r: 16px;
    --font: 'Inter', system-ui, sans-serif;
}

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

html { font-size: 16px; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    -webkit-font-smoothing: antialiased;
}

/* ── Modal ─────────────────────────────────── */
.modal {
    position: fixed; inset: 0; z-index: 100;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 24px;
    transition: opacity 0.3s;
}
.modal.hide { opacity: 0; pointer-events: none; }

.modal-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 32px 24px 28px;
    width: 100%; max-width: 360px;
    text-align: center;
}
.modal.hide .modal-card { transform: translateY(16px) scale(0.97); }

.modal-icon {
    width: 56px; height: 56px; margin: 0 auto 16px;
    border-radius: 50%;
    background: var(--green-bg);
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
}

.modal-card h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 6px; }
.modal-card p { color: var(--dim); font-size: 0.88rem; line-height: 1.5; margin-bottom: 24px; }

/* ── Inputs ────────────────────────────────── */
.field {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border);
    background: var(--bg);
    border-radius: 12px;
    font-size: 1rem;
    font-family: var(--font);
    color: var(--text);
    outline: none;
    margin-bottom: 16px;
    transition: border-color 0.2s;
}
.field::placeholder { color: var(--muted); }
.field:focus { border-color: rgba(52,208,104,0.4); box-shadow: 0 0 0 3px var(--green-bg); }
.field.err { border-color: var(--red); }

/* ── Buttons ───────────────────────────────── */
.btn-primary {
    display: block; width: 100%;
    padding: 14px;
    border: none; border-radius: 999px;
    background: var(--text); color: var(--bg);
    font-size: 0.95rem; font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: transform 0.15s, background 0.2s;
}
.btn-primary:active { transform: scale(0.97); }

.btn-ring {
    display: block; width: 100%;
    padding: 16px;
    border: none; border-radius: 999px;
    background: var(--green); color: #000;
    font-size: 1rem; font-weight: 700;
    font-family: var(--font);
    letter-spacing: 0.04em;
    cursor: pointer;
    box-shadow: 0 8px 24px var(--green-bg);
    transition: transform 0.15s;
}
.btn-ring:active { transform: scale(0.97); }
.btn-ring:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-ring.ringing {
    animation: pulse 1.4s ease-out infinite;
    pointer-events: none;
}

@keyframes pulse {
    0%   { box-shadow: 0 8px 24px var(--green-bg), 0 0 0 0 rgba(52,208,104,0.3); }
    70%  { box-shadow: 0 8px 24px var(--green-bg), 0 0 0 12px rgba(52,208,104,0); }
    100% { box-shadow: 0 8px 24px var(--green-bg), 0 0 0 0 rgba(52,208,104,0); }
}

/* ── App Shell ─────────────────────────────── */
.app {
    width: 100%; max-width: 420px;
    min-height: 100dvh;
    display: flex; flex-direction: column;
    padding: 0 16px;
}

/* Header */
header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 0;
    position: sticky; top: 0; z-index: 10;
    background: linear-gradient(to bottom, var(--bg) 70%, transparent);
}

.brand {
    display: flex; align-items: center; gap: 8px;
    font-size: 1rem; font-weight: 700;
}

.logo {
    width: 28px; height: 28px; border-radius: 8px;
    background: var(--green);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 800; color: #000;
}

.badge {
    display: flex; align-items: center; gap: 5px;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 5px 10px; border-radius: 999px;
    font-size: 0.65rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--green);
}

.dot {
    width: 5px; height: 5px; border-radius: 50%;
    background: var(--green);
    animation: blink 2s infinite;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Owner */
.owner {
    display: flex; align-items: center; gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r); padding: 16px;
    margin-top: 6px;
}

.avatar {
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--green-bg); border: 2px solid rgba(52,208,104,0.2);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px; color: var(--green);
    flex-shrink: 0;
}

.owner h1 { font-size: 1rem; font-weight: 700; }
.owner p { font-size: 0.78rem; color: var(--dim); margin-top: 2px; }

/* Camera */
.camera {
    position: relative;
    margin-top: 14px;
    border-radius: var(--r); overflow: hidden;
    background: var(--surface);
    aspect-ratio: 3/4;
    border: 1px solid var(--border);
    flex: 1; min-height: 0;
}

.camera video {
    width: 100%; height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

.live-dot {
    position: absolute; top: 10px; left: 10px;
    display: flex; align-items: center; gap: 5px;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(8px);
    color: #fff; padding: 4px 10px; border-radius: 8px;
    font-size: 0.65rem; font-weight: 700; letter-spacing: 0.04em;
}
.live-dot span {
    width: 5px; height: 5px; border-radius: 50%;
    background: var(--red); animation: blink 1.2s infinite;
}

/* Status banner */
.status {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 14px;
    border-radius: 12px; margin-top: 10px;
    font-weight: 600; font-size: 0.85rem;
    border: 1px solid;
}
.status.hide { display: none; }
.status.waiting  { background: var(--amber-bg); border-color: rgba(245,166,35,0.2); color: var(--amber); }
.status.accepted { background: var(--green-bg); border-color: rgba(52,208,104,0.2); color: var(--green); }
.status.rejected { background: var(--red-bg);   border-color: rgba(240,68,56,0.2);  color: var(--red); }

/* Footer */
footer { padding: 16px 0 28px; margin-top: auto; }

/* Responsive */
@media (max-height: 680px) {
    .camera { aspect-ratio: 1/1; }
}

@media (min-width: 480px) {
    body { align-items: center; padding: 20px; }
    .app { min-height: auto; max-height: 860px; border-radius: 24px; border: 1px solid var(--border); }
}
