/* ========================================================================
   FacturX Invoice — Design Tokens & Component Styles
   Used across all pages. Tailwind CDN handles utilities.
   ======================================================================== */

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

/* ── Design Tokens ─────────────────────────────────────────────────────── */
:root {
  --background: 240 33% 99%;
  --foreground: 235 28% 14%;
  --card: 240 20% 99%;
  --card-foreground: 235 28% 14%;
  --popover: 240 20% 99%;
  --popover-foreground: 235 28% 14%;
  --primary: 238 85% 67%;
  --primary-foreground: 0 0% 100%;
  --secondary: 236 40% 96%;
  --secondary-foreground: 235 28% 14%;
  --muted: 236 40% 96%;
  --muted-foreground: 233 10% 45%;
  --accent: 234 85% 75%;
  --accent-foreground: 235 28% 14%;
  --success: 160 84% 39%;
  --success-foreground: 0 0% 100%;
  --warning: 38 92% 50%;
  --warning-foreground: 0 0% 100%;
  --destructive: 0 84% 60%;
  --destructive-foreground: 0 0% 100%;
  --border: 233 33% 95%;
  --input: 233 33% 95%;
  --ring: 238 85% 67%;
  --radius: 0.625rem;
}

/* ── Theme Overrides (per-page) ────────────────────────────────────────── */
.theme-convert {
    --card: 0, 0%, 100%;
}
.theme-create {
  --background: 210 40% 96%;
  --foreground: 222 84% 11%;
  --card: 0 0% 100%;
  --card-foreground: 222 84% 11%;
  --primary: 200 98% 39%;
  --primary-foreground: 0 0% 100%;
  --secondary: 210 40% 93%;
  --secondary-foreground: 222 84% 11%;
  --muted: 210 40% 93%;
  --muted-foreground: 215 16% 47%;
  --accent: 200 98% 50%;
  --accent-foreground: 222 84% 11%;
  --border: 213 27% 77%;
  --input: 220 13% 86%;
  --ring: 200 98% 39%;
  --input-bg: 0 0% 98%;
}
.theme-create input,
.theme-create textarea,
.theme-create [role="combobox"] {
  background-color: hsl(var(--input-bg)) !important;
}

.theme-extract {
  --background: 270 100% 99%;
/*  --foreground: 263 82% 35%;*/
  --card: 270 100% 100%;
  --card-foreground: 263 82% 35%;
  --primary: 263 84% 58%;
  --primary-foreground: 0 0% 100%;
  --secondary: 270 40% 96%;
  --secondary-foreground: 263 82% 35%;
  --muted: 270 30% 95%;
  --muted-foreground: 260 15% 50%;
  --accent: 160 72% 67%;
  --accent-foreground: 263 82% 35%;
  --border: 270 60% 92%;
  --input: 270 60% 92%;
  --ring: 263 84% 58%;
}

.theme-validate {
  --background: 120 14% 97%;
/*  --foreground: 163 90% 16%;*/
  --card: 120 14% 99%;
  --card-foreground: 163 90% 16%;
  --primary: 160 84% 39%;
  --primary-foreground: 0 0% 100%;
  --secondary: 120 20% 95%;
  --secondary-foreground: 163 90% 16%;
  --muted: 120 20% 95%;
  --muted-foreground: 150 10% 42%;
  --accent: 160 72% 52%;
  --accent-foreground: 163 90% 16%;
  --border: 100 22% 89%;
  --input: 100 22% 89%;
  --ring: 160 84% 39%;
}

/* ── Base ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; border-color: hsl(var(--border)); }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }

/* ── Component: Dropzone ───────────────────────────────────────────────── */
.dropzone-idle {
  border: 2px dashed hsl(var(--primary) / 0.3);
  background: hsl(var(--primary) / 0.03);
  border-radius: 1rem;
  transition: all 0.3s ease;
}
.dropzone-active {
  border: 2px dashed hsl(var(--primary));
  background: hsl(var(--primary) / 0.08);
  border-radius: 1rem;
  transform: scale(1.01);
  box-shadow: 0 10px 15px -3px hsl(var(--primary) / 0.1);
  transition: all 0.2s ease;
}

/* ── Component: Badge ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 0.5rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
}
.badge-outline {
  background: transparent;
  border: 1px solid hsl(var(--primary) / 0.3);
  color: hsl(var(--primary));
  text-transform: none;
  letter-spacing: normal;
  font-weight: 600;
}

/* ── Component: Card ───────────────────────────────────────────────────── */
.card {
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
}

/* ── Component: Button ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.625rem 1.25rem;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.25rem;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  box-shadow: 0 10px 15px -3px hsl(var(--primary) / 0.2);
}
.btn-primary:hover { background: hsl(var(--primary) / 0.9); }
.btn-primary:active { transform: scale(0.98); }
.btn-outline {
  background: transparent;
  color: hsl(var(--foreground));
  border: 1px solid hsl(var(--border));
}
.btn-outline:hover { background: hsl(var(--muted)); }
.btn-ghost {
  background: transparent;
  color: hsl(var(--muted-foreground));
}
.btn-ghost:hover { background: hsl(var(--muted)); color: hsl(var(--foreground)); }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }

/* ── Component: Input ──────────────────────────────────────────────────── */
.input {
  display: flex;
  height: 2.5rem;
  width: 100%;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--input));
  background: hsl(var(--input-bg));
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: hsl(var(--foreground));
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus {
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}
.input::placeholder { color: hsl(var(--muted-foreground)); }
.input-error { border-color: hsl(var(--destructive)); }

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

/* ── Component: Label ──────────────────────────────────────────────────── */
.label {
  font-size: 0.75rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  display: block;
  margin-bottom: 0.375rem;
}

/* ── Component: Separator ──────────────────────────────────────────────── */
.separator {
  height: 1px;
  background: hsl(var(--border));
  border: none;
  margin: 0.75rem 0;
}

/* ── Component: Accordion ──────────────────────────────────────────────── */
.accordion-item { border-bottom: 1px solid hsl(var(--border)); }
.accordion-trigger {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}
.accordion-trigger:hover { text-decoration: underline; }
.accordion-trigger svg { transition: transform 0.2s; flex-shrink: 0; }
.accordion-trigger[aria-expanded="true"] svg { transform: rotate(180deg); }
.accordion-content {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease, padding 0.3s ease;
  font-size: 0.875rem;
  line-height: 1.625;
  color: hsl(var(--muted-foreground));
}
.accordion-content.open {
  max-height: 500px;
  padding-bottom: 1rem;
}

/* ── Component: Modal / Dialog ─────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-content {
  background: hsl(var(--card));
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 100%;
  max-width: 28rem;
  margin: 1rem;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
  transform: translateY(10px) scale(0.98);
  transition: transform 0.2s ease;
}
.modal-overlay.open .modal-content { transform: translateY(0) scale(1); }
.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  cursor: pointer;
  color: hsl(var(--muted-foreground));
  padding: 0.25rem;
  border-radius: 0.25rem;
}
.modal-close:hover { color: hsl(var(--foreground)); background: hsl(var(--muted)); }

/* ── Component: Status Badge ───────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  border-radius: 9999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
}
.status-ready { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); }
.status-processing { background: hsl(var(--primary) / 0.1); color: hsl(var(--primary)); }
.status-done { background: hsl(var(--success) / 0.1); color: hsl(var(--success)); }
.status-error { background: hsl(var(--warning) / 0.1); color: hsl(var(--warning)); }

/* ── Component: Step Wizard ────────────────────────────────────────────── */
.step-circle {
  display: flex;
  width: 2.25rem;
  height: 2.25rem;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s;
}
.step-circle.active {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  box-shadow: 0 0 0 4px hsl(var(--primary) / 0.2);
}
.step-circle.done {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}
.step-circle.pending {
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
}
.step-connector {
  height: 2px;
  width: 3rem;
  transition: background 0.2s;
}

/* ── Utility: Spinner ──────────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.animate-spin { animation: spin 1s linear infinite; }

/* ── Utility: Premium Badge ────────────────────────────────────────────── */
.premium-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 9999px;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  padding: 0.125rem 0.625rem;
  font-size: 0.6875rem;
  font-weight: 600;
}

/* ── Component: File row ───────────────────────────────────────────────── */
.file-icon-box {
  display: flex;
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  background: hsl(var(--primary) / 0.1);
}

/* ── Component: Radio card ─────────────────────────────────────────────── */
.radio-card {
  display: flex;
  cursor: pointer;
  align-items: center;
  gap: 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid hsl(var(--border));
  padding: 0.875rem;
  transition: border-color 0.15s, background 0.15s;
}
.radio-card input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  min-width: 1.25rem;
  border: 2px solid hsl(var(--border));
  border-radius: 9999px;
  background: hsl(var(--card));
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.radio-card input[type="radio"]:checked {
  border-color: hsl(var(--primary));
  background: hsl(var(--primary));
  box-shadow: inset 0 0 0 2px hsl(var(--card));
}
.radio-card.selected {
  border-color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.05);
}
.radio-card:not(.selected):hover {
  border-color: hsl(var(--primary) / 0.3);
}

/* ── Right-align date picker icon ──────────────────────────────────────── */
input[type="date"] { position: relative; }
input[type="date"]::-webkit-calendar-picker-indicator {
  position: absolute;
  right: 0.75rem;
  cursor: pointer;
}

/* ── Hide utility (no !important — let Tailwind responsive classes win) */
.is-hidden { display: none; }


/*Additional style wiring ──────────────────────────────────────── */

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.bg-card {
    background: hsl(var(--card));
}