/* ── 1b1 URL Shortener Plugin Styles ── */
:root {
  --b1-primary: #4f46e5;
  --b1-primary-h: #4338ca;
  --b1-success: #22c55e;
  --b1-error: #ef4444;
  --b1-border: #e5e7eb;
  --b1-bg: #f9fafb;
  --b1-text: #111827;
  --b1-muted: #6b7280;
  --b1-radius: 10px;
}

/* Wrapper */
.b1-wrap { font-family: system-ui, -apple-system, sans-serif; color: var(--b1-text); }
.b1-full { max-width: 860px; margin: 0 auto; padding: 0 0 40px; }

/* Card */
.b1-card { background: #fff; border: 1px solid var(--b1-border); border-radius: 14px; padding: 24px; margin-bottom: 20px; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.b1-card h3 { font-size: 1em; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.b1-count { background: var(--b1-bg); color: var(--b1-muted); font-size: .8em; padding: 2px 8px; border-radius: 99px; font-weight: 600; }

/* Logo */
.b1-logo { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.b1-brand { font-size: 1.4em; font-weight: 800; color: var(--b1-text); }
.b1-brand span { color: var(--b1-primary); }

/* Auth cards */
.b1-wrap .b1-card { max-width: 400px; margin: 40px auto; }
.b1-wrap.b1-full .b1-card { max-width: none; margin-bottom: 20px; margin-top: 0; }
.b1-wrap h2 { font-size: 1.3em; font-weight: 700; margin-bottom: 20px; }

/* Fields */
.b1-field { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.b1-field label { font-size: .82em; font-weight: 600; color: var(--b1-muted); text-transform: uppercase; letter-spacing: .03em; }
.b1-field input { padding: 9px 12px; border: 1px solid var(--b1-border); border-radius: 8px; font-size: .95em; outline: none; transition: border-color .15s, box-shadow .15s; background: #fff; }
.b1-field input:focus { border-color: var(--b1-primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.b1-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.b1-field-grow { flex: 2; min-width: 200px; }

/* Slug prefix */
.b1-slug-wrap { display: flex; border: 1px solid var(--b1-border); border-radius: 8px; overflow: hidden; }
.b1-slug-prefix { padding: 9px 10px; background: var(--b1-bg); color: var(--b1-muted); font-size: .85em; white-space: nowrap; border-right: 1px solid var(--b1-border); }
.b1-slug-wrap input { border: none; border-radius: 0; flex: 1; padding: 9px 10px; }
.b1-slug-wrap input:focus { box-shadow: none; }
.b1-field:has(.b1-slug-wrap):focus-within .b1-slug-wrap { border-color: var(--b1-primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }

/* Buttons */
.b1-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 20px; background: var(--b1-primary); color: #fff; border: none; border-radius: 8px; font-size: .95em; font-weight: 600; cursor: pointer; transition: background .15s; margin-top: 8px; }
.b1-btn:hover { background: var(--b1-primary-h); }
.b1-btn:disabled { opacity: .6; cursor: not-allowed; }
.b1-btn-sm { padding: 6px 14px; font-size: .85em; margin-top: 0; }
.b1-btn-outline { background: transparent; border: 1px solid var(--b1-border); color: var(--b1-muted); }
.b1-btn-outline:hover { background: var(--b1-bg); }

/* Alerts */
.b1-error   { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; padding: 10px 14px; border-radius: 8px; font-size: .9em; margin-bottom: 12px; }
.b1-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; padding: 10px 14px; border-radius: 8px; font-size: .9em; margin-bottom: 12px; }
.b1-success a { color: var(--b1-primary); font-weight: 600; }

/* Alt link */
.b1-alt { text-align: center; color: var(--b1-muted); font-size: .875em; margin-top: 16px; }
.b1-alt a { color: var(--b1-primary); font-weight: 600; text-decoration: none; }

/* Topbar */
.b1-topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 0 20px; }
.b1-topbar-right { display: flex; align-items: center; gap: 12px; }
.b1-username { font-size: .9em; color: var(--b1-muted); font-weight: 500; }

/* Stats row */
.b1-stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.b1-stat { background: #fff; border: 1px solid var(--b1-border); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; align-items: center; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.b1-stat-val { font-size: 2em; font-weight: 800; color: var(--b1-primary); line-height: 1; }
.b1-stat-lbl { font-size: .8em; color: var(--b1-muted); margin-top: 4px; }

/* Advanced toggle */
.b1-advanced-toggle { font-size: .85em; color: var(--b1-primary); cursor: pointer; margin-bottom: 8px; display: inline-block; }
.b1-advanced-toggle:hover { text-decoration: underline; }

/* Link list */
.b1-empty { text-align: center; padding: 32px; color: var(--b1-muted); font-size: .9em; }
.b1-link-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--b1-border); }
.b1-link-row:last-child { border-bottom: none; }
.b1-inactive { opacity: .55; }
.b1-link-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.b1-link-info { flex: 1; min-width: 0; }
.b1-link-short { font-weight: 700; font-size: .9em; color: var(--b1-primary); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.b1-link-short a { color: inherit; text-decoration: none; }
.b1-link-short a:hover { text-decoration: underline; }
.b1-link-title { font-size: .8em; color: var(--b1-muted); margin-top: 2px; }
.b1-link-dest  { font-size: .75em; color: #9ca3af; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; margin-top: 2px; }
.b1-badge { font-size: .7em; padding: 2px 6px; border-radius: 99px; background: #f3f4f6; color: var(--b1-muted); }
.b1-badge-red { background: #fef2f2; color: #b91c1c; }
.b1-link-clicks { text-align: center; padding: 0 12px; flex-shrink: 0; }
.b1-clicks-val { display: block; font-size: 1.3em; font-weight: 800; color: var(--b1-text); line-height: 1; }
.b1-clicks-lbl { font-size: .7em; color: var(--b1-muted); }
.b1-link-actions { display: flex; gap: 2px; flex-shrink: 0; }
.b1-icon-btn { padding: 6px; border-radius: 6px; color: var(--b1-muted); background: transparent; border: none; cursor: pointer; transition: background .15s, color .15s; }
.b1-icon-btn:hover { background: var(--b1-bg); color: var(--b1-text); }

/* Stats modal */
#b1-modal { position: fixed; inset: 0; z-index: 99999; display: flex; align-items: center; justify-content: center; padding: 20px; }
.b1-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.b1-modal-box { position: relative; background: #fff; border-radius: 16px; width: 100%; max-width: 560px; max-height: 80vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.2); z-index: 1; }
.b1-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 16px; border-bottom: 1px solid var(--b1-border); }
.b1-modal-head h3 { font-size: 1em; font-weight: 700; }
.b1-modal-head button { background: none; border: none; font-size: 1.1em; cursor: pointer; color: var(--b1-muted); }
#b1-modal-body { padding: 20px 24px; }

/* Stats bars */
.b1-stats-grid { display: flex; flex-direction: column; gap: 24px; }
.b1-stat-section h4 { font-size: .85em; font-weight: 700; color: var(--b1-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 12px; }
.b1-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.b1-bar-label { width: 80px; font-size: .82em; color: var(--b1-muted); flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b1-bar-track { flex: 1; height: 8px; background: #f3f4f6; border-radius: 99px; overflow: hidden; }
.b1-bar-fill  { height: 100%; border-radius: 99px; transition: width .4s ease; }
.b1-bar-val   { width: 28px; text-align: right; font-size: .82em; font-weight: 600; color: var(--b1-text); }

/* Create card */
.b1-create-card { margin-bottom: 20px; }

/* Responsive */
@media (max-width: 600px) {
  .b1-stats-row { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .b1-stat { padding: 12px 8px; }
  .b1-stat-val { font-size: 1.5em; }
  .b1-row { flex-direction: column; }
  .b1-link-dest { max-width: 180px; }
  .b1-link-clicks { display: none; }
}
