/* ── Focus Service — Stylesheet ─────────────────────────────────────────── */

:root {
    --bg: #f5f7fa;
    --surface: #ffffff;
    --surface-hover: #f0f2f5;
    --border: #d8dce6;
    --text: #1e2a3a;
    --text-muted: #6b7a8d;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #16a34a;
    --warning: #d97706;
    --error: #dc2626;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 16px;
}

.container.narrow {
    max-width: 480px;
}

/* ── Card ──────────────────────────────────────────────────────────────── */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.center-card {
    text-align: center;
    margin-top: 15vh;
}

h1 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

h2 {
    font-size: 1.2rem;
    margin: 24px 0 12px;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 24px;
}

.hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 8px;
}

code {
    background: #e8ecf2;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

/* ── Forms ─────────────────────────────────────────────────────────────── */

label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    margin-top: 16px;
}

input[type="text"],
input[type="email"],
input[type="number"],
select, textarea {
    width: 100%;
    padding: 10px 14px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
    margin-bottom: 12px;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* ── Buttons ───────────────────────────────────────────────────────────── */

.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background 0.15s;
    margin-top: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--border);
    color: var(--text);
}
.btn-secondary:hover {
    background: var(--surface-hover);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-danger {
    background: var(--error);
    color: white;
}

/* ── Flash messages ────────────────────────────────────────────────────── */

.flash-messages {
    margin-bottom: 16px;
}

.flash {
    padding: 10px 16px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.flash-error {
    background: #fef2f2;
    border: 1px solid var(--error);
    color: #991b1b;
}

.flash-success {
    background: #f0fdf4;
    border: 1px solid var(--success);
    color: #166534;
}

/* ── Upload area ───────────────────────────────────────────────────────── */

.upload-area {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    margin: 24px 0;
}

.upload-area:hover, .upload-area.drag-over {
    border-color: var(--primary);
    background: #eff6ff;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.upload-filename {
    font-weight: 600;
    margin-bottom: 12px;
}

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

/* ── Progress bar ──────────────────────────────────────────────────────── */

.progress-bar {
    width: 100%;
    height: 28px;
    background: #e2e6ed;
    border-radius: 14px;
    overflow: hidden;
    margin: 16px 0;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #60a5fa);
    border-radius: 14px;
    transition: width 0.5s ease;
    width: 0%;
}

/* ── Status banner ─────────────────────────────────────────────────────── */

.status-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 16px 0;
    font-weight: 500;
}

.status-info     { background: #eff6ff;  border: 1px solid var(--primary); }
.status-warn     { background: #fffbeb;  border: 1px solid var(--warning); }
.status-success  { background: #f0fdf4;  border: 1px solid var(--success); }
.status-error    { background: #fef2f2;  border: 1px solid var(--error); }

.status-progress {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
}

/* ── Identify CTA ──────────────────────────────────────────────────────── */

.identify-cta {
    text-align: center;
    padding: 24px;
    border: 1px solid var(--success);
    border-radius: 12px;
    background: #f0fdf4;
    margin: 16px 0;
}

/* ── Person cards ──────────────────────────────────────────────────────── */

.person-card {
    background: #fafbfc;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

.person-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.person-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.person-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.person-thumb {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.image-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    background: var(--surface);
    padding: 2px 8px;
    border-radius: 12px;
}

.clip-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    background: var(--surface);
    padding: 2px 8px;
    border-radius: 12px;
}

.person-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.email-form,
.delivery-form {
    display: flex;
    gap: 6px;
    align-items: center;
    flex: 1;
    min-width: 250px;
    flex-wrap: wrap;
}

.email-form input,
.delivery-form input {
    margin-bottom: 0;
    flex: 1;
    min-width: 140px;
}

.delivery-form input[type="tel"] {
    max-width: 180px;
}

.delivery-sent {
    font-size: 0.85rem;
    color: var(--success);
}

/* ── Debug panel ───────────────────────────────────────────────────────── */

.debug-panel {
    margin-top: 24px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.debug-panel summary {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.debug-log {
    background: #f1f3f7;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.75rem;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    margin-top: 8px;
}

/* ── Admin page ────────────────────────────────────────────────────────── */

.admin-grid {
    display: grid;
    gap: 16px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.admin-table th, .admin-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.admin-table th {
    color: var(--text-muted);
    font-weight: 500;
}

.admin-table tr:hover td {
    background: var(--surface-hover);
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-warn    { background: #fef3c7; color: #92400e; }
.badge-error   { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #dbeafe; color: #1e40af; }

/* ── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .card { padding: 20px; }
    .center-card { margin-top: 8vh; }
    .person-actions { flex-direction: column; }
    .email-form, .delivery-form { min-width: unset; width: 100%; }
}
