/* Recuerdos Impresos - estilos generales
   Modo claro forzado. Paleta crema/beige inspirada en el panel de referencia. */

:root {
    --bg: #f4ede0;
    --surface: #ffffff;
    --surface-alt: #faf6ec;
    --border: #e8ddc7;
    --text: #2e2a22;
    --text-muted: #8a8071;
    --accent: #1f3a5f;
    --accent-hover: #16294a;
    --accent-soft: #e9eef5;
    --success-bg: #e8f3e6;
    --success-text: #2f7a3d;
    --success-border: #c3e3c0;
    --danger: #b3261e;
    --danger-hover: #8f1e18;
    --danger-soft: #fbeaea;
    --tag-bg: #f6e3b4;
    --tag-text: #7a5a12;
    --pill-bg: #f2e6c8;
    --gold: #c9a24b;
    --gold-soft: #f6ecd4;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(60, 48, 20, 0.05), 0 10px 28px rgba(60, 48, 20, 0.07);
    --font-serif: Georgia, 'Iowan Old Style', 'Palatino Linotype', serif;
    color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

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

.page {
    max-width: 720px;
    margin: 0 auto;
    padding: 20px 16px 64px;
}

.page-wide {
    max-width: 1080px;
    margin: 0 auto;
    padding: 20px 16px 64px;
}

/* Top bar
   Fijo por defecto (paneles de admin y formularios en modo tradicional).
   El modo chat lo desactiva más abajo porque construye su propio layout
   de viewport fijo (ver chat-form.css), donde el topbar debe participar
   del flujo flex en vez de quedar posicionado por fuera de él. */
.topbar {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    flex-wrap: wrap;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

/* Empuja el contenido para que no quede tapado por el topbar fijo.
   Alto aproximado del topbar en una línea; en pantallas angostas
   donde el topbar puede envolver a dos líneas, se ajusta en el
   media query de abajo. Esto también es exclusivo del modo
   tradicional: el modo chat maneja su propio padding en chat-form.css. */
.topbar + .page,
.topbar + .page-wide {
    padding-top: 4px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    font-family: var(--font-serif);
}

.brand .logo-img {
    height: 40px;
    width: auto;
    display: block;
    border-radius: 8px;
}

.topbar-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    font-size: 0.82rem;
    letter-spacing: 0.03em;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.btn:hover { background: var(--surface-alt); text-decoration: none; box-shadow: var(--shadow); }

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }

.btn-danger {
    background: transparent;
    border-color: var(--danger);
    color: var(--danger);
}
.btn-danger:hover { background: var(--danger-soft); color: var(--danger-hover); }

.btn-ghost {
    background: transparent;
    border-color: var(--border);
}

.btn-success {
    background: transparent;
    border: 1px solid var(--success-border);
    color: var(--success-text);
}
.btn-success:hover { background: var(--success-bg); }

.btn-sm { padding: 8px 16px; font-size: 0.85rem; border-radius: var(--radius-sm); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 10px;
    flex-shrink: 0;
}

.btn-gold {
    background: var(--gold);
    border-color: var(--gold);
    color: #fff;
}
.btn-gold:hover { background: #b28e3d; border-color: #b28e3d; color: #fff; }

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 26px;
    margin-bottom: 20px;
}

.card-flat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px;
    margin-bottom: 14px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 28px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 22px;
    overflow-x: auto;
}

.tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 4px 14px;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    cursor: pointer;
    background: none;
    border-left: none;
    border-right: none;
    border-top: none;
    font-size: 1rem;
}

.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.tab:hover { color: var(--accent); text-decoration: none; }

/* Forms */
label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.92rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.required-mark { color: var(--danger); margin-left: 3px; }

.form-group { margin-bottom: 20px; min-width: 0; }

.help-text {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 4px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

input[type="text"],
input[type="email"],
input[type="date"],
input[type="search"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    max-width: 100%;
    padding: 13px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface-alt);
    color: var(--text);
    font-size: 0.98rem;
    font-family: inherit;
    min-width: 0;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea { min-height: 110px; resize: vertical; }

.checkbox-list, .radio-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 400;
}

.checkbox-item input { width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; }

/* Selector de formato de presentación (chat vs. tradicional) en el editor de formularios */
.display-mode-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
@media (min-width: 640px) {
    .display-mode-options { flex-direction: row; }
}
.display-mode-option {
    flex: 1;
    display: block;
    cursor: pointer;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    background: var(--surface-alt);
    transition: border-color 0.15s ease, background 0.15s ease;
    margin: 0;
    font-weight: 400;
}
.display-mode-option:hover { border-color: var(--accent); }
.display-mode-option:has(input:checked),
.display-mode-option.selected {
    border-color: var(--accent);
    background: var(--accent-soft);
}
.display-mode-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.display-mode-option-body {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.display-mode-option-icon {
    font-size: 1.4rem;
    line-height: 1;
    flex-shrink: 0;
}
.display-mode-option-body strong {
    font-size: 0.95rem;
}

.file-input-wrap {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    background: var(--surface-alt);
}

.file-preview-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.file-preview-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--success-border);
    border-radius: var(--radius-md);
    text-align: left;
}

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

.file-preview-item .thumb-icon {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    background: var(--surface-alt);
    border: 1px solid var(--border);
}

.file-preview-item .info {
    flex: 1;
    min-width: 0;
}

.file-preview-item .name {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
    word-break: break-word;
}

.file-preview-item .meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    font-size: 0.88rem;
    color: var(--success-text);
    font-weight: 600;
}

.file-input-wrap input[type="file"] {
    width: 100%;
    max-width: 100%;
}

.search-row {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}
.search-row input { flex: 1; }

/* Table */
.table-wrap { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td {
    text-align: left;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.92rem;
    white-space: nowrap;
}
th {
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    background: var(--surface-alt);
}
tr:last-child td { border-bottom: none; }
td.wrap, th.wrap { white-space: normal; }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.82rem;
}
.pill-success { background: var(--success-bg); color: var(--success-text); border: 1px solid var(--success-border); }
.pill-muted { background: var(--pill-bg); color: var(--tag-text); }
.pill-id {
    display: inline-flex;
    padding: 5px 12px;
    border-radius: 8px;
    background: var(--tag-bg);
    color: var(--tag-text);
    font-weight: 700;
    font-size: 0.85rem;
}

/* Alerts */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 18px;
    font-size: 0.92rem;
    border: 1px solid transparent;
}
.alert-success { background: var(--success-bg); color: var(--success-text); border-color: var(--success-border); }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.alert-info { background: var(--accent-soft); color: var(--accent); border:1px solid var(--accent)}

h1 { font-size: 1.5rem; margin: 0 0 6px; font-family: var(--font-serif); }
h2 { font-size: 1.15rem; margin: 0 0 14px; font-family: var(--font-serif); }
h3 { font-size: 1rem; margin: 0 0 10px; }
p { line-height: 1.55; }
.muted { color: var(--text-muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state .icon { font-size: 2.4rem; margin-bottom: 12px; }

/* Question builder */
.qcard {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px;
    margin-bottom: 14px;
}
.qcard-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.qcard-handle {
    cursor: grab;
    color: var(--text-muted);
    font-size: 1.2rem;
    user-select: none;
    flex-shrink: 0;
}
.qcard-type-badge {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}
.option-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}
.option-row input { flex: 1; min-width: 0; }

.divider { height: 1px; background: var(--border); margin: 20px 0; border: none; }

.login-wrap {
    max-width: 380px;
    margin: 90px auto;
    padding: 0 16px;
}

.file-list { display: flex; flex-direction: column; gap: 8px; }
.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
}
.thumb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
    margin-top: 8px;
}
.thumb-grid a {
    display: block;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
}
.thumb-grid img { width: 100%; height: 100px; object-fit: cover; display: block; }

footer.site-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    padding: 30px 16px;
}

/* Lista de botones de formularios activos (home pública) */
.form-link-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.form-link-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
}
.form-link-item:hover {
    background: var(--gold-soft);
    border-color: var(--gold);
    color: var(--text);
    text-decoration: none;
}
.form-link-item .arrow { color: var(--gold); font-size: 1.1rem; flex-shrink: 0; }

/* Formulario público: logo + tarjetas por pregunta */
.form-logo-wrap {
    text-align: center;
    margin-bottom: 22px;
}
.form-logo-wrap img {
    max-height: 110px;
    width: auto;
    display: inline-block;
}

.question-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 22px;
    margin-bottom: 16px;
}
.question-card .form-group { margin-bottom: 0; }
.question-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--gold-soft);
    color: var(--gold);
    font-size: 0.78rem;
    font-weight: 700;
    margin-right: 8px;
    flex-shrink: 0;
    vertical-align: middle;
}
.question-card label {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
}

@media (max-width: 560px) {
    .card { padding: 18px; border-radius: var(--radius-md); }
    .question-card { padding: 16px; }
    th, td { padding: 10px 12px; }
    .topbar { justify-content: center; text-align: center; }
    .topbar + .page,
    .topbar + .page-wide { padding-top: 4px; }
    input[type="text"], input[type="email"], input[type="date"], select, textarea {
        font-size: 16px; /* evita zoom automático en iOS */
    }
}
