/*
 * Redspot agency — standard dashboard theme (Filament 5).
 * Shared by every client dashboard: indigo primary, slate neutrals, Inter.
 * The client's own logo is the only per-project branding (AdminPanelProvider).
 * Plain CSS on top of Filament's classes and colour variables: no build step needed.
 */

:root {
  --rs-radius: 16px;
  --rs-bg: #f5f6fa;
  --rs-surface: #ffffff;
  --rs-line: rgba(15, 23, 42, 0.07);
  --rs-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 30px -16px rgba(15, 23, 42, 0.12);
}
.dark {
  --rs-bg: #0b0d14;
  --rs-surface: #12141d;
  --rs-line: rgba(255, 255, 255, 0.07);
  --rs-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px -16px rgba(0, 0, 0, 0.6);
}

/* ---- Layout ------------------------------------------------------------ */
.fi-body {
  background: var(--rs-bg);
}

.fi-sidebar,
.fi-sidebar-header {
  background: var(--rs-surface) !important;
}
.fi-sidebar {
  border-inline-end: 1px solid var(--rs-line);
}
.fi-sidebar-header {
  box-shadow: none !important;
  border-bottom: 1px solid var(--rs-line);
}

.fi-topbar {
  background: color-mix(in srgb, var(--rs-surface) 80%, transparent) !important;
  backdrop-filter: saturate(1.4) blur(14px);
  box-shadow: none !important;
  border-bottom: 1px solid var(--rs-line);
}

/* Sidebar items: rounded, active item tinted with the primary colour */
.fi-sidebar-item-btn {
  border-radius: 10px !important;
  transition: background-color 0.15s ease;
}
.fi-sidebar-item.fi-active > .fi-sidebar-item-btn {
  background: color-mix(in oklab, var(--primary-500) 12%, transparent) !important;
}
.fi-sidebar-item.fi-active > .fi-sidebar-item-btn .fi-sidebar-item-label,
.fi-sidebar-item.fi-active > .fi-sidebar-item-btn .fi-sidebar-item-icon {
  color: var(--primary-600) !important;
}
.dark .fi-sidebar-item.fi-active > .fi-sidebar-item-btn .fi-sidebar-item-label,
.dark .fi-sidebar-item.fi-active > .fi-sidebar-item-btn .fi-sidebar-item-icon {
  color: var(--primary-300) !important;
}

/* ---- Cards ------------------------------------------------------------- */
.fi-section:not(.fi-section-not-contained),
.fi-wi-stats-overview-stat,
.fi-ta-ctn {
  border-radius: var(--rs-radius) !important;
  box-shadow: var(--rs-shadow) !important;
  --tw-ring-color: var(--rs-line) !important;
  background-color: var(--rs-surface) !important;
}

/* Stat cards: the sparkline stays inside the rounded card */
.fi-wi-stats-overview-stat {
  overflow: hidden;
}
.fi-wi-stats-overview-stat-value {
  letter-spacing: -0.03em;
}

.fi-header-heading {
  letter-spacing: -0.025em;
}

/* Buttons and inputs a touch rounder */
.fi-btn,
.fi-input-wrp,
.fi-select-input {
  border-radius: 10px !important;
}

/* ---- Theme switcher in the top bar -------------------------------------- */
.rs-topbar-theme .fi-theme-switcher {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--rs-line) 80%, transparent);
}
.rs-topbar-theme .fi-theme-switcher-btn {
  border-radius: 999px !important;
  padding: 6px !important;
}

/* ---- Login page --------------------------------------------------------- */
.fi-simple-layout {
  background:
    radial-gradient(60rem 30rem at 10% -10%, color-mix(in oklab, var(--primary-500) 18%, transparent), transparent 60%),
    radial-gradient(50rem 30rem at 110% 110%, rgba(14, 165, 233, 0.14), transparent 60%),
    var(--rs-bg);
}
.fi-simple-main {
  border-radius: 22px !important;
  box-shadow: var(--rs-shadow) !important;
}

/* ---- Ranked lists (top pages, sources) ----------------------------------- */
.rs-empty {
  font-size: 0.875rem;
  color: rgb(100 116 139);
}
.rs-ranked {
  display: grid;
  gap: 6px;
}
.rs-ranked li {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  overflow: hidden;
}
.rs-ranked-bar {
  position: absolute;
  inset: 0 auto 0 0;
  background: color-mix(in oklab, var(--primary-500) 11%, transparent);
  border-radius: 10px;
}
.rs-ranked-text,
.rs-ranked-value {
  position: relative;
}
.rs-ranked-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.rs-ranked-label {
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rs-ranked-sub {
  font-size: 0.75rem;
  color: rgb(100 116 139);
}
.rs-ranked-value {
  font-size: 0.875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.rs-ranked-value small {
  font-weight: 500;
  color: rgb(100 116 139);
}

.rs-devices {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--rs-line);
}
.rs-devices-title {
  margin-bottom: 10px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgb(100 116 139);
}
.rs-devices-bar {
  display: flex;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--rs-line);
}
.rs-devices-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 10px;
  font-size: 0.8rem;
}
.rs-devices-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}
.rs-devices-legend i {
  width: 8px;
  height: 8px;
  border-radius: 999px;
}
.rs-device-0 {
  background: var(--primary-500);
}
.rs-device-1 {
  background: #0ea5e9;
}
.rs-device-2 {
  background: #f59e0b;
}

/* ---- Media library grid ---------------------------------------------------- */
/* Cards: image edge to edge, checkbox and menu overlaid on the image corners. */
.fi-ta-record:has(.rs-media-thumb) {
  position: relative;
  padding: 0 !important;
  overflow: hidden;
}
.fi-ta-record:has(.rs-media-thumb) > .fi-ta-record-checkbox {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  margin: 0 !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.25);
}
.fi-ta-record:has(.rs-media-thumb) .fi-ta-record-content-ctn {
  width: 100%;
  flex-direction: column;
}
.fi-ta-record:has(.rs-media-thumb) .fi-ta-record-content-ctn > div:first-child,
.fi-ta-record:has(.rs-media-thumb) .fi-ta-record-content,
.fi-ta-stack:has(.rs-media-thumb-wrap),
.fi-ta-col:has(.rs-media-thumb-wrap),
.rs-media-thumb-wrap {
  width: 100%;
}
.fi-ta-record:has(.rs-media-thumb) .fi-ta-record-content {
  padding: 0 0 14px !important;
}
.fi-ta-record:has(.rs-media-thumb) .fi-ta-stack > .fi-grid-col:not(:first-child) {
  padding-inline: 14px;
}
.fi-ta-record:has(.rs-media-thumb) .fi-ta-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  padding: 2px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--rs-surface) 90%, transparent);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
}
.rs-media-thumb-wrap {
  display: block !important;
}
.rs-media-thumb {
  display: block;
  width: 100% !important;
  height: 180px !important;
  max-width: none !important;
  object-fit: cover;
  border-radius: 0 !important;
  background: color-mix(in srgb, var(--rs-line) 60%, transparent);
}

/* ---- Live preview (page editor) -------------------------------------------- */
:root {
  --rs-preview-w: min(48vw, 820px);
}
[x-cloak] {
  display: none !important;
}
html.rs-preview-open .fi-main-ctn {
  margin-inline-end: var(--rs-preview-w);
}
.rs-preview-toggle {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 25;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--primary-600);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: 0 12px 30px -10px color-mix(in oklab, var(--primary-600) 70%, transparent);
  transition: transform 0.15s ease, background-color 0.15s ease;
}
.rs-preview-toggle:hover {
  background: var(--primary-500);
  transform: translateY(-1px);
}
.rs-preview-toggle-icon,
.rs-preview-icon {
  width: 18px;
  height: 18px;
}
.rs-preview-panel {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 25;
  display: flex;
  flex-direction: column;
  width: var(--rs-preview-w);
  background: var(--rs-bg);
  border-inline-start: 1px solid var(--rs-line);
  box-shadow: -20px 0 50px -30px rgba(15, 23, 42, 0.35);
}
.rs-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--rs-surface);
  border-bottom: 1px solid var(--rs-line);
}
.rs-preview-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 600;
}
.rs-preview-hint {
  font-weight: 400;
  color: rgb(100 116 139);
}
.rs-preview-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #10b981;
  box-shadow: 0 0 0 4px color-mix(in srgb, #10b981 20%, transparent);
}
.rs-preview-actions,
.rs-preview-devices {
  display: flex;
  align-items: center;
  gap: 4px;
}
.rs-preview-devices {
  padding: 3px;
  margin-inline-end: 6px;
  border-radius: 10px;
  background: var(--rs-line);
}
.rs-preview-actions button,
.rs-preview-actions a {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: rgb(100 116 139);
}
.rs-preview-actions button:hover,
.rs-preview-actions a:hover,
.rs-preview-devices .is-active {
  background: var(--rs-surface);
  color: var(--primary-600);
}
.rs-preview-viewport {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: #fff;
}
.rs-preview-viewport.is-mobile {
  display: flex;
  justify-content: center;
  padding: 16px 0;
  background: var(--rs-bg);
}
.rs-preview-viewport.is-mobile iframe {
  border-radius: 24px;
  box-shadow: 0 0 0 8px #0f172a, 0 20px 50px -20px rgba(15, 23, 42, 0.5);
  background: #fff;
}
.rs-preview-viewport iframe {
  border: 0;
  display: block;
}
.rs-preview-note {
  padding: 8px 14px;
  font-size: 0.75rem;
  color: rgb(100 116 139);
  background: var(--rs-surface);
  border-top: 1px solid var(--rs-line);
}
@media (max-width: 1023px) {
  :root {
    --rs-preview-w: 100vw;
  }
  html.rs-preview-open .fi-main-ctn {
    margin-inline-end: 0;
  }
}

/* ---- Agency credit ----------------------------------------------------------- */
.rs-credit {
  font-size: 0.75rem;
  color: rgb(100 116 139);
}
.rs-credit a {
  font-weight: 700;
  color: inherit;
  transition: color 0.15s ease;
}
.rs-credit a:hover {
  color: var(--primary-600);
}
.rs-credit-login {
  margin-top: 20px;
  text-align: center;
}
.rs-credit-footer {
  padding: 28px 0 8px;
  text-align: center;
}

/* ---- Side menu: smooth open / collapse ---------------------------------------- */
.fi-sidebar {
  transition:
    width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    translate 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
.fi-main-ctn {
  transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1), margin 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.fi-sidebar-item-label,
.fi-sidebar-group-label {
  transition: opacity 0.2s ease;
}
.fi-sidebar-item-btn {
  gap: 10px !important;
}

/* ---- Media picker (image fields → "Médiathèque") ----------------------------- */
.rs-picker-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.rs-picker-search {
  flex: 1;
  max-width: 320px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--rs-line);
  background: var(--rs-surface);
  font-size: 0.875rem;
}
.rs-picker-count {
  font-size: 0.8rem;
  color: rgb(100 116 139);
}
.rs-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 2px;
}
.rs-picker-item {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--rs-line);
  background: var(--rs-surface);
  text-align: start;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.rs-picker-item:hover {
  border-color: color-mix(in oklab, var(--primary-500) 45%, transparent);
}
.rs-picker-item.is-selected {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 2px var(--primary-500);
}
.rs-picker-item img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  background: var(--rs-line);
}
.rs-picker-name {
  padding: 7px 9px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rs-picker-check {
  position: absolute;
  top: 8px;
  right: 8px;
  display: none;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--primary-600);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.rs-picker-item.is-selected .rs-picker-check {
  display: grid;
}

/* ---- Chart legend (same dots as the device split) --------------------------- */
.rs-chart-legend {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 0.8rem;
}
.rs-chart-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.rs-chart-legend i {
  width: 8px;
  height: 8px;
  border-radius: 999px;
}
