/* WhatsApp Webhook Admin — plain CSS, no build step.
   Served at the literal path /css/style.css so nginx can deliver it directly. */

:root {
    --bg: #0f1720;
    --bg-alt: #131c26;
    --surface: #1b2632;
    --surface-2: #223141;
    --border: #2c3a49;
    --text: #e6edf3;
    --text-muted: #9fb0c0;
    --accent: #25d366;         /* WhatsApp green */
    --accent-dark: #128c4a;
    --danger: #e5534b;
    --danger-dark: #c23b34;
    --warn: #e3a008;
    --info: #3b82f6;
    --radius: 10px;
    --radius-sm: 7px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.35), 0 6px 20px rgba(0, 0, 0, 0.25);
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
    --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code, .mono { font-family: var(--mono); }
code {
    background: var(--surface-2);
    padding: 1px 6px;
    border-radius: 5px;
    font-size: 0.88em;
}

/* ---------- Top bar ---------- */
.topbar {
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 20px;
    height: 58px;
    display: flex;
    align-items: center;
    gap: 22px;
}
.brand {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-tag {
    color: var(--accent);
    font-weight: 600;
}
.nav { display: flex; gap: 6px; }
.nav a {
    color: var(--text-muted);
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.94rem;
}
.nav a:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.topbar-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}
.user-name { color: var(--text-muted); font-size: 0.9rem; }
.inline-form { display: inline; margin: 0; }

/* ---------- Layout ---------- */
.container {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 26px 20px 60px;
    flex: 1 0 auto;
}
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}
.page-head h1 { margin: 0; font-size: 1.5rem; }
.page-head-meta { color: var(--text-muted); font-size: 0.9rem; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.card-head h2 { margin: 0; font-size: 1.1rem; }
.card-title { margin: 0 0 4px; font-size: 1.4rem; }
.muted { color: var(--text-muted); font-size: 0.92rem; }
.center { text-align: center; }

/* ---------- Auth ---------- */
.auth-wrap {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.auth-card { width: 100%; max-width: 380px; }

/* ---------- Forms ---------- */
.stack { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 0.9rem; color: var(--text-muted); }
input[type="text"],
input[type="password"],
input[type="date"],
select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
}
input:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.18);
}
input[readonly] { color: var(--text-muted); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    background: var(--surface-2);
    color: var(--text);
    transition: background 0.12s ease, border-color 0.12s ease;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #06210f; }
.btn-primary:hover { background: #2ee06f; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-dark); }
.btn-warning { background: var(--warn); color: #241a00; }
.btn-warning:hover { background: #f0b429; }
.btn-sm { padding: 5px 11px; font-size: 0.84rem; }
.btn-block { width: 100%; }
.is-disabled { opacity: 0.4; pointer-events: none; }
.is-copied { background: var(--accent) !important; color: #06210f !important; border-color: var(--accent) !important; }

/* ---------- Flash ---------- */
.flash {
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.92rem;
    border: 1px solid transparent;
}
.flash-success { background: rgba(37, 211, 102, 0.12); border-color: rgba(37, 211, 102, 0.4); color: #a7f3c8; }
.flash-error { background: rgba(229, 83, 75, 0.12); border-color: rgba(229, 83, 75, 0.4); color: #f3b7b3; }
.flash-warn { background: rgba(227, 160, 8, 0.12); border-color: rgba(227, 160, 8, 0.4); color: #f2d48a; }

/* ---------- Filters ---------- */
.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 14px;
}
.filter-field { display: flex; flex-direction: column; gap: 5px; }
.filter-field label { font-size: 0.82rem; color: var(--text-muted); }
.filter-actions { display: flex; gap: 8px; margin-left: auto; }

/* ---------- Table ---------- */
.table-card { padding: 0; overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.table th, .table td {
    padding: 11px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table thead th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--bg-alt);
}
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: none; }
.col-summary { white-space: normal; min-width: 220px; }
.col-actions { text-align: right; }

/* ---------- Badges & pills ---------- */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: capitalize;
}
.badge-message { background: rgba(37, 211, 102, 0.18); color: #7ff0ad; }
.badge-status { background: rgba(59, 130, 246, 0.18); color: #a9c9ff; }
.badge-other { background: rgba(159, 176, 192, 0.18); color: #cdd8e3; }

.pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.73rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.pill-valid { background: rgba(37, 211, 102, 0.18); color: #7ff0ad; }
.pill-invalid { background: rgba(229, 83, 75, 0.2); color: #f3b7b3; }
.pill-unchecked { background: rgba(159, 176, 192, 0.16); color: #b9c5d1; }

/* ---------- Pagination ---------- */
.table-footer { display: flex; justify-content: center; margin: 4px 0 22px; }
.pagination { display: flex; align-items: center; gap: 12px; }
.page-indicator { color: var(--text-muted); font-size: 0.88rem; }

/* ---------- Detail views ---------- */
.kv-table { width: 100%; border-collapse: collapse; }
.kv-table th, .kv-table td {
    text-align: left;
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.kv-table th { color: var(--text-muted); font-weight: 600; width: 190px; white-space: nowrap; }
.kv-table tr:last-child th, .kv-table tr:last-child td { border-bottom: none; }

.code-block {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin: 0;
    overflow-x: auto;
    font-family: var(--mono);
    font-size: 0.85rem;
    line-height: 1.55;
    color: #c9d6e2;
    white-space: pre;
    max-height: 520px;
}

/* ---------- Copy row ---------- */
.copy-row { display: flex; gap: 8px; margin-bottom: 14px; }
.copy-row input { flex: 1; }

/* ---------- Empty & danger ---------- */
.empty-state { color: var(--text-muted); text-align: center; padding: 34px 20px; }
.danger-zone {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    border: 1px solid rgba(229, 83, 75, 0.4);
    border-radius: var(--radius);
    background: rgba(229, 83, 75, 0.06);
    margin: 0;
}

/* ---------- Footer ---------- */
.footer {
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    background: var(--bg-alt);
}
.footer-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 16px 20px;
    color: var(--text-muted);
    font-size: 0.84rem;
    text-align: center;
}

/* ---------- Responsive ---------- */
@media (max-width: 620px) {
    .topbar-inner { gap: 12px; }
    .nav a { padding: 7px 9px; }
    .user-name { display: none; }
    .filter-actions { margin-left: 0; width: 100%; }
    .page-head { flex-direction: column; align-items: flex-start; }
}
