/* ── Custom styles for BBFS Generator ─────────────────────────────────────── */

/* Inter font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

*, *::before, *::after { box-sizing: border-box; }

:root {
  --accent: #6366f1;
  --accent-h: #4f46e5;
  --success: #22c55e;
  --danger:  #ef4444;
  --warn:    #f59e0b;
  --radius:  0.75rem;
  --shadow:  0 4px 24px rgba(0,0,0,.08);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.navbar {
            background: white;
            padding: 1rem 2rem;
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 1rem;
        }
        
        .logo {
            font-size: 1.5rem;
            font-weight: bold;
            color: #667eea;
            text-decoration: none;
        }
        
        .nav-links {
            display: flex;
            gap: 1rem;
            align-items: center;
            flex-wrap: wrap;
        }
        
        .nav-links a {
            color: #6b7280;
            text-decoration: none;
            padding: 0.5rem 1rem;
            border-radius: 6px;
            transition: background 0.2s;
        }
        
        .nav-links a:hover, .nav-links a.active {
            background: #f3f4f6;
            color: #667eea;
        }
/* ── Dark mode base ───────────────────────────────────────────────────────── */
.dark body { background: #0f172a; color: #e2e8f0; }

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
.dark ::-webkit-scrollbar-thumb { background: #475569; }

/* ── Card ─────────────────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid #f1f5f9;
}
.dark .card {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 4px 24px rgba(0,0,0,.35);
}

/* ── Gradient header ──────────────────────────────────────────────────────── */
.gradient-header {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
}

/* ── Digit input chips ────────────────────────────────────────────────────── */
#digit-chips { display: flex; flex-wrap: wrap; gap: .35rem; min-height: 2.5rem; }
.chip {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .2rem .6rem;
  border-radius: 99px;
  font-size: .8rem;
  font-weight: 600;
  background: #ede9fe;
  color: #4f46e5;
  cursor: default;
  transition: transform .1s;
  user-select: none;
}
.chip:hover { transform: scale(1.05); }
.chip .remove {
  font-size: .75rem; opacity: .6; cursor: pointer; margin-left: .15rem;
}
.chip .remove:hover { opacity: 1; }
.dark .chip { background: #312e81; color: #c7d2fe; }

/* ── Combo grid ───────────────────────────────────────────────────────────── */
#combo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: .4rem;
  max-height: 52vh;
  overflow-y: auto;
  padding-right: 4px;
}
.combo-cell {
  display: flex; align-items: center; justify-content: center;
  height: 40px;
  border-radius: .5rem;
  font-family: 'Courier New', monospace;
  font-weight: 700;
  font-size: .95rem;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
}
.combo-cell:hover {
  background: #ede9fe;
  border-color: #a5b4fc;
  transform: scale(1.06);
}
.combo-cell:active { transform: scale(.96); }
.dark .combo-cell { background: #0f172a; border-color: #334155; color: #e2e8f0; }
.dark .combo-cell:hover { background: #312e81; border-color: #6366f1; }

/* ── Progress bar ─────────────────────────────────────────────────────────── */
#progress-wrap {
  position: relative;
  height: 6px;
  border-radius: 99px;
  background: #e2e8f0;
  overflow: hidden;
}
.dark #progress-wrap { background: #334155; }

#progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, #6366f1, #a855f7);
  transition: width .2s ease;
}

#progress-bar.indeterminate {
  width: 40% !important;
  animation: indeterminate 1.2s ease-in-out infinite;
}
@keyframes indeterminate {
  0%   { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

/* ── Stat cards ───────────────────────────────────────────────────────────── */
.stat-card {
  border-radius: .65rem;
  padding: .9rem 1.1rem;
  display: flex; flex-direction: column; gap: .2rem;
}
.stat-card .label { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; opacity: .65; }
.stat-card .value { font-size: 1.5rem; font-weight: 800; line-height: 1; }

/* ── Toast ────────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;
}
.toast {
  pointer-events: all;
  padding: .65rem 1.1rem;
  border-radius: .6rem;
  font-size: .85rem;
  font-weight: 500;
  color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  animation: toastIn .25s ease forwards;
  min-width: 200px;
}
.toast.success { background: #16a34a; }
.toast.error   { background: #dc2626; }
.toast.info    { background: #0ea5e9; }
.toast.out     { animation: toastOut .3s ease forwards; }
@keyframes toastIn  { from { opacity:0; transform: translateY(12px); } to { opacity:1; transform: none; } }
@keyframes toastOut { to   { opacity:0; transform: translateY(12px); } }

/* ── Mode selector ────────────────────────────────────────────────────────── */
.mode-btn {
  flex: 1; padding: .55rem .5rem;
  border-radius: .5rem;
  font-weight: 700;
  font-size: .9rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all .15s;
  text-align: center;
  background: #f1f5f9;
  color: #64748b;
}
.mode-btn.active {
  background: #6366f1;
  color: #fff;
  border-color: #4f46e5;
  box-shadow: 0 2px 8px rgba(99,102,241,.35);
}
.dark .mode-btn { background: #1e293b; color: #94a3b8; }
.dark .mode-btn.active { background: #6366f1; color: #fff; }


/* ── Pagination ───────────────────────────────────────────────────────────── */
.page-btn {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: .4rem;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid #e2e8f0;
  background: #fff;
  color: #475569;
  transition: all .15s;
}
.page-btn:hover { background: #ede9fe; border-color: #a5b4fc; color: #4f46e5; }
.page-btn.active { background: #6366f1; border-color: #4f46e5; color: #fff; }
.dark .page-btn { background: #1e293b; border-color: #334155; color: #94a3b8; }
.dark .page-btn.active { background: #6366f1; color: #fff; }

/* ── Tooltip ──────────────────────────────────────────────────────────────── */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%; transform: translateX(-50%);
  white-space: nowrap;
  background: #1e293b;
  color: #f8fafc;
  font-size: .72rem;
  padding: .25rem .55rem;
  border-radius: .4rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
}
[data-tip]:hover::after { opacity: 1; }

/* ── Responsive tweaks ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #combo-grid {
    grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
    max-height: 40vh;
  }
  .stat-card .value { font-size: 1.2rem; }
}

/* ── Animations ───────────────────────────────────────────────────────────── */
.fade-in { animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity:0; transform: translateY(8px); } to { opacity:1; transform: none; } }

.pulse-once { animation: pulseOnce .4s ease; }
@keyframes pulseOnce {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}
