/* Root Variables */
:root {
  --primary: #1a365d;
  --primary-dark: #0f2238;
  --primary-light: #2d5a96;
  --secondary: #2b6cb0;
  --accent: #ed8936;
  --success: #38a169;
  --warning: #d69e2e;
  --danger: #e53e3e;
  --background: #f7fafc;
  --card-bg: #ffffff;
  --text: #2d3748;
  --text-light: #718096;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
}

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

html, body {
  width: 100%;
  height: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--background);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  line-height: 1.2;
  color: var(--primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

a {
  color: var(--secondary);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--primary-light);
}

button, input, select, textarea {
  font-family: inherit;
}

/* Navigation */
nav {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-md);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-family: 'Poppins', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 2rem;
}

.nav-links a {
  color: white;
  font-weight: 500;
  transition: opacity 0.3s ease;
}

.nav-links a:hover {
  opacity: 0.8;
}

/* Page Container */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  min-height: calc(100vh - 200px);
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 50%, var(--secondary) 100%);
  color: white;
  padding: 4rem 2rem;
  text-align: center;
  margin: -2rem -2rem 2rem -2rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100px;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 120"><polygon points="0,50 300,120 600,30 900,120 1200,50 1200,120 0,120" fill="%23f7fafc" fill-opacity="0.1"/></svg>') repeat-x;
  background-size: 300px 120px;
}

.hero h1 {
  color: white;
  margin-bottom: 1rem;
  font-size: 3rem;
}

.hero p {
  font-size: 1.2rem;
  margin-bottom: 2rem;
  opacity: 0.95;
}

.hero-content {
  max-width: 600px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* Search Bar */
.search-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
}

.search-bar input {
  flex: 1;
  min-width: 250px;
  padding: 0.75rem 1rem;
  border: 2px solid transparent;
  border-radius: 6px;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.search-bar input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(237, 137, 54, 0.1);
}

.search-bar button {
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease;
}

.search-bar button:hover {
  background: darken(#ed8936, 10%);
}

/* Quick Filter Buttons */
.quick-filters {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.filter-btn {
  padding: 0.5rem 1rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: transparent;
  color: white;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
}

/* Stats Bar */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
  padding: 2rem;
  background: white;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
}

.stat-item {
  text-align: center;
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--secondary);
}

.stat-label {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

/* Country Cards Grid */
.country-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.country-card {
  padding: 1.5rem;
  background: white;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
  border: 2px solid transparent;
}

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

.country-flag {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.country-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.country-resorts {
  color: var(--text-light);
  font-size: 0.9rem;
}

/* Resort Cards */
.resort-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.resort-card {
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.resort-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
}

.resort-image {
  height: 150px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  position: relative;
}

.resort-image::after {
  content: attr(data-country);
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 2rem;
}

.resort-info {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.resort-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.resort-country {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.resort-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.stat {
  text-align: center;
}

.stat-value {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--secondary);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-light);
  text-transform: uppercase;
  margin-top: 0.25rem;
}

.resort-scores {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex: 1;
}

.score-badge {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  background: var(--background);
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.resort-actions {
  display: flex;
  gap: 0.5rem;
}

.resort-actions a {
  flex: 1;
  padding: 0.75rem;
  background: var(--secondary);
  color: white;
  border-radius: 6px;
  text-align: center;
  font-weight: 600;
  transition: background 0.3s ease;
}

.resort-actions a:hover {
  background: var(--primary-light);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  font-size: 1rem;
}

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

.btn-primary:hover {
  background: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--accent);
  color: white;
}

.btn-secondary:hover {
  background: darken(#ed8936, 10%);
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--secondary);
  color: var(--secondary);
}

.btn-outline:hover {
  background: var(--secondary);
  color: white;
}

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border-color);
  margin: 2rem 0 1rem 0;
  gap: 1rem;
}

.tab-btn {
  padding: 1rem 1.5rem;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-light);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.tab-btn:hover,
.tab-btn.active {
  color: var(--secondary);
  border-bottom-color: var(--secondary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--primary);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.1);
}

/* Grid and Layout */
.grid {
  display: grid;
  gap: 1.5rem;
}

.grid-cols-2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-cols-3 {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-cols-4 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.flex {
  display: flex;
  gap: 1rem;
}

.flex-between {
  justify-content: space-between;
}

.flex-center {
  justify-content: center;
  align-items: center;
}

.flex-col {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

/* Comparison Section */
.comparison-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.comparison-card {
  background: white;
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  border: 2px solid var(--border-color);
}

.comparison-card.selected {
  border-color: var(--secondary);
  background: linear-gradient(135deg, rgba(43, 108, 176, 0.05) 0%, transparent 100%);
}

.comparison-resort-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1rem;
}

.comparison-stat {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

.comparison-stat-value {
  font-weight: 700;
  color: var(--secondary);
}

/* Chart Container */
.chart-container {
  position: relative;
  height: 400px;
  margin: 2rem 0;
  background: white;
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

.chart-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1rem;
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 80px;
  height: fit-content;
}

.sidebar-section {
  background: white;
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-md);
}

.sidebar-title {
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.filter-option {
  margin-bottom: 0.75rem;
}

.filter-option input {
  margin-right: 0.5rem;
}

.filter-option label {
  cursor: pointer;
  display: flex;
  align-items: center;
}

/* Table Styles */
.table-container {
  overflow-x: auto;
  background: white;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: var(--primary);
  color: white;
}

th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

tr:hover {
  background: var(--background);
}

/* Badge and Labels */
.badge {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
}

.badge-primary {
  background: rgba(43, 108, 176, 0.2);
  color: var(--secondary);
}

.badge-success {
  background: rgba(56, 161, 105, 0.2);
  color: var(--success);
}

.badge-warning {
  background: rgba(214, 158, 46, 0.2);
  color: var(--warning);
}

.badge-danger {
  background: rgba(229, 62, 62, 0.2);
  color: var(--danger);
}

/* Heatmap */
.heatmap {
  display: grid;
  gap: 1px;
  padding: 1.5rem;
  background: white;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
}

.heatmap-row {
  display: grid;
  grid-template-columns: 60px repeat(20, 1fr);
  gap: 2px;
}

.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: white;
  transition: transform 0.2s ease;
}

.heatmap-cell:hover {
  transform: scale(1.1);
}

.heatmap-cell.quiet {
  background: var(--success);
}

.heatmap-cell.moderate {
  background: var(--warning);
}

.heatmap-cell.busy {
  background: var(--accent);
}

.heatmap-cell.very-busy {
  background: var(--danger);
}

.heatmap-label {
  padding: 0.5rem;
  font-weight: 600;
  color: var(--text-light);
}

/* Footer */
footer {
  background: var(--primary);
  color: white;
  padding: 3rem 2rem 1rem;
  margin-top: 4rem;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto 2rem;
}

.footer-section h4 {
  color: white;
  margin-bottom: 1rem;
}

.footer-section ul {
  list-style: none;
}

.footer-section a {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
}

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

.footer-bottom {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.6);
}

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

@keyframes slideIn {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

.fade-in {
  animation: fadeIn 0.3s ease;
}

/* Loading States */
.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.6;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top: 4px solid var(--secondary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Responsive */
@media (max-width: 768px) {
  .page-container {
    padding: 1rem;
  }

  .hero {
    padding: 2rem 1rem;
    margin: -1rem -1rem 1rem -1rem;
  }

  h1 {
    font-size: 1.8rem;
  }

  h2 {
    font-size: 1.4rem;
  }

  .nav-container {
    padding: 0 1rem;
    flex-direction: column;
    gap: 1rem;
  }

  .nav-links {
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }

  .search-bar {
    flex-direction: column;
  }

  .search-bar input {
    min-width: 100%;
  }

  .country-cards {
    grid-template-columns: 1fr;
  }

  .resort-cards {
    grid-template-columns: 1fr;
  }

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

  .chart-container {
    height: 300px;
  }

  .tabs {
    overflow-x: auto;
  }

  .tab-btn {
    white-space: nowrap;
  }

  .sidebar {
    position: static;
  }

  .heatmap-row {
    grid-template-columns: 50px repeat(10, 1fr);
  }

  table {
    font-size: 0.85rem;
  }

  th, td {
    padding: 0.75rem 0.5rem;
  }

  .stats-bar {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.4rem;
  }

  h2 {
    font-size: 1.1rem;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  .quick-filters {
    gap: 0.5rem;
  }

  .filter-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
  }

  .resort-stats {
    grid-template-columns: 1fr;
  }

  .stats-bar {
    grid-template-columns: 1fr;
  }

  .tab-btn {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }

  .footer-content {
    grid-template-columns: 1fr;
  }
}

/* Print Styles */
@media print {
  nav, footer {
    display: none;
  }

  .page-container {
    max-width: 100%;
  }

  .chart-container {
    page-break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }

  .comparison-container {
    page-break-inside: avoid;
  }

  body {
    background: white;
  }

  a {
    color: var(--primary);
  }
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus Visible */
:focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: 2px;
}

/* Dark Mode Support (future enhancement) */
@media (prefers-color-scheme: dark) {
  :root {
    --background: #1a202c;
    --card-bg: #2d3748;
    --text: #e2e8f0;
    --text-light: #a0aec0;
    --border-color: #4a5568;
  }

  body {
    background-color: var(--background);
  }

  .resort-card,
  .country-card,
  .comparison-card,
  .sidebar-section,
  .chart-container,
  table {
    background: var(--card-bg);
  }
}
