/* =========================================================================
   EuroFuel Compare — style.css
   Temă duală (dark / light), design editorial industrial cu Bebas Neue
   =========================================================================

   CUPRINS:
   1. Variabile CSS (tokens teme dark + light)
   2. Reset + baze
   3. Layout global
   4. Header
   5. Filters section
   6. Info banner
   7. Loading overlay
   8. Results section + carduri
   9. Legend section
   10. Footer
   11. Modal README
   12. Animații + keyframes
   13. Responsive
   ========================================================================= */


/* =========================================================================
   1. VARIABILE CSS — TEME
   ========================================================================= */

/* ---- TEMA DARK (default) ---- */
:root,
[data-theme="dark"] {
  --bg-primary:     #0d0d12;          /* fundal pagină */
  --bg-secondary:   #13131c;          /* fundal card */
  --bg-tertiary:    #1a1a28;          /* fundal card intern / hover */
  --bg-glass:       rgba(255,255,255,0.04);
  --bg-glass-hover: rgba(255,255,255,0.07);

  --border-subtle:  rgba(255,255,255,0.07);
  --border-accent:  rgba(255,165,0,0.35);

  --text-primary:   #f0f0f5;
  --text-secondary: #9595b0;
  --text-muted:     #5a5a75;
  --text-accent:    #ff9a00;          /* portocaliu benzinărie */
  --text-link:      #68b8ff;

  --accent-gold:    #ff9a00;
  --accent-gold-dim:#7a4900;
  --accent-blue:    #3a7bd5;
  --accent-green:   #2ec76b;
  --accent-red:     #e8454a;

  --card-shadow:    0 4px 32px rgba(0,0,0,0.55);
  --card-shadow-hover: 0 8px 48px rgba(255,154,0,0.18);

  --badge-online:   #2ec76b;
  --badge-offline:  #e8454a;
  --badge-warn:     #f5a623;

  --spinner-color:  #ff9a00;
  --scrollbar-thumb: #2a2a40;
}

/* ---- TEMA LIGHT ---- */
[data-theme="light"] {
  --bg-primary:     #f4f4f8;
  --bg-secondary:   #ffffff;
  --bg-tertiary:    #ededf5;
  --bg-glass:       rgba(0,0,0,0.03);
  --bg-glass-hover: rgba(0,0,0,0.06);

  --border-subtle:  rgba(0,0,0,0.08);
  --border-accent:  rgba(200,100,0,0.25);

  --text-primary:   #1a1a2e;
  --text-secondary: #555570;
  --text-muted:     #9898b0;
  --text-accent:    #c85c00;
  --text-link:      #1a6abf;

  --accent-gold:    #c85c00;
  --accent-gold-dim:#f5d5b0;
  --accent-blue:    #1a6abf;
  --accent-green:   #1a8a4a;
  --accent-red:     #c82020;

  --card-shadow:    0 2px 20px rgba(0,0,0,0.10);
  --card-shadow-hover: 0 6px 32px rgba(200,90,0,0.15);

  --badge-online:   #1a8a4a;
  --badge-offline:  #c82020;
  --badge-warn:     #c85c00;

  --spinner-color:  #c85c00;
  --scrollbar-thumb: #ccccda;
}


/* =========================================================================
   2. RESET + BAZE
   ========================================================================= */

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.6;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  transition: background-color 0.35s ease, color 0.35s ease;

  /* Grain texture subtil peste fundal */
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
}

/* Scrollbar stilizat */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 3px;
}

a {
  color: var(--text-link);
  text-decoration: none;
  transition: opacity 0.2s;
}
a:hover { opacity: 0.75; text-decoration: underline; }

ul { list-style: none; }

/* Tranziție globală teme */
body, header, footer, section, .card, .modal-box, select, button {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}


/* =========================================================================
   3. LAYOUT GLOBAL
   ========================================================================= */

.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}


/* =========================================================================
   4. HEADER
   ========================================================================= */

.site-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

[data-theme="dark"] .site-header {
  background: rgba(13,13,18,0.92);
}
[data-theme="light"] .site-header {
  background: rgba(255,255,255,0.92);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* Logo */
.logo-block {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.logo-icon {
  font-size: 1.8rem;
  line-height: 1;
}
.logo-text {
  display: flex;
  flex-direction: column;
}
.logo-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.55rem;
  letter-spacing: 0.04em;
  color: var(--text-accent);
  line-height: 1;
}
.logo-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Controale header */
.header-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Badge dată */
.data-badge {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.8rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  cursor: default;
}
.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--badge-warn);
  flex-shrink: 0;
}
.badge-dot.online  { background: var(--badge-online); }
.badge-dot.offline { background: var(--badge-offline); }

/* Buton refresh */
.btn-refresh {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--bg-glass);
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s, border-color 0.2s;
}
.btn-refresh:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  transform: rotate(90deg);
}
.btn-refresh.spinning .refresh-icon {
  display: inline-block;
  animation: spin 0.7s linear infinite;
}

/* Toggle temă */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--bg-glass);
  color: var(--text-secondary);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s;
}
.theme-toggle:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}


/* =========================================================================
   5. FILTERS SECTION
   ========================================================================= */

.filters-section {
  margin-bottom: 1.8rem;
  animation: fadeUp 0.5s ease both;
}

.section-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.9rem;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}
.section-sub {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 1.2rem;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

/* Fiecare celulă filtru */
.filter-cell {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.filter-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 500;
}

/* Select stilizat */
.filter-select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  padding: 0.75rem 2.5rem 0.75rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239595b0' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.filter-select:focus {
  outline: none;
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px var(--accent-gold-dim);
}
.filter-select:hover {
  border-color: var(--border-accent);
}

/* Indicator culoare țară lângă select */
.filter-flag {
  position: absolute;
  right: 2.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  pointer-events: none;
}


/* =========================================================================
   6. INFO BANNER
   ========================================================================= */

.info-banner {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  margin-bottom: 2rem;
  animation: fadeUp 0.5s ease 0.1s both;
}

.info-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem 2.5rem;
  align-items: center;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.info-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}
.info-value {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}


/* =========================================================================
   7. LOADING OVERLAY
   ========================================================================= */

.loading-overlay {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 3rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.loading-overlay.visible {
  display: flex;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--spinner-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}


/* =========================================================================
   8. RESULTS SECTION + CARDURI
   ========================================================================= */

.results-section {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 2.5rem;
  min-height: 100px;
}

/* Stare goală */
.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 4rem 2rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  text-align: center;
}
.empty-icon {
  font-size: 3rem;
  opacity: 0.4;
}

/* ---- CARD ȚARĂ ---- */
.country-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  animation: fadeUp 0.45s ease both;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.country-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-hover);
  border-color: var(--border-accent);
}

/* Header card */
.card-header {
  padding: 1rem 1.2rem 0.8rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: var(--bg-glass);
}
.card-flag {
  font-size: 2rem;
  line-height: 1;
}
.card-country-info {
  flex: 1;
}
.card-country-name {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.45rem;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  line-height: 1;
}
.card-country-currency {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Prețul mediu național mare */
.card-avg-price {
  padding: 0.8rem 1.2rem;
  background: var(--bg-tertiary);
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}
.avg-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.avg-value-eur {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.4rem;
  color: var(--accent-gold);
  letter-spacing: 0.02em;
  line-height: 1;
}
.avg-suffix {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Corp card - tabel benzinării */
.card-body {
  padding: 0.8rem 1.2rem 1.2rem;
}

.stations-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-weight: 600;
}

/* Rând stație */
.station-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 0.3rem 0.6rem;
  padding: 0.55rem 0;
  border-bottom: 1px dashed var(--border-subtle);
  transition: background 0.15s;
}
.station-row:last-child {
  border-bottom: none;
}
.station-row:hover {
  background: var(--bg-glass-hover);
  border-radius: 6px;
  padding-left: 0.4rem;
  padding-right: 0.4rem;
}

/* Nume stație */
.station-name {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.station-badge {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
/* Culori distincte pentru fiecare brand */
.badge-1 { background: #e8454a; }
.badge-2 { background: #ffd700; }
.badge-3 { background: #3a7bd5; }

/* Celule preț */
.price-cell {
  text-align: right;
  font-size: 0.82rem;
}
.price-cell .amount {
  font-weight: 600;
  color: var(--text-primary);
  display: block;
}
.price-cell .currency {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Etichete coloane */
.station-header-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 0.3rem 0.6rem;
  padding: 0 0 0.4rem 0;
  margin-bottom: 0.2rem;
}
.station-header-row span {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  text-align: right;
}
.station-header-row span:first-child {
  text-align: left;
}

/* Highlight pentru prețul mai mic */
.price-low  { color: var(--accent-green) !important; }
.price-high { color: var(--accent-red)   !important; }


/* =========================================================================
   9. LEGEND SECTION
   ========================================================================= */

.legend-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  animation: fadeUp 0.5s ease 0.2s both;
}

.legend-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.35rem;
  letter-spacing: 0.04em;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.6rem 1rem;
  margin-bottom: 1rem;
}

.legend-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.83rem;
  color: var(--text-secondary);
}
.legend-item-icon {
  font-size: 1.1rem;
  line-height: 1.4;
  flex-shrink: 0;
}
.legend-item-name {
  font-weight: 600;
  color: var(--text-primary);
}

.legend-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.75rem;
}


/* =========================================================================
   10. FOOTER
   ========================================================================= */

.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  padding: 2rem 1.5rem 1.5rem;
}

/* Surse */
.sources-block {
  max-width: 1400px;
  margin: 0 auto 1.5rem;
}
.sources-block h4 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-weight: 600;
}
.sources-list li {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border-subtle);
  line-height: 1.5;
}
.sources-list li:last-child { border-bottom: none; }
.sources-list a {
  color: var(--text-link);
  font-weight: 500;
}

/* Bara de jos */
.footer-bottom {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

/* Credit clickabil */
.footer-credit {
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.3rem 0.7rem;
  border: 1px solid transparent;
  border-radius: 6px;
  transition: border-color 0.2s, color 0.2s;
  user-select: none;
}
.footer-credit:hover {
  border-color: var(--border-accent);
  color: var(--text-accent);
}
.footer-version {
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}


/* =========================================================================
   11. MODAL README
   ========================================================================= */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  max-width: 720px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2rem 2.5rem;
  position: relative;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
  animation: scaleIn 0.2s ease;
}

.modal-close {
  position: sticky;
  top: 0;
  float: right;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  margin-bottom: 0.5rem;
}
.modal-close:hover {
  background: var(--accent-red);
  color: #fff;
  border-color: transparent;
}

/* Stiluri pentru conținut markdown randat în modal */
.modal-content h1 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.2rem;
  letter-spacing: 0.04em;
  color: var(--text-accent);
  margin-bottom: 0.5rem;
}
.modal-content h2 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.4rem;
  letter-spacing: 0.03em;
  color: var(--text-primary);
  margin: 1.5rem 0 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border-subtle);
}
.modal-content h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-accent);
  margin: 1rem 0 0.4rem;
}
.modal-content p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.8rem;
  line-height: 1.7;
}
.modal-content ul {
  list-style: disc;
  padding-left: 1.5rem;
  margin-bottom: 0.8rem;
}
.modal-content li {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}
.modal-content code {
  background: var(--bg-tertiary);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.82em;
  color: var(--text-accent);
  font-family: 'Courier New', monospace;
}
.modal-content strong { color: var(--text-primary); }
.modal-content hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 1.2rem 0;
}
.modal-content a { color: var(--text-link); }

/* Badge versiune în modal */
.readme-badge {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  background: var(--accent-gold-dim);
  color: var(--text-accent);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-right: 0.4rem;
}


/* =========================================================================
   12. ANIMAȚII + KEYFRAMES
   ========================================================================= */

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

/* Stagger delay pentru carduri */
.country-card:nth-child(1) { animation-delay: 0.05s; }
.country-card:nth-child(2) { animation-delay: 0.12s; }
.country-card:nth-child(3) { animation-delay: 0.19s; }
.country-card:nth-child(4) { animation-delay: 0.26s; }


/* =========================================================================
   13. RESPONSIVE
   ========================================================================= */

@media (max-width: 1100px) {
  .results-section {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 800px) {
  .filters-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .header-inner {
    flex-wrap: wrap;
    gap: 0.6rem;
  }
  .data-badge { display: none; }
}

@media (max-width: 580px) {
  .results-section {
    grid-template-columns: 1fr;
  }
  .filters-grid {
    grid-template-columns: 1fr;
  }
  .avg-value-eur { font-size: 2rem; }
  .modal-box {
    padding: 1.5rem 1.2rem;
  }
  .info-inner { gap: 0.8rem 1.2rem; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}
