/* ============================================
   TusImpuestos — Visual Tax Calculator
   Color palette: calm blues, slates, muted earth
   Mobile-first responsive design
   ============================================ */

:root {
  /* Primary palette */
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  /* Accent */
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-400: #60a5fa;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;

  --teal-400: #2dd4bf;
  --teal-500: #14b8a6;

  /* Tax segment colors — calm, distinguished */
  --color-employer-ss: #334155;
  --color-irpf: #475569;
  --color-employee-ss: #64748b;
  --color-iva: #7c8ca0;
  --color-electricity: #94a3b8;
  --color-fuel: #a8b5c4;
  --color-ibi: #b8c4d0;
  --color-yours: #3b82f6;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Spacing */
  --container-max: 1120px;
  --radius: 12px;
  --radius-sm: 8px;
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  color: var(--slate-800);
  background: var(--slate-50);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 20px;
}

/* ============================================
   HEADER
   ============================================ */
.header {
  padding: 16px 0;
  border-bottom: 1px solid var(--slate-200);
  background: white;
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  font-size: 24px;
}

.logo-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--slate-900);
  letter-spacing: -0.02em;
}

.header-tagline {
  font-size: 13px;
  color: var(--slate-400);
  display: none;
}

@media (min-width: 640px) {
  .header-tagline {
    display: block;
  }
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
  padding: 32px 0 24px;
  background: linear-gradient(180deg, white 0%, var(--slate-50) 100%);
}

.hero-headlines {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.headline {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.headline-label {
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--slate-400);
}

.headline-amount {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.headline-you .headline-amount {
  color: var(--blue-600);
}

.headline-state .headline-amount {
  color: var(--slate-700);
}

.headline-sub {
  font-size: 14px;
  color: var(--slate-500);
  margin-top: 2px;
}

.headline-divider {
  color: var(--slate-300);
  transform: rotate(90deg);
}

@media (min-width: 640px) {
  .hero-headlines {
    flex-direction: row;
    justify-content: center;
    gap: 32px;
  }

  .headline-divider {
    transform: none;
  }

  .headline-amount {
    font-size: 44px;
  }
}

/* Days badge */
.hero-days {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.days-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--slate-800);
  color: white;
  padding: 12px 24px;
  border-radius: 60px;
}

.days-number {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--blue-400);
}

.days-label {
  font-size: 13px;
  line-height: 1.3;
  opacity: 0.85;
}

.days-bar-container {
  width: 100%;
  max-width: 500px;
}

.days-bar {
  height: 8px;
  background: var(--slate-200);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.days-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--slate-600) 0%, var(--slate-400) 100%);
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.days-bar-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 11px;
  color: var(--slate-400);
}

.days-bar-marker {
  color: var(--slate-700);
  font-weight: 600;
}

/* ============================================
   CALCULATOR SECTION
   ============================================ */
.calculator {
  padding: 40px 0;
}

.calc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
}

@media (min-width: 768px) {
  .calc-grid {
    grid-template-columns: 380px 1fr;
    gap: 48px;
  }
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--slate-900);
  margin-bottom: 4px;
}

.section-desc {
  font-size: 14px;
  color: var(--slate-500);
  margin-bottom: 24px;
}

/* ============================================
   INPUT FIELDS
   ============================================ */
.calc-inputs {
  position: relative;
}

@media (min-width: 768px) {
  .calc-inputs {
    position: sticky;
    top: 20px;
    align-self: start;
  }
}

.input-group {
  margin-bottom: 20px;
}

.input-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--slate-700);
  margin-bottom: 6px;
}

.input-icon {
  font-size: 16px;
}

.input-wrapper {
  display: flex;
  align-items: center;
  background: white;
  border: 2px solid var(--slate-200);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrapper:focus-within {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.input-prefix {
  font-size: 16px;
  font-weight: 600;
  color: var(--slate-400);
  margin-right: 4px;
}

.input-field {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  font-weight: 600;
  color: var(--slate-800);
  padding: 12px 0;
  background: transparent;
  font-family: var(--font-sans);
  min-width: 0;
}

.input-field::placeholder {
  color: var(--slate-300);
}

.input-suffix {
  font-size: 13px;
  color: var(--slate-400);
  margin-left: 8px;
  white-space: nowrap;
}

.input-hint {
  display: block;
  font-size: 12px;
  color: var(--slate-400);
  margin-top: 4px;
  line-height: 1.4;
}

/* ============================================
   BAR CHART VISUALIZATION
   ============================================ */
.calc-visual {
  min-width: 0;
}

.bar-chart {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 400px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
}

.bar-segment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  min-height: 32px;
  transition: flex-basis 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: default;
  position: relative;
  overflow: hidden;
}

.bar-segment:hover {
  filter: brightness(1.08);
}

.bar-segment-label {
  font-size: 12px;
  font-weight: 600;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.bar-segment-value {
  font-size: 12px;
  font-weight: 700;
  color: white;
  white-space: nowrap;
  margin-left: 8px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.bar-segment.yours .bar-segment-label,
.bar-segment.yours .bar-segment-value {
  color: white;
}

/* Segment that's too small to show text */
.bar-segment.compact .bar-segment-label {
  display: none;
}

.bar-segment.compact .bar-segment-value {
  font-size: 10px;
}

/* ============================================
   BAR LEGEND
   ============================================ */
.bar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 16px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--slate-600);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-value {
  font-weight: 600;
  color: var(--slate-800);
  margin-left: 2px;
}

/* ============================================
   SUMMARY CARDS
   ============================================ */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 24px;
}

.summary-card {
  background: white;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  padding: 16px 12px;
  text-align: center;
}

.summary-value {
  display: block;
  font-size: 20px;
  font-weight: 800;
  color: var(--slate-800);
  letter-spacing: -0.02em;
}

.summary-label {
  display: block;
  font-size: 11px;
  color: var(--slate-500);
  margin-top: 4px;
  line-height: 1.3;
}

@media (max-width: 480px) {
  .summary-cards {
    grid-template-columns: 1fr;
  }

  .summary-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
  }

  .summary-value {
    order: 2;
  }

  .summary-label {
    order: 1;
    margin-top: 0;
    font-size: 13px;
  }
}

/* ============================================
   SHARE SECTION
   ============================================ */
.share-section {
  padding: 32px 0;
}

.share-box {
  background: var(--slate-800);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  color: white;
}

.share-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.share-desc {
  font-size: 14px;
  color: var(--slate-400);
  margin-bottom: 20px;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: white;
  color: var(--slate-900);
  border: none;
  border-radius: 60px;
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.share-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.share-btn:active {
  transform: translateY(0);
}

.share-icon {
  width: 18px;
  height: 18px;
}

/* ============================================
   METHODOLOGY
   ============================================ */
.methodology {
  padding: 40px 0 24px;
  border-top: 1px solid var(--slate-200);
}

.method-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--slate-800);
  margin-bottom: 20px;
}

.method-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 640px) {
  .method-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.method-item h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--slate-700);
  margin-bottom: 4px;
}

.method-item p {
  font-size: 13px;
  color: var(--slate-500);
  line-height: 1.5;
}

.method-note {
  margin-top: 20px;
  padding: 16px;
  background: var(--blue-50);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--slate-600);
  line-height: 1.5;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
  padding: 24px 0;
  border-top: 1px solid var(--slate-200);
  text-align: center;
  font-size: 13px;
  color: var(--slate-500);
}

.footer-small {
  font-size: 11px;
  color: var(--slate-400);
  margin-top: 4px;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: scaleY(0);
  }
  to {
    opacity: 1;
    transform: scaleY(1);
  }
}

.bar-segment {
  animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  transform-origin: top;
}

.bar-segment:nth-child(1) { animation-delay: 0.05s; }
.bar-segment:nth-child(2) { animation-delay: 0.1s; }
.bar-segment:nth-child(3) { animation-delay: 0.15s; }
.bar-segment:nth-child(4) { animation-delay: 0.2s; }
.bar-segment:nth-child(5) { animation-delay: 0.25s; }
.bar-segment:nth-child(6) { animation-delay: 0.3s; }
.bar-segment:nth-child(7) { animation-delay: 0.35s; }
.bar-segment:nth-child(8) { animation-delay: 0.4s; }

/* ============================================
   UTILITIES
   ============================================ */
@media (max-width: 480px) {
  .hero {
    padding: 24px 0 20px;
  }

  .headline-amount {
    font-size: 28px;
  }

  .days-number {
    font-size: 26px;
  }

  .days-badge {
    padding: 10px 18px;
  }

  .section-title {
    font-size: 16px;
  }

  .bar-chart {
    min-height: 350px;
  }
}
