@import "./scrollbar.css";

@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  :root {
    --background: 0 0% 100%; /* white */
    --foreground: 222.2 47.4% 11.2%; /* slate-900 */

    --muted: 210 40% 96.1%; /* slate-100 */
    --muted-foreground: 215.4 16.3% 46.9%; /* slate-500 */

    --popover: 0 0% 100%; /* white */
    --popover-foreground: 222.2 47.4% 11.2%; /* slate-900 */

    --card: 0 0% 100%; /* white */
    --card-foreground: 222.2 47.4% 11.2%; /* slate-900 */

    --border: 214.3 31.8% 91.4%; /* slate-200 */
    --input: 214.3 31.8% 91.4%; /* slate-200 */

    --primary: 222.2 47.4% 11.2%; /* slate-900 */
    --primary-foreground: 210 40% 98%; /* slate-50 */

    --secondary: 210 40% 96.1%; /* slate-100 */
    --secondary-foreground: 222.2 47.4% 11.2%; /* slate-900 */

    --accent: 210 40% 96.1%; /* slate-100 */
    --accent-foreground: 222.2 47.4% 11.2%; /* slate-900 */

    --destructive: 0 100% 50%;
    --destructive-foreground: 210 40% 98%;

    --ring: 215 20.2% 65.1%; /* slate-400 */

    --radius: 0.5rem;

    --sidebar-background: 0 0% 98%;
    --sidebar-foreground: 240 5.3% 26.1%;
    --sidebar-primary: 240 5.9% 10%;
    --sidebar-primary-foreground: 0 0% 98%;
    --sidebar-accent: 240 4.8% 95.9%;
    --sidebar-accent-foreground: 240 5.9% 10%;
    --sidebar-border: 220 13% 91%;
    --sidebar-ring: 217.2 91.2% 59.8%;

    --chart-1: oklch(0.75 0.15 250);
    --chart-2: oklch(0.65 0.18 250);
    --chart-3: oklch(0.55 0.2 250);
    --chart-4: oklch(0.45 0.22 250);
    --chart-5: oklch(0.35 0.18 250);
  }

  .dark {
    --background: 240 10% 3.9%;
    --foreground: 0 0% 98%;
    --card: 240 10% 3.9%;
    --card-foreground: 0 0% 98%;
    --popover: 240 10% 3.9%;
    --popover-foreground: 0 0% 98%;
    --primary: 0 0% 98%;
    --primary-foreground: 240 5.9% 10%;
    --secondary: 240 3.7% 15.9%;
    --secondary-foreground: 0 0% 98%;
    --muted: 240 3.7% 15.9%;
    --muted-foreground: 240 5% 64.9%;
    --accent: 240 3.7% 15.9%;
    --accent-foreground: 0 0% 98%;
    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 0 85.7% 97.3%;
    --border: 240 3.7% 15.9%;
    --input: 240 3.7% 15.9%;
    --ring: 240 4.9% 83.9%;
    --chart-1: oklch(0.7 0.2 250);
    --chart-2: oklch(0.6 0.22 250);
    --chart-3: oklch(0.5 0.24 250);
    --chart-4: oklch(0.4 0.22 250);
    --chart-5: oklch(0.3 0.18 250);
    --sidebar-background: 240 5.9% 10%;
    --sidebar-foreground: 240 4.8% 95.9%;
    --sidebar-primary: 224.3 76.3% 48%;
    --sidebar-primary-foreground: 0 0% 100%;
    --sidebar-accent: 240 3.7% 15.9%;
    --sidebar-accent-foreground: 240 4.8% 95.9%;
    --sidebar-border: 240 3.7% 15.9%;
    --sidebar-ring: 240 4.9% 83.9%;
  }
}

.content-container {
  @apply px-2 sm:px-6;
}

@layer base {
  * {
    @apply border-border;
  }
  body {
    @apply bg-background text-foreground;
  }
}

* {
  font-variant-ligatures: none;
}

/* Bulk unsubscribe table → card layout on mobile */
@media (max-width: 640px) {
  /* Constrain the wrapper div that the Table component adds */
  :has(> .bulk-unsub-table) {
    overflow: hidden !important;
  }

  .bulk-unsub-table,
  .bulk-unsub-table thead,
  .bulk-unsub-table tbody,
  .bulk-unsub-table tbody tr {
    max-width: 100%;
  }

  .bulk-unsub-table,
  .bulk-unsub-table thead,
  .bulk-unsub-table tbody {
    display: block;
  }

  .bulk-unsub-table thead {
    display: none;
  }

  .bulk-unsub-table tbody tr {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 12px;
    margin: 8px 0;
    border: 1px solid hsl(var(--border)) !important;
    border-radius: 8px;
  }

  /* Checkbox: top-right of card */
  .bulk-unsub-table td[data-cell="checkbox"] {
    position: absolute;
    top: 12px;
    right: 12px;
    width: auto;
    padding: 0;
    border: none;
  }

  /* From: full width row */
  .bulk-unsub-table td[data-cell="from"] {
    width: 100%;
    min-width: 0;
    max-width: calc(100vw - 80px);
    padding: 0 40px 8px 0;
    overflow: hidden;
    border: none;
  }

  /* Stat cells: inline, side by side */
  .bulk-unsub-table td[data-label] {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    padding: 0;
    margin-right: 12px;
    font-size: 0.8125rem;
    border: none;
  }

  .bulk-unsub-table td[data-label]::before {
    color: hsl(var(--muted-foreground));
    content: attr(data-label) ":";
  }

  /* Actions: push to the right on the stats row */
  .bulk-unsub-table td[data-cell="actions"] {
    width: auto;
    min-width: 0;
    padding: 0;
    margin-left: auto;
    border: none;
  }

  .bulk-unsub-table td[data-cell="actions"] > div {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}
