/* =============================================
   PMEDIA - Automotive Media Intelligence
   Estils globals - Tema fosc
   ============================================= */

/* Variables */
:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #0d1117;
  --bg-card: #161b22;
  --bg-card-hover: #1c2333;
  --bg-sidebar: #0d1117;
  --bg-input: #1a1f2e;

  --accent-cyan: #00d4ff;
  --accent-blue: #0ea5e9;
  --accent-purple: #8b5cf6;
  --accent-green: #10b981;
  --accent-red: #e91e63;
  --accent-pink: #ff4081;
  --accent-orange: #f59e0b;

  --gradient-main: linear-gradient(135deg, #00d4ff 0%, #0ea5e9 100%);
  --gradient-cta: linear-gradient(135deg, #00d4ff 0%, #0077b6 100%);
  --gradient-hero: linear-gradient(180deg, rgba(10,10,15,0) 0%, rgba(10,10,15,0.8) 50%, #0a0a0f 100%);

  --text-primary: #ffffff;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --text-accent: #00d4ff;

  --border-color: #1e293b;
  --border-light: #2d3748;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px rgba(0,212,255,0.15);

  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Chart colors (used by JS) */
  --chart-grid: #1e293b;
  --chart-tick: #9ca3af;
  --chart-legend: #9ca3af;
}

/* =============================================
   LIGHT THEME
   ============================================= */
[data-theme="light"] {
  --bg-primary: #f0f2f5;
  --bg-secondary: #e8eaed;
  --bg-card: #ffffff;
  --bg-card-hover: #f5f6f8;
  --bg-sidebar: #e4e6ea;
  --bg-input: #ebedf0;

  --gradient-hero: linear-gradient(180deg, rgba(240,242,245,0) 0%, rgba(240,242,245,0.8) 50%, #f0f2f5 100%);

  --text-primary: #1a1a2e;
  --text-secondary: #3d4152;
  --text-muted: #6b7280;

  --border-color: #d1d5db;
  --border-light: #c0c4cc;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --shadow-glow: 0 0 20px rgba(0,212,255,0.12);

  --chart-grid: #e2e8f0;
  --chart-tick: #64748b;
  --chart-legend: #475569;
}

[data-theme="light"] .navbar {
  background: rgba(240, 242, 245, 0.8);
}

[data-theme="light"] .navbar.scrolled {
  background: rgba(240, 242, 245, 0.95);
}

[data-theme="light"] .hero-bg::after {
  background: linear-gradient(180deg, rgba(240,242,245,0) 0%, rgba(240,242,245,0.7) 50%, #f0f2f5 100%);
}

[data-theme="light"] .hero h1 {
  color: #0f172a;
}

[data-theme="light"] .hero p {
  color: #475569;
}

[data-theme="light"] .service-card {
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

[data-theme="light"] .ad-card {
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

[data-theme="light"] .highlights-box {
  background: linear-gradient(135deg, rgba(0,212,255,0.03) 0%, rgba(14,165,233,0.03) 100%);
  border-color: rgba(0,212,255,0.1);
}

[data-theme="light"] .search-form {
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* =============================================
   LOGO MONOGRAMA
   ============================================= */
.logo-monogram {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-monogram svg {
  display: block;
}

/* =============================================
   THEME TOGGLE
   ============================================= */
.theme-toggle {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon { display: none; }

[data-theme="light"] .theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
:root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }

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

/* =============================================
   SCROLLBARS (Dark theme)
   ============================================= */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 4px;
  transition: background 0.2s;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-cyan);
}

::-webkit-scrollbar-corner {
  background: var(--bg-secondary);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) var(--bg-secondary);
}

/* Light theme scrollbar */
[data-theme="light"] ::-webkit-scrollbar-track {
  background: #f1f5f9;
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: #cbd5e1;
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: var(--accent-cyan);
}

[data-theme="light"] ::-webkit-scrollbar-corner {
  background: #f1f5f9;
}

[data-theme="light"] * {
  scrollbar-color: #cbd5e1 #f1f5f9;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent-cyan);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-blue);
}

img {
  max-width: 100%;
  height: auto;
}

/* =============================================
   NAVBAR
   ============================================= */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all var(--transition);
  background: rgba(10, 10, 15, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.navbar.scrolled {
  background: rgba(10, 10, 15, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 2rem;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.navbar-brand .logo-icon {
  width: 32px;
  height: 32px;
  background: var(--gradient-main);
  border-radius: var(--radius-sm);
}

.navbar-nav {
  display: flex;
  list-style: none;
  gap: 2rem;
  align-items: center;
}

.navbar-nav a {
  color: #c9d1d9;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color var(--transition);
}

[data-theme="light"] .navbar-nav a {
  color: #374151;
}

.navbar-nav a:hover,
.navbar-nav a.active {
  color: var(--accent-cyan);
}

.nav-cta {
  padding: 0.5rem 1.25rem;
  background: var(--gradient-cta);
  border-radius: var(--radius-full);
  color: white !important;
  font-weight: 600;
  font-size: 0.9rem;
}

.nav-cta:hover {
  opacity: 0.9;
  color: white !important;
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
}

.hamburger span {
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  transition: all var(--transition);
}

/* =============================================
   HERO
   ============================================= */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-hero);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
  padding: 0 2rem;
  margin-left: 5%;
}

.hero-badge {
  display: inline-block;
  padding: 0.4rem 1rem;
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: var(--radius-full);
  color: var(--accent-cyan);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 1.5rem;
}

.hero h1 .highlight {
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 2rem;
  max-width: 600px;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* =============================================
   BOTONS
   ============================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 2rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  font-family: var(--font-family);
}

.btn-primary {
  background: var(--gradient-cta);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 212, 255, 0.3);
  color: white;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-primary);
}

.btn-outline:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.btn-sm {
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
}

/* =============================================
   SECCIONS
   ============================================= */
.section {
  padding: 6rem 2rem;
}

.section-dark {
  background: var(--bg-secondary);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

.section-header {
  text-align: center;
  margin-bottom: 4rem;
}

.section-badge {
  display: inline-block;
  padding: 0.4rem 1rem;
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: var(--radius-full);
  color: var(--accent-cyan);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}

.section-header h2 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 700;
  margin-bottom: 1rem;
}

.section-header p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 650px;
  margin: 0 auto;
}

/* =============================================
   CARDS DE SERVEIS
   ============================================= */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.service-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: all var(--transition);
}

.service-card:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
}

.service-icon {
  width: 56px;
  height: 56px;
  background: var(--gradient-main);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1.25rem;
}

.service-card h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.service-card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* =============================================
   BUSCADOR D'ANUNCIS
   ============================================= */
.search-form {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
}

.search-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.form-control {
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.95rem;
  transition: border-color var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.form-control::placeholder {
  color: var(--text-muted);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239ca3af' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.search-actions {
  display: flex;
  gap: 1rem;
}

.search-actions .btn-primary {
  flex: 1;
  justify-content: center;
}

/* =============================================
   TARGETES D'ANUNCIS (RESULTATS)
   ============================================= */
.ads-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(440px, 1fr));
  gap: 1.5rem;
}

.ad-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
}

.ad-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.ad-card-image {
  position: relative;
  height: 200px;
  overflow: hidden;
}

.ad-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ad-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.3rem 0.75rem;
  background: var(--accent-cyan);
  color: var(--bg-primary);
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.ad-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--bg-primary);
  border-radius: 50%;
}

.ad-card-body {
  padding: 1.25rem;
}

.ad-brand {
  color: var(--accent-cyan);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.25rem;
}

.ad-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.ad-ref {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.ad-meta {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.ad-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
}

.ad-meta-row .label {
  color: var(--text-muted);
}

.ad-meta-row .value {
  color: var(--text-primary);
  font-weight: 500;
}

.ad-publication {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.ad-publication a {
  color: var(--accent-cyan);
  font-weight: 500;
}

.ad-card-footer {
  border-top: 1px solid var(--border-color);
}

.ad-card-footer .btn {
  width: 100%;
  justify-content: center;
  border-radius: 0;
  padding: 0.75rem;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.ad-card-footer .btn:hover {
  background: var(--bg-card-hover);
  color: var(--accent-cyan);
}

/* =============================================
   HIGHLIGHTS
   ============================================= */
.highlights-box {
  background: linear-gradient(135deg, rgba(0,212,255,0.05) 0%, rgba(14,165,233,0.05) 100%);
  border: 1px solid rgba(0, 212, 255, 0.15);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
}

.highlights-box h3 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  border-left: 3px solid var(--accent-cyan);
  padding-left: 1rem;
}

.highlights-box h3 em {
  color: var(--accent-cyan);
  font-style: italic;
}

.highlights-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.highlights-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.highlights-list li::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--accent-cyan);
  border-radius: 50%;
  margin-top: 0.5rem;
  flex-shrink: 0;
}

/* =============================================
   CTA
   ============================================= */
.cta-section {
  text-align: center;
  background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  padding: 6rem 2rem;
}

.cta-section h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin-bottom: 0.75rem;
}

.cta-section p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin-bottom: 2rem;
}

/* =============================================
   FOOTER
   ============================================= */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 3rem 2rem;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  flex-wrap: wrap;
}

.footer-brand p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  max-width: 400px;
  margin-top: 0.75rem;
  line-height: 1.6;
}

.footer-links h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.footer-links ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.footer-links a:hover {
  color: var(--accent-cyan);
}

.footer-bottom {
  max-width: 1200px;
  margin: 2rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-bottom a {
  color: var(--text-muted);
}

.footer-bottom a:hover {
  color: var(--text-secondary);
}

/* =============================================
   RESPONSIVE
   ============================================= */
/* Language selector button (landing navbar) */
.nav-lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.nav-lang-btn:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* Desktop: show inline, hide mobile version */
.mobile-lang { display: none !important; }
.desktop-lang { display: inline-flex; }

@media (max-width: 768px) {
  .navbar {
    padding: 0.6rem 0.75rem;
    gap: 0.5rem;
    z-index: 1000;
    overflow-x: clip;
    max-width: 100vw;
  }

  .navbar-brand {
    font-size: 0;  /* hide full text on mobile */
    gap: 0;
    flex: 0 0 auto;
  }

  .navbar-brand .logo-monogram svg {
    width: 36px;
    height: 36px;
  }

  .hamburger {
    display: flex;
    z-index: 1001;
    flex-shrink: 0;
    margin-left: auto;
  }

  .mobile-lang {
    width: 30px;
    height: 30px;
    font-size: 0.65rem;
    flex-shrink: 0;
  }

  .navbar-nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 70%;
    max-width: 300px;
    height: 100vh;
    background: var(--bg-card);
    flex-direction: column;
    padding: 5rem 2rem 2rem;
    gap: 1.5rem;
    transition: right var(--transition);
    border-left: 1px solid var(--border-color);
    z-index: 1000;
  }

  .navbar-nav.open {
    right: 0;
  }

  /* Swap lang buttons: show mobile, hide desktop */
  .mobile-lang { display: flex !important; }
  .desktop-lang { display: none !important; }

  .hero-content {
    margin-left: 0;
    text-align: center;
  }

  .hero-buttons {
    justify-content: center;
  }

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

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

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

  .footer-content {
    flex-direction: column;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .section {
    padding: 4rem 1rem;
  }

  .navbar {
    padding: 0.75rem 1rem;
  }

  .hero-buttons {
    flex-direction: column;
    align-items: center;
  }
}
