* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    background: #0f172a;
    color: #e2e8f0;
}

a {
    color: #fda4af;
}

.admin-wrap {
    width: min(1200px, 92%);
    margin: 2rem auto;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}
.admin-header a { color: #f8fafc; text-decoration: none; margin-left: 0.5rem; }
.admin-header a:hover { color: #f97316; }

.btn-visual {
    display: inline-block;
    background: #f97316;
    color: #0b1120 !important;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    font-weight: 800;
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.35);
}
.btn-visual:hover { background: #fb8c3a; color: #0b1120 !important; }

.hint-visual {
    background: rgba(249, 115, 22, 0.08);
    border: 1px dashed rgba(249, 115, 22, 0.45);
    border-radius: 10px;
    padding: 0.7rem 0.9rem;
    margin: 0 0 1rem;
    font-size: 0.9rem;
    color: #f8fafc;
}
.btn-visual-inline {
    color: #f97316;
    font-weight: 800;
    text-decoration: none;
    margin-left: 0.3rem;
}
.btn-visual-inline:hover { text-decoration: underline; }

.notice {
    background: #14532d;
    border: 1px solid #22c55e;
    color: #dcfce7;
    padding: 0.75rem 1rem;
    border-radius: 10px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.card {
    background: #111827;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 1rem;
    display: grid;
    gap: 0.55rem;
}

.card h2 {
    margin: 0 0 0.5rem;
}

label {
    font-size: 0.92rem;
    color: #cbd5e1;
}

input,
select,
textarea,
button {
    width: 100%;
    border-radius: 8px;
    border: 1px solid #475569;
    background: #0b1220;
    color: #e2e8f0;
    padding: 0.55rem 0.65rem;
}

input[type="checkbox"] {
    width: auto;
}

button {
    cursor: pointer;
    background: #ef4444;
    border: none;
    font-weight: 700;
}

.danger button {
    background: #b91c1c;
}

/* Editor de bloques */
.blocks-editor {
    display: grid;
    gap: 0.75rem;
    margin: 0.5rem 0 1rem;
}
.block-card {
    border: 1px solid #475569;
    background: #0b1220;
    border-radius: 10px;
    overflow: hidden;
}
.block-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: #1e293b;
    border-bottom: 1px solid #334155;
}
.block-actions {
    display: flex;
    gap: 0.25rem;
}
.block-actions button,
.item-controls button,
.add-item {
    width: auto;
    padding: 0.3rem 0.55rem;
    background: #334155;
    color: #e2e8f0;
    font-weight: 600;
    font-size: 0.85rem;
}
.block-actions button.danger,
.item-controls button.danger {
    background: #7f1d1d;
}
.block-card-body {
    padding: 0.75rem;
    display: grid;
    gap: 0.55rem;
}
.block-field {
    display: grid;
    gap: 0.3rem;
}
.sub-grid {
    display: grid;
    gap: 0.4rem;
    padding: 0.5rem;
    border: 1px dashed #334155;
    border-radius: 8px;
}
.item-list {
    display: grid;
    gap: 0.5rem;
    border: 1px solid #334155;
    padding: 0.5rem;
    border-radius: 8px;
}
.item-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
    align-items: start;
}
.item-controls {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.add-item {
    justify-self: start;
}
.blocks-toolbar {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.75rem;
}
.blocks-toolbar select { flex: 1; }
.blocks-toolbar button {
    width: auto;
    background: #2563eb;
}
.image-picker {
    display: grid;
    gap: 0.4rem;
}
.image-preview {
    background: #0b1220;
    border: 1px dashed #334155;
    border-radius: 8px;
    min-height: 60px;
    display: grid;
    place-items: center;
    padding: 0.5rem;
}
.image-preview img {
    max-height: 140px;
    max-width: 100%;
    border-radius: 6px;
}
.block-check {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}
.muted { color: #94a3b8; font-size: 0.9rem; }
.primary-action { background: #16a34a; }

/* La tarjeta de pagina ocupa todo el ancho cuando tiene editor */
.grid > form.card:nth-child(2) {
    grid-column: 1 / -1;
}
