/**
 * ITSWEBER CMS – Page Builder Styles
 *
 * @author    Benny Weber (ITSWEBER)
 * @copyright © ITSWEBER – www.itsweber.de
 */

/* ══════════════════════════════════════════════════════════════════════════
   1. Content Header / Toolbar
   ══════════════════════════════════════════════════════════════════════════ */

.pb-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--font-sans);
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, var(--admin-primary) 0%, #0a7c8f 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(14, 116, 144, 0.3), 0 1px 2px rgba(14, 116, 144, 0.15);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.01em;
}

.pb-add-btn:hover {
    background: linear-gradient(135deg, var(--admin-primary-dark) 0%, var(--admin-primary) 100%);
    box-shadow: 0 6px 20px rgba(14, 116, 144, 0.4), 0 2px 6px rgba(14, 116, 144, 0.2);
    transform: translateY(-2px);
}

.pb-add-btn:active {
    transform: translateY(1px) scale(0.98);
}

.pb-add-btn svg,
.pb-add-btn svg *,
.pb-btn-icon,
.pb-btn-icon *,
.pb-section-icon svg,
.pb-section-icon svg *,
.pb-modal-close svg,
.pb-modal-close svg *,
.pb-type-card svg,
.pb-type-card svg * {
    pointer-events: none;
}

.pb-add-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.pb-preview-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--font-sans);
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: #fff;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.01em;
    text-decoration: none;
}

.pb-preview-btn:hover {
    background: var(--gray-50);
    border-color: var(--admin-primary-light);
    color: var(--admin-primary);
    box-shadow: 0 3px 10px rgba(14, 116, 144, 0.1);
    transform: translateY(-1px);
}

.pb-preview-btn:active {
    transform: translateY(1px) scale(0.98);
}

.pb-preview-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════════════════
   2. Section Cards
   ══════════════════════════════════════════════════════════════════════════ */

.pb-sections-list {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.pb-section-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-left: 4px solid var(--admin-accent);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.pb-section-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--gray-300);
    border-left-color: var(--admin-accent);
}

.pb-section-card--inactive {
    border-left-color: var(--gray-300);
    opacity: 0.72;
}

.pb-section-card--inactive:hover {
    opacity: 0.88;
    border-left-color: var(--gray-400);
}

.pb-section-card--dragging {
    box-shadow: var(--shadow-lg);
    opacity: 0.92;
    transform: scale(1.015);
    border-left-color: var(--admin-primary);
}

/* ── Section Header ──────────────────────────────────────────────────── */

.pb-section-header {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 1rem;
    cursor: default;
    user-select: none;
}

.pb-section-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    cursor: grab;
    color: var(--gray-400);
    transition: color var(--transition);
    border-radius: 3px;
}

.pb-section-handle:hover {
    color: var(--gray-600);
    background: var(--gray-100);
}

.pb-section-handle:active {
    cursor: grabbing;
}

.pb-section-handle svg {
    width: 14px;
    height: 14px;
}

.pb-section-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    background: var(--gray-100);
    color: var(--gray-600);
    transition: background var(--transition), color var(--transition);
}

.pb-section-icon svg {
    width: 16px;
    height: 16px;
}

/* Category-based icon colors */
.pb-section-icon--header   { background: #eff6ff; color: #2563eb; }
.pb-section-icon--content  { background: #f0fdfa; color: #0d9488; }
.pb-section-icon--media    { background: #faf5ff; color: #7c3aed; }
.pb-section-icon--preview  { background: #fff7ed; color: #ea580c; }
.pb-section-icon--action   { background: #f0fdf4; color: #16a34a; }
.pb-section-icon--global   { background: #fff1f2; color: #e11d48; }

.pb-section-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.pb-section-type {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--gray-800);
    letter-spacing: -0.01em;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pb-section-label {
    font-size: 0.725rem;
    color: var(--gray-400);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Section Status Dot ──────────────────────────────────────────────── */

.pb-section-status {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex-shrink: 0;
    padding: 0.125rem 0.5rem 0.125rem 0.375rem;
    border-radius: 20px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.pb-section-status::before {
    content: '';
    display: block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.pb-section-status--active {
    color: var(--admin-success);
    background: #ecfdf5;
}

.pb-section-status--active::before {
    background: var(--admin-success);
    box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.2);
}

.pb-section-status--inactive {
    color: var(--gray-400);
    background: var(--gray-100);
}

.pb-section-status--inactive::before {
    background: var(--gray-400);
}

/* ── Section Actions ─────────────────────────────────────────────────── */

.pb-section-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

/* ── Section Body (expandable form area) ─────────────────────────────── */

.pb-section-body {
    border-top: 1px solid var(--gray-200);
    padding: 1.25rem 1rem;
    background: var(--gray-50);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.25s ease,
                padding 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    padding-top: 0;
    padding-bottom: 0;
}

.pb-section-card--expanded .pb-section-body {
    max-height: none;
    overflow: visible;
    opacity: 1;
    padding-top: 1.25rem;
    padding-bottom: 1.25rem;
}

/* ══════════════════════════════════════════════════════════════════════════
   3. Action Buttons (icon-only, small)
   ══════════════════════════════════════════════════════════════════════════ */

.pb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--gray-400);
    transition: all var(--transition);
    padding: 0;
    flex-shrink: 0;
}

.pb-btn svg,
.pb-btn svg * {
    width: 15px;
    height: 15px;
    pointer-events: none;
}

.pb-btn:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.pb-btn:active {
    transform: scale(0.92);
}

.pb-btn-toggle:hover {
    background: var(--admin-accent-bg);
    color: var(--admin-accent);
}

.pb-btn-duplicate:hover {
    background: #eff6ff;
    color: #2563eb;
}

.pb-btn-edit:hover {
    background: var(--admin-accent-bg);
    color: var(--admin-primary);
}

.pb-btn-delete:hover {
    background: #fef2f2;
    color: var(--admin-danger);
}

.pb-btn-expand {
    transition: all var(--transition);
}

.pb-btn-expand:hover {
    background: var(--admin-accent-bg);
    color: var(--admin-accent);
}

.pb-btn-expand svg {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pb-section-card--expanded .pb-btn-expand svg {
    transform: rotate(180deg);
}

/* ══════════════════════════════════════════════════════════════════════════
   4. Add Section Modal
   ══════════════════════════════════════════════════════════════════════════ */

.pb-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.pb-modal-overlay--visible,
.pb-modal-overlay.is-open {
    display: flex;
    opacity: 1;
}

.pb-modal-overlay.is-open .pb-modal {
    transform: translateY(0) scale(1);
}

.pb-modal {
    background: #fff;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 720px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25), 0 8px 20px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.05);
    transform: translateY(12px) scale(0.97);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.pb-modal-overlay--visible .pb-modal {
    transform: translateY(0) scale(1);
}

/* ── Modal Header ────────────────────────────────────────────────────── */

.pb-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.125rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    flex-shrink: 0;
}

.pb-modal-title {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.01em;
}

.pb-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--gray-400);
    transition: all var(--transition);
    padding: 0;
}

.pb-modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.pb-modal-close svg {
    width: 18px;
    height: 18px;
}

/* ── Modal Tabs ──────────────────────────────────────────────────────── */

.pb-modal-tabs {
    display: flex;
    gap: 0;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    flex-shrink: 0;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.pb-modal-tabs::-webkit-scrollbar {
    display: none;
}

.pb-modal-tab {
    padding: 0.6875rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: var(--font-sans);
    color: var(--gray-500);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
    margin-bottom: -1px;
}

.pb-modal-tab:hover {
    color: var(--gray-700);
    background: var(--gray-50);
}

.pb-modal-tab--active {
    color: var(--admin-primary);
    border-bottom-color: var(--admin-primary);
}

.pb-modal-tab--active:hover {
    color: var(--admin-primary);
    background: transparent;
}

/* ── Modal Body / Grid ───────────────────────────────────────────────── */

.pb-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--gray-300) transparent;
}

.pb-modal-body::-webkit-scrollbar {
    width: 5px;
}

.pb-modal-body::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

.pb-modal-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

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

.pb-type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.125rem 0.875rem;
    background: #fff;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    color: inherit;
    gap: 0.5rem;
}

.pb-type-card:hover {
    border-color: var(--admin-accent);
    box-shadow: 0 4px 16px rgba(13, 148, 136, 0.1);
    transform: translateY(-2px);
}

.pb-type-card:active {
    transform: translateY(0);
    box-shadow: var(--shadow);
}

.pb-type-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    margin-bottom: 0.25rem;
    transition: transform var(--transition);
}

.pb-type-card:hover .pb-type-card-icon {
    transform: scale(1.08);
}

.pb-type-card-icon svg {
    width: 22px;
    height: 22px;
}

/* Category color coding for type card icons */
.pb-type-card-icon--header   { background: #eff6ff; color: #2563eb; }
.pb-type-card-icon--content  { background: #f0fdfa; color: #0d9488; }
.pb-type-card-icon--media    { background: #faf5ff; color: #7c3aed; }
.pb-type-card-icon--preview  { background: #fff7ed; color: #ea580c; }
.pb-type-card-icon--action   { background: #f0fdf4; color: #16a34a; }
.pb-type-card-icon--global   { background: #fff1f2; color: #e11d48; }

.pb-type-card-name {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--gray-800);
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.pb-type-card-desc {
    font-size: 0.725rem;
    color: var(--gray-400);
    line-height: 1.4;
}

/* Disabled type card */
.pb-type-card--disabled {
    opacity: 0.48;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(0.5);
}

.pb-type-card--disabled:hover {
    border-color: var(--gray-200);
    box-shadow: none;
    transform: none;
}

.pb-type-card--disabled .pb-type-card-icon {
    background: var(--gray-100);
    color: var(--gray-400);
}

/* Tooltip for disabled cards */
.pb-type-card--disabled[title] {
    position: relative;
}

/* ══════════════════════════════════════════════════════════════════════════
   5. Toast Messages
   ══════════════════════════════════════════════════════════════════════════ */

.pb-toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.pb-toast {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 1.125rem;
    border-radius: var(--radius);
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: var(--font-sans);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), 0 2px 6px rgba(0, 0, 0, 0.08);
    pointer-events: auto;
    min-width: 240px;
    max-width: 380px;
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.25s ease;
}

.pb-toast--visible {
    transform: translateX(0);
    opacity: 1;
}

.pb-toast--exit {
    transform: translateX(120%);
    opacity: 0;
}

.pb-toast svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.pb-toast--success {
    background: #ecfdf5;
    color: var(--admin-success);
    border: 1px solid rgba(5, 150, 105, 0.2);
    border-left: 4px solid var(--admin-success);
}

.pb-toast--error {
    background: #fef2f2;
    color: var(--admin-danger);
    border: 1px solid rgba(220, 38, 38, 0.2);
    border-left: 4px solid var(--admin-danger);
}

.pb-toast--info {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-left: 4px solid #2563eb;
}

.pb-toast--warning {
    background: #fffbeb;
    color: var(--admin-warning);
    border: 1px solid rgba(217, 119, 6, 0.2);
    border-left: 4px solid var(--admin-warning);
}

.pb-toast-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: none;
    background: none;
    border-radius: 3px;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    margin-left: auto;
    padding: 0;
    flex-shrink: 0;
    transition: opacity var(--transition), background var(--transition);
}

.pb-toast-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.06);
}

.pb-toast-close svg {
    width: 12px;
    height: 12px;
}

/* ══════════════════════════════════════════════════════════════════════════
   6. Form Styles
   ══════════════════════════════════════════════════════════════════════════ */

.pb-form-content {
    min-height: 60px;
}

.pb-form-group {
    margin-bottom: 1rem;
}

.pb-form-group:last-child {
    margin-bottom: 0;
}

.pb-form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
    color: var(--gray-700);
    letter-spacing: 0.01em;
}

.pb-form-group input[type="text"],
.pb-form-group input[type="email"],
.pb-form-group input[type="url"],
.pb-form-group input[type="number"],
.pb-form-group textarea,
.pb-form-group select {
    width: 100%;
    padding: 0.5625rem 0.75rem;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-family: var(--font-sans);
    background: #fff;
    color: var(--gray-800);
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.pb-form-group input:hover,
.pb-form-group textarea:hover,
.pb-form-group select:hover {
    border-color: var(--admin-primary-light);
    box-shadow: 0 2px 6px rgba(14, 116, 144, 0.08);
}

.pb-form-group input:focus,
.pb-form-group textarea:focus,
.pb-form-group select:focus {
    outline: none;
    border-color: var(--admin-accent);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12), 0 2px 8px rgba(13, 148, 136, 0.08);
}

.pb-form-group input::placeholder,
.pb-form-group textarea::placeholder {
    color: var(--gray-400);
    font-weight: 400;
}

.pb-form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.pb-form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.25rem;
}

.pb-form-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 0.25rem;
    line-height: 1.4;
}

/* Row layout for side-by-side fields */
.pb-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* Checkbox inside form */
.pb-form-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.pb-form-checkbox input[type="checkbox"] {
    width: 1.125rem;
    height: 1.125rem;
    accent-color: var(--admin-primary);
    cursor: pointer;
    margin: 0;
}

.pb-form-checkbox span {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--gray-700);
}

/* ── Form Actions Bar (sticky save area) ─────────────────────────────── */

.pb-form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    background: #fff;
    border-top: 1px solid var(--gray-200);
    position: sticky;
    bottom: 0;
    z-index: 10;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.04);
}

.pb-form-actions .btn {
    min-width: 100px;
}

/* ══════════════════════════════════════════════════════════════════════════
   7. Empty State
   ══════════════════════════════════════════════════════════════════════════ */

.pb-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3.5rem 2rem;
    text-align: center;
    background: #fff;
    border: 2px dashed var(--gray-200);
    border-radius: var(--radius-lg);
    transition: border-color var(--transition);
}

.pb-empty-state:hover {
    border-color: var(--gray-300);
}

.pb-empty-state-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gray-100);
    color: var(--gray-400);
    margin-bottom: 1rem;
}

.pb-empty-state-icon svg {
    width: 28px;
    height: 28px;
}

.pb-empty-state-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-700);
    margin-bottom: 0.375rem;
    letter-spacing: -0.01em;
}

.pb-empty-state-text {
    font-size: 0.8125rem;
    color: var(--gray-400);
    margin-bottom: 1.25rem;
    line-height: 1.5;
    max-width: 320px;
}

.pb-empty-state .pb-add-btn {
    font-size: 0.8125rem;
}

/* ══════════════════════════════════════════════════════════════════════════
   8. Sortable / Drag States (SortableJS integration)
   ══════════════════════════════════════════════════════════════════════════ */

.sortable-ghost {
    opacity: 0.35;
    background: var(--admin-accent-bg);
    border: 2px dashed var(--admin-accent);
    border-left-width: 4px;
    border-radius: var(--radius);
    box-shadow: none;
}

.sortable-ghost > * {
    visibility: hidden;
}

.sortable-chosen {
    box-shadow: var(--shadow-lg);
    border-left-color: var(--admin-primary);
}

.sortable-drag {
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0, 0, 0, 0.1);
    opacity: 0.95;
    transform: rotate(1deg) scale(1.02);
    z-index: 9999;
    border-left-color: var(--admin-primary);
}

/* Smooth list transitions during sort */
.pb-sections-list--sorting .pb-section-card {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ══════════════════════════════════════════════════════════════════════════
   9. Section Order Number
   ══════════════════════════════════════════════════════════════════════════ */

.pb-section-order {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--gray-100);
    color: var(--gray-500);
    font-size: 0.6875rem;
    font-weight: 700;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* ══════════════════════════════════════════════════════════════════════════
   10. Loading / Spinner
   ══════════════════════════════════════════════════════════════════════════ */

.pb-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--gray-400);
}

.pb-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--admin-accent);
    border-radius: 50%;
    animation: pb-spin 0.7s linear infinite;
}

@keyframes pb-spin {
    to { transform: rotate(360deg); }
}

.pb-loading-text {
    margin-left: 0.625rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--gray-500);
}

/* ══════════════════════════════════════════════════════════════════════════
   11. Confirmation Dialog (inline delete confirm, etc.)
   ══════════════════════════════════════════════════════════════════════════ */

.pb-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.pb-confirm-dialog {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    max-width: 380px;
    width: 100%;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
    text-align: center;
}

.pb-confirm-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.pb-confirm-text {
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.pb-confirm-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

/* ══════════════════════════════════════════════════════════════════════════
   12. Responsive
   ══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .pb-modal {
        max-width: 100%;
        max-height: 90vh;
        border-radius: var(--radius);
    }

    .pb-modal-overlay {
        padding: 0.75rem;
    }

    .pb-modal-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .pb-section-label {
        display: none;
    }

    .pb-section-status {
        padding: 0.125rem 0.25rem;
        font-size: 0;
    }

    .pb-section-status::before {
        margin: 0;
    }

    .pb-form-row {
        grid-template-columns: 1fr;
    }

    .pb-toast-container {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
    }

    .pb-toast {
        min-width: 0;
        max-width: none;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .pb-modal-grid {
        grid-template-columns: 1fr;
    }

    .pb-modal-header {
        padding: 0.875rem 1rem;
    }

    .pb-modal-body {
        padding: 1rem;
    }

    .pb-modal-tabs {
        padding: 0 1rem;
    }

    .pb-section-header {
        padding: 0.625rem 0.75rem;
        gap: 0.5rem;
    }

    .pb-section-actions {
        gap: 0.125rem;
    }

    .pb-btn {
        width: 26px;
        height: 26px;
    }

    .pb-btn svg {
        width: 13px;
        height: 13px;
    }

    .pb-empty-state {
        padding: 2.5rem 1.25rem;
    }

    .pb-type-card {
        padding: 0.875rem 0.75rem;
    }

    .pb-type-card-icon {
        width: 36px;
        height: 36px;
    }

    .pb-type-card-icon svg {
        width: 18px;
        height: 18px;
    }

    .pb-form-actions {
        flex-direction: column;
    }

    .pb-form-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   13. Utility classes
   ══════════════════════════════════════════════════════════════════════════ */

.pb-hidden {
    display: none !important;
}

.pb-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Fade-in animation for newly added sections */
@keyframes pb-fade-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pb-section-card--new {
    animation: pb-fade-in 0.35s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* Fade-out animation for removed sections */
@keyframes pb-fade-out {
    from {
        opacity: 1;
        transform: translateY(0);
        max-height: 200px;
    }
    to {
        opacity: 0;
        transform: translateY(-8px);
        max-height: 0;
        margin: 0;
        padding: 0;
        border-width: 0;
    }
}

.pb-section-card--removing {
    animation: pb-fade-out 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    pointer-events: none;
}

/* ══════════════════════════════════════════════════════════════════════════
   14. Live Preview Modal
   ══════════════════════════════════════════════════════════════════════════ */

.pb-preview-modal-inner {
    max-width: 95vw;
    width: 95vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.pb-preview-body {
    flex: 1;
    overflow: hidden;
    padding: 0 !important;
    position: relative;
}

.pb-preview-frame-wrapper {
    width: 100%;
    max-width: 100%;
    height: 100%;
    min-height: 500px;
    margin: 0 auto;
    transition: max-width .3s ease;
    background: #fff;
    border: 1px solid var(--gray-200, #e5e7eb);
}

.pb-preview-iframe {
    width: 100%;
    height: 100%;
    min-height: 500px;
    border: none;
    display: block;
}

.pb-preview-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 2rem;
    color: var(--gray-500, #6b7280);
}

/* Loading text is hidden via JS when iframe content arrives */

.pb-preview-size-btns {
    display: flex;
    gap: 4px;
    margin-left: auto;
    margin-right: 1rem;
}

.pb-preview-size-btn {
    background: none;
    border: 1px solid var(--gray-300, #d1d5db);
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    color: var(--gray-500, #6b7280);
    transition: all .15s ease;
}

.pb-preview-size-btn:hover {
    border-color: var(--gray-400, #9ca3af);
    color: var(--gray-700, #374151);
}

.pb-preview-size-btn.active {
    background: var(--primary, #2563eb);
    border-color: var(--primary, #2563eb);
    color: #fff;
}

/* ══════════════════════════════════════════════════════════════════════════
   15. Import Section
   ══════════════════════════════════════════════════════════════════════════ */

.pb-import-area {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--gray-200, #e5e7eb);
}

.pb-import-btn {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    font-size: 0.8125rem;
    font-weight: 500;
    border: 1px dashed var(--gray-400, #9ca3af);
    border-radius: 6px;
    background: transparent;
    color: var(--gray-600, #4b5563);
    cursor: pointer;
    transition: all .15s ease;
}

.pb-import-btn:hover {
    border-color: var(--primary, #2563eb);
    color: var(--primary, #2563eb);
    background: rgba(37, 99, 235, 0.04);
}

/* ══════════════════════════════════════════════════════════════════════════
   16. Revisions Modal
   ══════════════════════════════════════════════════════════════════════════ */

.pb-revisions-modal-inner {
    max-width: 640px;
    width: 90vw;
}

.pb-revisions-empty {
    text-align: center;
    padding: 2rem;
    color: var(--gray-500, #6b7280);
    font-style: italic;
}

.pb-revisions-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.pb-revision-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-100, #f3f4f6);
    gap: 1rem;
}

.pb-revision-item:last-child {
    border-bottom: none;
}

.pb-revision-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.pb-revision-date {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-800, #1f2937);
}

.pb-revision-user {
    font-size: 0.75rem;
    color: var(--gray-500, #6b7280);
}

.pb-revision-summary {
    font-size: 0.75rem;
    color: var(--gray-400, #9ca3af);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pb-revision-restore {
    flex-shrink: 0;
    font-size: 0.75rem;
    padding: 4px 10px;
}

/* ══════════════════════════════════════════════════════════════════════════
   17. Print – hide page builder chrome
   ══════════════════════════════════════════════════════════════════════════ */

@media print {
    .pb-section-handle,
    .pb-section-actions,
    .pb-section-status,
    .pb-toast-container,
    .pb-modal-overlay,
    .pb-empty-state,
    .pb-form-actions {
        display: none !important;
    }

    .pb-section-card {
        box-shadow: none;
        border: 1px solid #ddd;
        break-inside: avoid;
    }
}
