/*
 * BengalBound — Shared Module UI System
 * Provides premium design tokens for all module templates.
 * Loaded via base_hub.html automatically.
 */

/* ── Stat Cards ─────────────────────────────────────────────── */
.m-stat {
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 16px;
  padding: 1.2rem 1.4rem;
  position: relative; overflow: hidden;
  transition: border-color .2s, transform .2s;
}
.m-stat:hover { border-color: rgba(255,255,255,.13); transform: translateY(-2px); }
.m-stat::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--m-color, var(--hub-accent)); opacity: .7;
}
.m-stat-icon {
  position: absolute; right: 1.1rem; top: 50%; transform: translateY(-50%);
  font-size: 1.9rem; opacity: .07;
}
.m-stat-val {
  font-size: 1.65rem; font-weight: 800;
  font-family: 'Outfit', sans-serif; line-height: 1;
  color: var(--m-color, var(--hub-accent));
}
.m-stat-lbl {
  font-size: .72rem; color: rgba(226,232,240,.4);
  margin-top: .3rem; text-transform: uppercase; letter-spacing: .04em;
}

/* ── Panel ───────────────────────────────────────────────────── */
.m-panel {
  background: rgba(255,255,255,.025);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 18px; overflow: hidden;
  animation: mFadeUp .3s ease both;
}
.m-panel-head {
  padding: 1rem 1.4rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.m-panel-title {
  font-size: .8rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: rgba(226,232,240,.4);
  display: flex; align-items: center; gap: .5rem;
}
.m-panel-body { padding: 1.25rem 1.4rem; }

/* ── Search Toolbar ──────────────────────────────────────────── */
.m-toolbar {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
}
.m-search-wrap { position: relative; flex: 1; min-width: 200px; }
.m-search-wrap .bi-search {
  position: absolute; left: .85rem; top: 50%; transform: translateY(-50%);
  color: rgba(255,255,255,.25); font-size: .82rem; pointer-events: none;
}
.m-search {
  width: 100%;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px; color: #e2e8f0;
  padding: .48rem .85rem .48rem 2.2rem; font-size: .85rem;
  transition: border-color .2s, background .2s;
}
.m-search:focus { outline: none; border-color: var(--hub-accent); background: rgba(255,255,255,.06); }
.m-search::placeholder { color: rgba(255,255,255,.2); }

/* ── Table ───────────────────────────────────────────────────── */
.m-table { width: 100%; border-collapse: separate; border-spacing: 0 3px; }
.m-table thead th {
  font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  color: rgba(226,232,240,.35); padding: .55rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.m-table tbody tr {
  background: rgba(255,255,255,.02);
  transition: background .15s;
}
.m-table tbody tr:hover { background: rgba(255,255,255,.05); }
.m-table tbody td {
  padding: .82rem 1rem; font-size: .85rem; color: #e2e8f0;
  border-top: 1px solid rgba(255,255,255,.04);
  border-bottom: 1px solid rgba(255,255,255,.04);
  vertical-align: middle;
}
.m-table tbody td:first-child {
  border-radius: 10px 0 0 10px;
  border-left: 1px solid rgba(255,255,255,.04);
  padding-left: 1.25rem;
}
.m-table tbody td:last-child {
  border-radius: 0 10px 10px 0;
  border-right: 1px solid rgba(255,255,255,.04);
}
.m-table-footer {
  padding: .7rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.05);
  font-size: .75rem; color: rgba(226,232,240,.3);
}

/* ── Avatar ──────────────────────────────────────────────────── */
.m-avatar {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; text-transform: uppercase; color: #fff;
  background: linear-gradient(135deg, #6366f1, #a855f7);
}
.m-avatar-sm {
  width: 28px; height: 28px; border-radius: 7px; font-size: .72rem;
}

/* ── Status / Badge Pills ────────────────────────────────────── */
.m-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: .18rem .65rem; border-radius: 20px; font-size: .72rem; font-weight: 700;
}
.m-pill-green  { background: rgba(34,197,94,.12);   color: #22c55e; border: 1px solid rgba(34,197,94,.25); }
.m-pill-red    { background: rgba(248,113,113,.12); color: #f87171; border: 1px solid rgba(248,113,113,.25); }
.m-pill-blue   { background: rgba(56,189,248,.12);  color: #38bdf8; border: 1px solid rgba(56,189,248,.25); }
.m-pill-yellow { background: rgba(251,191,36,.12);  color: #fbbf24; border: 1px solid rgba(251,191,36,.25); }
.m-pill-purple { background: rgba(168,85,247,.12);  color: #a855f7; border: 1px solid rgba(168,85,247,.25); }
.m-pill-grey   { background: rgba(100,116,139,.12); color: #94a3b8; border: 1px solid rgba(100,116,139,.25); }

/* ── Empty State ─────────────────────────────────────────────── */
.m-empty {
  text-align: center; padding: 3.5rem 2rem;
  animation: mFadeUp .4s ease both;
}
.m-empty-icon {
  width: 68px; height: 68px; border-radius: 18px; margin: 0 auto 1.25rem;
  display: flex; align-items: center; justify-content: center; font-size: 1.7rem;
  background: rgba(168,85,247,.08); border: 1px solid rgba(168,85,247,.18);
}
.m-empty-title {
  font-weight: 700; font-family: 'Outfit', sans-serif;
  font-size: 1.05rem; color: #e2e8f0; margin-bottom: .4rem;
}
.m-empty-desc {
  color: rgba(226,232,240,.35); font-size: .85rem;
  max-width: 320px; margin: 0 auto 1.5rem; line-height: 1.6;
}

/* ── Detail Card ─────────────────────────────────────────────── */
.m-detail-card {
  background: rgba(255,255,255,.025);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 16px; overflow: hidden;
}
.m-detail-head {
  padding: 1.5rem 1.75rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
  background: linear-gradient(135deg, rgba(99,102,241,.04), rgba(168,85,247,.03));
}
.m-detail-body { padding: 1.25rem 1.75rem; }
.m-detail-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: .6rem 0; border-bottom: 1px solid rgba(255,255,255,.04);
  gap: 1rem;
}
.m-detail-row:last-child { border-bottom: none; }
.m-detail-label { font-size: .77rem; font-weight: 500; color: rgba(226,232,240,.4); min-width: 120px; }
.m-detail-value { font-size: .87rem; font-weight: 500; color: #e2e8f0; text-align: right; }

/* ── Form Fields ─────────────────────────────────────────────── */
.m-label { font-size: .8rem; font-weight: 500; color: rgba(226,232,240,.5); margin-bottom: .35rem; display: block; }
.m-input {
  width: 100%;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.09);
  border-radius: 10px; color: #e2e8f0;
  padding: .58rem .9rem; font-size: .87rem;
  transition: border-color .2s, background .2s;
}
.m-input:focus { outline: none; border-color: var(--hub-accent); background: rgba(255,255,255,.07); box-shadow: 0 0 0 3px rgba(56,189,248,.1); }
.m-input::placeholder { color: rgba(255,255,255,.2); }
select.m-input option { background: #0f172a; }

/* ── Quick Actions ───────────────────────────────────────────── */
.m-action-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem;
}
.m-action-card {
  background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.07);
  border-radius: 13px; padding: 1.1rem 1.25rem;
  text-decoration: none; display: flex; align-items: center; gap: .9rem;
  transition: border-color .2s, transform .15s, background .15s;
}
.m-action-card:hover {
  border-color: rgba(255,255,255,.14); transform: translateY(-1px);
  background: rgba(255,255,255,.05);
}
.m-action-icon {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 1rem;
  background: linear-gradient(135deg, rgba(168,85,247,.15), rgba(56,189,248,.1));
}
.m-action-label { font-size: .83rem; font-weight: 600; color: #e2e8f0; }
.m-action-desc  { font-size: .72rem; color: rgba(226,232,240,.35); margin-top: .1rem; }

/* ── Row Dropdown ─────────────────────────────────────────────── */
.m-row-menu .dropdown-menu {
  background: #0c0f1a; border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px; min-width: 155px;
}
.m-row-menu .dropdown-item { font-size: .82rem; padding: .45rem .85rem; }
.m-row-menu .dropdown-item:hover { background: rgba(255,255,255,.06); }

/* ── Hero Bar ──────────────────────────────────────────────────── */
.m-hero {
  background: linear-gradient(135deg, rgba(99,102,241,.06), rgba(168,85,247,.05), rgba(56,189,248,.04));
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 18px; padding: 1.5rem 2rem;
  margin-bottom: 2rem;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem;
  position: relative; overflow: hidden;
}
.m-hero::after {
  content: ''; position: absolute; right: -40px; top: -40px;
  width: 150px; height: 150px;
  background: radial-gradient(circle, rgba(168,85,247,.1), transparent 70%);
  border-radius: 50%; pointer-events: none;
}

/* ── Utility ───────────────────────────────────────────────────── */
.m-divider { border: none; border-top: 1px solid rgba(255,255,255,.06); margin: 1.25rem 0; }
.m-muted  { color: rgba(226,232,240,.35); }
.m-text   { color: #e2e8f0; }
.m-accent { color: var(--hub-accent); }

@keyframes mFadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* Global Fix: Dropdown Options Visibility */
select option, 
select optgroup, 
.form-select option, 
.form-select optgroup {
    color: #1a1a1a !important;
    background-color: #ffffff !important;
}

[data-bs-theme=""dark""] select option,
[data-bs-theme=""dark""] select optgroup,
[data-bs-theme=""dark""] .form-select option,
[data-bs-theme=""dark""] .form-select optgroup {
    color: #f8f9fa !important;
    background-color: #212529 !important;
}
