/* ==========================================================================
   01_framework.css — base design system shared by landing/auth/admin/user
   ========================================================================== */

:root {
  --wb-primary: #2563eb;
  --wb-primary-dark: #1d4ed8;
  --wb-success: #16a34a;
  --wb-danger: #dc2626;
  --wb-warning: #d97706;
  --wb-muted: #6b7280;
  --wb-bg: #f8fafc;
  --wb-surface: #ffffff;
  --wb-border: #e5e7eb;
  --wb-text: #111827;
  --wb-radius: 8px;
  --wb-sidebar-width: 240px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--wb-bg);
  color: var(--wb-text);
  line-height: 1.5;
}

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

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

.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: var(--wb-radius);
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}
.btn-primary { background: var(--wb-primary); color: #fff; }
.btn-primary:hover { background: var(--wb-primary-dark); text-decoration: none; }
.btn-secondary { background: var(--wb-surface); border-color: var(--wb-border); color: var(--wb-text); }
.btn-danger { background: var(--wb-danger); color: #fff; }
.btn-block { display: block; width: 100%; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.alert { padding: 12px 16px; border-radius: var(--wb-radius); margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-info { background: #dbeafe; color: #1e40af; }
.alert-warning { background: #fef3c7; color: #92400e; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-muted { background: #f1f5f9; color: #475569; }

.muted { color: var(--wb-muted); }
.small { font-size: 12px; }

/* ---- Auth pages ---------------------------------------------------- */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.auth-card { background: var(--wb-surface); border: 1px solid var(--wb-border); border-radius: 12px; padding: 40px; width: 100%; max-width: 420px; }
.auth-card h1 { margin-top: 0; font-size: 22px; }
.auth-card label { display: block; margin-bottom: 16px; font-size: 13px; font-weight: 600; }
.auth-card input { display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--wb-border); border-radius: var(--wb-radius); font-size: 14px; }
.tabs { display: flex; gap: 8px; margin-bottom: 20px; border-bottom: 1px solid var(--wb-border); }
.tab { padding: 8px 4px; font-size: 13px; font-weight: 600; color: var(--wb-muted); border-bottom: 2px solid transparent; }
.tab.active { color: var(--wb-primary); border-color: var(--wb-primary); }

/* ---- Landing page ---------------------------------------------------- */
.landing-header { border-bottom: 1px solid var(--wb-border); background: var(--wb-surface); }
.landing-header .nav { display: flex; align-items: center; justify-content: space-between; padding: 16px 0; }
.brand { font-weight: 800; font-size: 18px; color: var(--wb-text); }
.landing-header nav a { margin-left: 16px; }
.hero { text-align: center; padding: 90px 0 60px; }
.hero h1 { font-size: 42px; max-width: 700px; margin: 0 auto 16px; }
.hero p { color: var(--wb-muted); font-size: 18px; margin-bottom: 32px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; padding-bottom: 80px; }
.feature-card { background: var(--wb-surface); border: 1px solid var(--wb-border); border-radius: 12px; padding: 24px; }
.landing-footer { border-top: 1px solid var(--wb-border); padding: 24px 0; color: var(--wb-muted); font-size: 13px; }

/* ---- App shell (admin + user share this) ------------------------------ */
.wb-app-shell { display: flex; min-height: 100vh; }
.wb-sidebar { width: var(--wb-sidebar-width); background: #111827; color: #e5e7eb; display: flex; flex-direction: column; padding: 20px 0; flex-shrink: 0; }
.wb-sidebar-brand { padding: 0 20px 20px; font-weight: 800; font-size: 16px; }
.wb-sidebar-brand a { color: #fff; }
.wb-sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.wb-nav-link { display: flex; align-items: center; gap: 10px; padding: 10px 20px; color: #cbd5e1; font-size: 14px; }
.wb-nav-link:hover, .wb-nav-link.active { background: rgba(255,255,255,0.08); color: #fff; text-decoration: none; }
.wb-sidebar-footer { padding: 16px 20px 0; border-top: 1px solid rgba(255,255,255,0.1); margin-top: 12px; }
.wb-sidebar-storage { padding: 12px 20px; }
.storage-bar { height: 6px; border-radius: 3px; background: rgba(255,255,255,0.1); overflow: hidden; }
.storage-bar-fill { height: 100%; background: var(--wb-primary); }
.wb-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.wb-topbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 28px; background: var(--wb-surface); border-bottom: 1px solid var(--wb-border); }
.wb-topbar h1 { margin: 0; font-size: 18px; }
.wb-topbar-actions { display: flex; align-items: center; gap: 16px; }
.wb-content { padding: 28px; }

table.wb-table { width: 100%; border-collapse: collapse; background: var(--wb-surface); border: 1px solid var(--wb-border); border-radius: var(--wb-radius); overflow: hidden; }
table.wb-table th, table.wb-table td { padding: 12px 16px; border-bottom: 1px solid var(--wb-border); text-align: left; font-size: 14px; }
table.wb-table th { background: #f9fafb; font-weight: 600; }
table.wb-table tr:last-child td { border-bottom: none; }

.wb-card { background: var(--wb-surface); border: 1px solid var(--wb-border); border-radius: var(--wb-radius); padding: 20px; margin-bottom: 20px; }
.wb-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.wb-stat-card { background: var(--wb-surface); border: 1px solid var(--wb-border); border-radius: var(--wb-radius); padding: 18px; }
.wb-stat-card .value { font-size: 26px; font-weight: 700; }
.wb-stat-card .label { color: var(--wb-muted); font-size: 13px; }

.pagination { display: flex; gap: 4px; margin-top: 16px; }
.page-link { padding: 6px 12px; border: 1px solid var(--wb-border); border-radius: 4px; font-size: 13px; }
.page-link.active { background: var(--wb-primary); color: #fff; border-color: var(--wb-primary); }

form.wb-form label { display: block; margin-bottom: 14px; font-size: 13px; font-weight: 600; }
form.wb-form input, form.wb-form select, form.wb-form textarea {
  display: block; width: 100%; margin-top: 6px; padding: 9px 12px;
  border: 1px solid var(--wb-border); border-radius: var(--wb-radius); font-size: 14px; font-family: inherit;
}

/* ---- Shared modal + media picker (used by the builder inspector and,
   later, admin upload/preview dialogs) ---------------------------------- */
.wb-modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55); z-index: 10000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.wb-modal {
  background: var(--wb-surface); border-radius: var(--wb-radius); width: 100%; max-width: 640px;
  max-height: 85vh; display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.wb-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--wb-border); }
.wb-modal-header strong { font-size: 15px; text-transform: capitalize; }
.wb-modal-close { background: none; border: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--wb-muted); }
.wb-modal-close:hover { color: var(--wb-text); }
.wb-modal-body { padding: 16px 20px; overflow-y: auto; flex: 1; }
.wb-modal-footer { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--wb-border); }

.wb-media-picker-upload { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.wb-upload-label { cursor: pointer; }
.wb-media-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.wb-media-picker-item {
  border: 2px solid var(--wb-border); border-radius: var(--wb-radius); overflow: hidden; cursor: pointer;
  aspect-ratio: 1 / 1; background: #f1f5f9; display: flex; align-items: center; justify-content: center;
}
.wb-media-picker-item:hover { border-color: var(--wb-primary); }
.wb-media-picker-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wb-media-picker-file-icon { font-size: 28px; }

/* ---- Media library grid (04_Admin/06_media + 05_User/05_media share
   this markup/behaviour, see 12_Assets/02_js/05_media.js) -------------- */
.wb-media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.wb-media-item { border: 1px solid var(--wb-border); border-radius: var(--wb-radius); overflow: hidden; background: #fff; }
.wb-media-item .wb-media-open { cursor: pointer; display: block; }
.wb-media-item img { width: 100%; height: 100px; object-fit: cover; display: block; }
.wb-media-item .meta { padding: 6px 8px; font-size: 11px; color: var(--wb-muted); }
.wb-media-delete-btn {
  background: none; border: none; padding: 0; color: var(--wb-danger); font-size: 11px;
  cursor: pointer; text-decoration: underline; font-family: inherit;
}

.wb-lightbox { max-width: 800px; }
.wb-lightbox-media { display: block; width: 100%; max-height: 65vh; object-fit: contain; background: #000; border-radius: 6px; }
.wb-lightbox-file { padding: 40px; text-align: center; }

.wb-upload-progress {
  position: relative; width: 160px; height: 22px; background: #e5e7eb; border-radius: 11px; overflow: hidden;
  display: flex; align-items: center;
}
.wb-upload-progress-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 0%; background: var(--wb-primary); transition: width .15s ease; }
.wb-upload-progress-label { position: relative; z-index: 1; width: 100%; text-align: center; font-size: 11px; font-weight: 700; color: var(--wb-text); }
