/* Rebuild: Mix TV panel theme, written from scratch on top of Bootstrap 5.3. */

:root {
  --mx-brand: #e63972;
  --mx-brand-2: #7b2ff7;
  --mx-brand-rgb: 230, 57, 114;
  --mx-bg: #f4f5fa;
  --mx-surface: #ffffff;
  --mx-border: #e7e8f0;
  --mx-text: #1d2033;
  --mx-muted: #6b7088;
  --mx-sidebar-bg: #141627;
  --mx-sidebar-text: #a9adc6;
  --mx-sidebar-active: #ffffff;
  --mx-sidebar-w: 256px;
  --mx-topbar-h: 64px;
  --mx-radius: 14px;
  --mx-shadow: 0 1px 2px rgba(20, 22, 39, .04), 0 4px 16px rgba(20, 22, 39, .05);
  --bs-primary: var(--mx-brand);
  --bs-primary-rgb: var(--mx-brand-rgb);
  --bs-link-color: var(--mx-brand);
  --bs-link-color-rgb: var(--mx-brand-rgb);
  --bs-link-hover-color: #c4245b;
  --bs-body-font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans Arabic", Tahoma, Roboto, sans-serif;
  --bs-body-bg: var(--mx-bg);
  --bs-body-color: var(--mx-text);
  --bs-border-color: var(--mx-border);
}

[data-bs-theme="dark"] {
  --mx-bg: #0e1020;
  --mx-surface: #171a2e;
  --mx-border: #262a44;
  --mx-text: #e6e8f2;
  --mx-muted: #9095b0;
  --mx-sidebar-bg: #0a0c19;
  --mx-shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --bs-body-bg: var(--mx-bg);
  --bs-body-color: var(--mx-text);
  --bs-border-color: var(--mx-border);
  --bs-secondary-color: var(--mx-muted);
}

body { background: var(--mx-bg); color: var(--mx-text); font-size: .925rem; }
a { text-decoration: none; }

.btn-primary {
  --bs-btn-bg: var(--mx-brand); --bs-btn-border-color: var(--mx-brand);
  --bs-btn-hover-bg: #cf2b62; --bs-btn-hover-border-color: #cf2b62;
  --bs-btn-active-bg: #b8245a; --bs-btn-active-border-color: #b8245a;
  --bs-btn-disabled-bg: var(--mx-brand); --bs-btn-disabled-border-color: var(--mx-brand);
}
.btn-outline-primary {
  --bs-btn-color: var(--mx-brand); --bs-btn-border-color: var(--mx-brand);
  --bs-btn-hover-bg: var(--mx-brand); --bs-btn-hover-border-color: var(--mx-brand);
  --bs-btn-active-bg: var(--mx-brand); --bs-btn-active-border-color: var(--mx-brand);
}
.text-bg-primary { background-color: var(--mx-brand) !important; }
.form-control:focus, .form-select:focus, .form-check-input:focus {
  border-color: rgba(var(--mx-brand-rgb), .5);
  box-shadow: 0 0 0 .2rem rgba(var(--mx-brand-rgb), .15);
}
.form-check-input:checked { background-color: var(--mx-brand); border-color: var(--mx-brand); }
.form-control, .form-select { border-radius: 10px; }
.input-group > .form-control, .input-group > .btn { border-radius: 10px; }
.input-group > :not(:last-child) { border-start-end-radius: 0; border-end-end-radius: 0; }
.input-group > :not(:first-child) { border-start-start-radius: 0; border-end-start-radius: 0; }

/* ---------------------------------------------------------- shell */
.mx-shell { min-height: 100vh; }
.mx-sidebar {
  position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 1040;
  width: var(--mx-sidebar-w); background: var(--mx-sidebar-bg);
  display: flex; flex-direction: column; transition: transform .25s ease;
}
.mx-brand {
  display: flex; align-items: center; gap: .65rem; height: var(--mx-topbar-h);
  padding-inline: 1.25rem; color: #fff; font-weight: 700; font-size: 1.1rem; letter-spacing: .2px;
}
.mx-brand:hover { color: #fff; }
.mx-nav { flex: 1; overflow-y: auto; padding: .5rem .75rem 1rem; }
.mx-nav-section {
  color: #5d627f; font-size: .72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .6px; padding: 1.1rem .75rem .4rem;
}
.mx-nav-link {
  display: flex; align-items: center; gap: .7rem; padding: .58rem .75rem; margin-bottom: 2px;
  color: var(--mx-sidebar-text); border-radius: 10px; font-weight: 500; position: relative;
}
.mx-nav-link i { font-size: 1.15rem; opacity: .9; }
.mx-nav-link:hover { color: #fff; background: rgba(255, 255, 255, .05); }
.mx-nav-link.active {
  color: var(--mx-sidebar-active);
  background: linear-gradient(90deg, rgba(var(--mx-brand-rgb), .9), rgba(123, 47, 247, .75));
  box-shadow: 0 6px 18px rgba(var(--mx-brand-rgb), .3);
}
[dir="rtl"] .mx-nav-link.active { background: linear-gradient(270deg, rgba(var(--mx-brand-rgb), .9), rgba(123, 47, 247, .75)); }
.mx-badge-count {
  margin-inline-start: auto; background: var(--mx-brand); color: #fff; font-size: .7rem;
  min-width: 1.4rem; text-align: center; padding: .1rem .4rem; border-radius: 99px;
}
.mx-nav-link.active .mx-badge-count { background: rgba(255, 255, 255, .25); }
.mx-sidebar-foot { color: #4b5070; font-size: .75rem; padding: .75rem 1.25rem; border-top: 1px solid rgba(255, 255, 255, .05); }

.mx-main { margin-inline-start: var(--mx-sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.mx-topbar {
  position: sticky; top: 0; z-index: 1030; height: var(--mx-topbar-h);
  display: flex; align-items: center; gap: .75rem; padding-inline: 1.5rem;
  background: color-mix(in srgb, var(--mx-bg) 85%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--mx-border);
}
.mx-page-title { font-size: 1.15rem; font-weight: 700; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mx-topbar-actions { display: flex; align-items: center; gap: .35rem; }
.mx-icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 10px; color: var(--mx-muted); font-size: 1.15rem; padding: 0; }
.mx-icon-btn:hover { background: var(--mx-surface); color: var(--mx-text); }
.mx-user-btn { display: flex; align-items: center; gap: .5rem; border-radius: 99px; padding: .25rem .6rem .25rem .25rem; color: var(--mx-text); }
[dir="rtl"] .mx-user-btn { padding: .25rem .25rem .25rem .6rem; }
.mx-user-btn:hover { background: var(--mx-surface); }
.mx-avatar {
  width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center;
  background: linear-gradient(135deg, var(--mx-brand), var(--mx-brand-2)); color: #fff; font-weight: 700; font-size: .85rem;
}
.dropdown-item i { opacity: .7; }
.mx-content { padding: 1.5rem; flex: 1; width: 100%; max-width: 1400px; }
.mx-backdrop { display: none; }

@media (max-width: 991.98px) {
  .mx-sidebar { transform: translateX(-100%); }
  [dir="rtl"] .mx-sidebar { transform: translateX(100%); }
  .mx-shell.open .mx-sidebar { transform: none; }
  .mx-shell.open .mx-backdrop { display: block; position: fixed; inset: 0; z-index: 1035; background: rgba(10, 12, 25, .5); }
  .mx-main { margin-inline-start: 0; }
  .mx-topbar { padding-inline: 1rem; }
  .mx-content { padding: 1rem; }
}

/* ---------------------------------------------------------- cards & tables */
.mx-card { background: var(--mx-surface); border: 1px solid var(--mx-border); border-radius: var(--mx-radius); box-shadow: var(--mx-shadow); overflow: hidden; }
.mx-card > .card-header { background: transparent; border-bottom: 1px solid var(--mx-border); font-weight: 600; padding: .9rem 1.15rem; }
.mx-card > .card-header i { color: var(--mx-brand); }
.mx-card .list-group-item { background: transparent; border-color: var(--mx-border); padding: .75rem 1.15rem; }
.mx-card > .card-footer { border-top: 1px solid var(--mx-border); }
.mx-table { --bs-table-bg: transparent; }
.mx-table > thead th {
  font-size: .75rem; text-transform: uppercase; letter-spacing: .4px; color: var(--mx-muted);
  font-weight: 600; border-bottom-width: 1px; padding: .7rem 1.15rem; white-space: nowrap;
}
.mx-table > tbody td { padding: .75rem 1.15rem; border-color: var(--mx-border); }
.mx-table > tbody tr:last-child td { border-bottom: 0; }
.mx-table > tbody tr:hover td { background: rgba(var(--mx-brand-rgb), .03); }
.mx-url { display: inline-block; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; color: var(--mx-muted); }
code { color: var(--mx-brand); }
.mx-btn-ghost { color: var(--mx-muted); border: 0; border-radius: 8px; }
.mx-btn-ghost:hover { background: rgba(var(--mx-brand-rgb), .08); color: var(--mx-brand); }
.mx-empty { text-align: center; padding: 3rem 1rem; color: var(--mx-muted); }
.mx-empty i { font-size: 2.5rem; opacity: .4; }
.mx-empty p { margin: .5rem 0 0; }
.mx-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--mx-brand); margin-inline-end: .45rem; vertical-align: middle; }
.mx-report-body { white-space: normal; line-height: 1.8; }

/* search box */
.mx-search { position: relative; min-width: 220px; }
.mx-search i { position: absolute; inset-inline-start: .65rem; top: 50%; transform: translateY(-50%); color: var(--mx-muted); }
.mx-search input { padding-inline-start: 2rem; border-radius: 99px; }

/* ---------------------------------------------------------- stats */
.mx-stat {
  display: flex; flex-direction: column; gap: .2rem; padding: 1.1rem; height: 100%;
  background: var(--mx-surface); border: 1px solid var(--mx-border); border-radius: var(--mx-radius);
  box-shadow: var(--mx-shadow); color: var(--mx-text); transition: transform .15s ease, box-shadow .15s ease;
}
.mx-stat:hover { transform: translateY(-2px); color: var(--mx-text); box-shadow: 0 8px 24px rgba(20, 22, 39, .08); }
.mx-stat-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; margin-bottom: .5rem; }
.mx-stat-value { font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.mx-stat-label { color: var(--mx-muted); font-size: .82rem; }
.mx-tone-violet .mx-stat-icon { background: rgba(123, 47, 247, .12); color: #7b2ff7; }
.mx-tone-blue   .mx-stat-icon { background: rgba(37, 99, 235, .12); color: #2563eb; }
.mx-tone-teal   .mx-stat-icon { background: rgba(13, 148, 136, .12); color: #0d9488; }
.mx-tone-amber  .mx-stat-icon { background: rgba(217, 119, 6, .12); color: #d97706; }
.mx-tone-pink   .mx-stat-icon { background: rgba(var(--mx-brand-rgb), .12); color: var(--mx-brand); }
.mx-tone-red    .mx-stat-icon { background: rgba(220, 38, 38, .12); color: #dc2626; }

.mx-chip {
  display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .75rem; border-radius: 99px;
  border: 1px solid var(--mx-border); color: var(--mx-muted); font-size: .82rem;
}
.mx-chip.on { border-color: rgba(13, 148, 136, .35); background: rgba(13, 148, 136, .08); color: #0d9488; }

/* ---------------------------------------------------------- switch (status toggle buttons) */
.mx-switch {
  width: 40px; height: 22px; border-radius: 99px; border: 0; padding: 0; position: relative;
  background: #cfd2df; cursor: pointer; vertical-align: middle; transition: background .2s;
}
.mx-switch span {
  position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: inset-inline-start .2s;
}
.mx-switch.on { background: #10b981; }
.mx-switch.on span { inset-inline-start: 21px; }
[data-bs-theme="dark"] .mx-switch { background: #3a3f5c; }
[data-bs-theme="dark"] .mx-switch.on { background: #10b981; }

/* settings rows */
.mx-tabs { gap: .35rem; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
.mx-tabs .nav-link {
  white-space: nowrap; color: var(--mx-muted); border-radius: 10px; padding: .5rem .9rem; font-weight: 500;
  border: 1px solid transparent;
}
.mx-tabs .nav-link:hover { color: var(--mx-text); background: var(--mx-surface); }
.mx-tabs .nav-link.active { color: var(--mx-brand); background: var(--mx-surface); border-color: var(--mx-border); box-shadow: var(--mx-shadow); }
.mx-setting-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .9rem 0; border-bottom: 1px solid var(--mx-border); }
.mx-setting-row:last-child { border-bottom: 0; }
.mx-switch-input { width: 2.6em !important; height: 1.4em; cursor: pointer; }
[dir="rtl"] .form-switch .mx-switch-input { margin-right: 0; }
.mx-logo-preview { width: 56px; height: 56px; border-radius: 14px; object-fit: cover; border: 1px solid var(--mx-border); }

/* media */
.mx-media { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--mx-bg); }
.mx-media-poster { aspect-ratio: 2 / 3; }
.mx-thumb { display: block; width: 100%; max-height: 140px; object-fit: cover; border-radius: 10px; border: 1px solid var(--mx-border); }

/* ---------------------------------------------------------- auth */
.mx-auth {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background:
    radial-gradient(60rem 40rem at 10% -10%, rgba(var(--mx-brand-rgb), .18), transparent 60%),
    radial-gradient(50rem 40rem at 110% 110%, rgba(123, 47, 247, .18), transparent 60%),
    var(--mx-bg);
}
.mx-auth-card {
  width: 100%; max-width: 410px; background: var(--mx-surface); border: 1px solid var(--mx-border);
  border-radius: 20px; padding: 2.25rem 2rem; box-shadow: 0 20px 60px rgba(20, 22, 39, .1);
}

/* ---------------------------------------------------------- public pages */
.mx-public-head { background: var(--mx-sidebar-bg); color: #fff; padding: .9rem 0; }
.mx-public-card {
  background: var(--mx-surface); border: 1px solid var(--mx-border); border-radius: var(--mx-radius);
  padding: 2rem; max-width: 860px; margin: 0 auto; line-height: 1.9; box-shadow: var(--mx-shadow);
}
@media (max-width: 575.98px) { .mx-public-card { padding: 1.25rem; } }
