/* ============================================================================
   MATCHNFIT — STYLES PRINCIPAUX
   Design minimaliste, responsive, dark mode, i18n-ready
   ============================================================================ */

/* ---- Variables de couleurs ---- */
:root {
  --bg:             #FFFFFF;
  --surface:        #FAF8F6;
  --surface-alt:    #F3F4F6;
  --surface-hover:  #F9FAFB;
  --border:         #E5E7EB;
  --border-soft:    #D9D9D9;
  --separator:      #D1D5DB;
  --text:           #141414;
  --text-muted:     #666666;
  --text-faint:     #999999;
  --hover:          #E8E6E4;
  --focus-ring:     rgba(59, 130, 246, 0.1);
  --blue:           #3B82F6;
  --blue-border:    #93C5FD;
}

[data-theme="dark"] {
  --bg:             #121212;
  --surface:        #1C1C1C;
  --surface-alt:    #242424;
  --surface-hover:  #2C2C2C;
  --border:         #303030;
  --border-soft:    #3A3A3A;
  --separator:      #3A3A3A;
  --text:           #EEEEEE;
  --text-muted:     #9CA3AF;
  --text-faint:     #6B7280;
  --hover:          #2C2C2C;
  --focus-ring:     rgba(99, 179, 237, 0.15);
  --blue:           #60A5FA;
  --blue-border:    #3B82F6;
}

/* ---- Reset & Base ---- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.2s ease, color 0.2s ease;
}

/* ---- Container ---- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Header ---- */
.header {
  position: relative;
  text-align: center;
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

/* Boutons thème + langue dans le header */
.header-controls {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.header-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  transition: all 0.2s ease;
  line-height: 1;
  min-width: 36px;
  text-align: center;
}

.header-btn:hover {
  background: var(--hover);
  border-color: var(--text);
}

/* Logo */
.site-logo {
  width: 52px;
  height: 52px;
  margin-bottom: 0.75rem;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

[data-theme="dark"] .site-logo {
  filter: invert(1);
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.5px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.125rem;
  font-weight: 400;
}

/* ---- Main Content ---- */
.main-content {
  flex: 1;
}

/* ---- Card ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--text);
  border-radius: 1.5rem;
  padding: 2rem;
  margin-bottom: 1.5rem;
}

/* ---- Form Elements ---- */
.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text);
}

/* ---- Buttons ---- */
.btn-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.btn {
  padding: 0.875rem 1.5rem;
  border-radius: 1rem;
  font-weight: 600;
  border: 1px solid var(--text);
  background: var(--bg);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  min-height: 44px;
}

.btn:hover {
  background: var(--hover);
  transform: translateY(-1px);
}

.btn.active {
  background: var(--text);
  color: var(--bg);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---- Category Buttons ---- */
.cat-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.cat-btns .btn {
  flex: 0 0 auto;
  min-width: 110px;
}

/* ---- Select ---- */
select {
  width: 100%;
  padding: 0.875rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--text);
  background: var(--bg);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  transition: all 0.2s ease;
}

select:hover {
  background: var(--surface-hover);
}

select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* ---- Size Grid ---- */
.size-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.size-btn {
  padding: 0.75rem;
  border-radius: 0.75rem;
  font-weight: 700;
  border: 1px solid var(--border-soft);
  background: var(--bg);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  min-height: 44px;
}

.size-btn:hover {
  background: var(--hover);
  border-color: var(--text);
  transform: translateY(-1px);
}

.size-btn.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* ---- Comparison Grid ---- */
.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.brand-box {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: 1rem;
  padding: 1.5rem;
}

/* ---- Result Box ---- */
.result-box {
  margin-top: 1.5rem;
  padding: 1.5rem;
  border-radius: 0.75rem;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.result-box h3 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.75rem;
  color: var(--text-muted);
}

.converted-size {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.result-measurements {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0.5rem 0;
}

.result-difference {
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  margin-top: 0.75rem;
  font-weight: 600;
}

/* Status colors — light mode */
.result-difference.good    { background: #D1FAE5; color: #065F46; }
.result-difference.warning { background: #FEF3C7; color: #92400E; }
.result-difference.alert   { background: #FEE2E2; color: #991B1B; }

/* Status colors — dark mode */
[data-theme="dark"] .result-difference.good    { background: #064E3B; color: #6EE7B7; }
[data-theme="dark"] .result-difference.warning { background: #78350F; color: #FCD34D; }
[data-theme="dark"] .result-difference.alert   { background: #7F1D1D; color: #FCA5A5; }

.result-note {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--surface-hover);
  border-radius: 0.5rem;
  border-left: 3px solid var(--blue);
}

/* ---- Conversion List ---- */
.conversion-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.conversion-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  transition: all 0.2s ease;
}

.conversion-item:hover {
  border-color: var(--text);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.brand-name {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
}

.brand-note {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

.conversion-size {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

/* ---- Footer ---- */
.footer {
  text-align: center;
  margin-top: 3rem;
  padding: 2rem 1rem;
  border-top: 1px solid var(--border);
}

.footer-links {
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
}

.footer-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
  transition: color 0.2s ease;
  padding: 0.25rem 0.5rem;
}

.footer-link:hover {
  color: var(--blue);
  text-decoration: underline;
}

.footer-separator {
  color: var(--separator);
  font-weight: 300;
}

.footer-info {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin: 0.5rem 0;
}

.footer-copy {
  color: var(--text-faint);
  font-size: 0.8rem;
  margin-top: 1.5rem;
}

/* ---- Tab Navigation ---- */
.tab-nav {
  display: flex;
  gap: 0;
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-btn {
  padding: 0.75rem 1.5rem;
  border: none;
  background: none;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--text-muted);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s ease;
  font-family: inherit;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--text);
  border-bottom-color: var(--text);
}

.tab-description {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.7;
  margin-bottom: 1.75rem;
  padding: 1rem 1.25rem;
  background: var(--surface-alt);
  border-radius: 0.75rem;
  border-left: 3px solid var(--separator);
}

/* ---- Universal Conversion Result ---- */
.u-conversion-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.u-conversion-cell {
  text-align: center;
  padding: 1rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
}

.u-conversion-cell .system-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-faint);
  margin-bottom: 0.25rem;
  font-weight: 600;
}

.u-conversion-cell .system-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.u-measurements {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
  background: var(--surface-alt);
  border-radius: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ---- Messages ---- */
.hidden {
  display: none !important;
}

.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

.loading {
  opacity: 0.6;
  pointer-events: none;
}

.message {
  padding: 1rem 1.25rem;
  border-radius: 0.75rem;
  margin: 1rem 0;
  font-size: 0.95rem;
}

.message-info    { background: #DBEAFE; color: #1E40AF; border: 1px solid #93C5FD; }
.message-warning { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.message-error   { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.message-success { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }

[data-theme="dark"] .message-info    { background: #1E3A5F; color: #93C5FD; border-color: var(--blue-border); }
[data-theme="dark"] .message-warning { background: #78350F; color: #FCD34D; border-color: #D97706; }
[data-theme="dark"] .message-error   { background: #7F1D1D; color: #FCA5A5; border-color: #DC2626; }
[data-theme="dark"] .message-success { background: #064E3B; color: #6EE7B7; border-color: #059669; }

/* ============================================================================
   RESPONSIVE — Mobile first improvements
   ============================================================================ */

/* Tablette (≤ 768px) */
@media (max-width: 768px) {
  .container {
    padding: 1.25rem 0.875rem;
  }

  h1 {
    font-size: 2rem;
  }

  .subtitle {
    font-size: 1rem;
  }

  .comparison-grid {
    grid-template-columns: 1fr;
  }

  .size-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .cat-btns .btn {
    min-width: 90px;
    font-size: 0.875rem;
  }

  .footer-links {
    flex-direction: column;
    gap: 0.75rem;
  }

  .footer-separator {
    display: none;
  }

  .converted-size {
    font-size: 1.5rem;
  }

  .conversion-size {
    font-size: 1.25rem;
  }

  .u-conversion-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile (≤ 480px) */
@media (max-width: 480px) {
  .size-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* 4 boutons (système mesure) → 2×2 */
  .btn-group {
    grid-template-columns: 1fr 1fr;
  }

  .card {
    padding: 1.25rem 1rem;
    border-radius: 1rem;
  }

  .brand-box {
    padding: 1rem;
  }

  .tab-btn {
    padding: 0.65rem 1rem;
    font-size: 0.875rem;
  }

  .header-controls {
    top: 0;
    right: 0;
  }

  .header-btn {
    padding: 0.3rem 0.55rem;
    font-size: 0.78rem;
    min-width: 30px;
  }
}

/* Très petits écrans (≤ 360px) */
@media (max-width: 360px) {
  h1 {
    font-size: 1.65rem;
  }

  .cat-btns .btn {
    min-width: 80px;
    font-size: 0.8rem;
  }
}

/* ---- Fil d'ariane (Breadcrumb) ---- */
.breadcrumb {
  padding: 0.6rem 0 0;
  margin-bottom: 1.25rem;
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem;
  list-style: none;
  font-size: 0.82rem;
}

.breadcrumb li {
  display: flex;
  align-items: center;
}

.breadcrumb li + li::before {
  content: "›";
  margin: 0 0.3rem;
  color: var(--text-faint);
  font-size: 1rem;
  line-height: 1;
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.breadcrumb a:hover {
  color: var(--text);
  text-decoration: underline;
}

.breadcrumb [aria-current="page"] {
  color: var(--text);
  font-weight: 600;
}

/* Print */
@media print {
  .header, .footer { border: none; }
  .btn, select     { border: 1px solid #000; }
  .conversion-item { break-inside: avoid; }
}
