/* CSS Variables - Updated for Red Theme */
:root {
  --red: #E53935;
  --orange: #FF7A18;
  --bg: #F7F7F8;
  --text: #111827;
  --muted: #6B7280;
  --card: #FFFFFF;
  --radius: 12px;
  --shadow: 0 6px 20px rgba(0,0,0,.08);
  
  /* Legacy variables for compatibility */
  --primary-color: var(--red);
  --primary-dark: #D32F2F;
  --secondary-color: #64748b;
  --success-color: #059669;
  --error-color: #dc2626;
  --warning-color: #d97706;
  --background-color: var(--bg);
  --card-background: var(--card);
  --text-primary: var(--text);
  --text-secondary: #475569;
  --text-muted: var(--muted);
  --border-color: #e2e8f0;
  --border-radius: var(--radius);
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
}

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

/* Base */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  margin-bottom: var(--spacing-md);
  font-weight: 600;
}

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

p {
  margin-bottom: var(--spacing-md);
  color: var(--text-secondary);
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

/* Header */
.header {
  background: var(--card);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border-color);
  height: 60px;
  display: flex;
  align-items: center;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: 100%;
}

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

.brand-icon {
  width: 24px;
  height: 24px;
  color: var(--red);
}

.brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--red);
  text-decoration: none;
}

.host-btn {
  min-height: 40px;
  padding: 8px 16px;
  font-size: 0.875rem;
}

/* Hero Section */
.hero-section {
  background: linear-gradient(135deg, var(--red) 0%, var(--orange) 100%);
  padding: 60px 0 80px;
  position: relative;
}

.search-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  max-width: 500px;
  margin: 0 auto;
  text-align: center;
}

.search-title {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 24px;
}

.search-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.search-input {
  width: 100%;
  padding: 16px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.1);
}

.search-input.error {
  border-color: var(--error-color);
  animation: shake 0.3s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.search-btn {
  width: 100%;
  padding: 16px;
  background: var(--red);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 48px;
}

.search-btn:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

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

/* Popular Areas */
.popular-areas {
  padding: 60px 0;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 24px;
  text-align: center;
}

.area-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  max-width: 600px;
  margin: 0 auto;
}

.area-chip {
  padding: 12px 24px;
  background: #f1f5f9;
  color: var(--text);
  border: none;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px;
  min-width: 80px;
}

.area-chip:hover,
.area-chip:focus,
.area-chip.active {
  background: var(--red);
  color: white;
  transform: translateY(-1px);
}

.area-chip:focus {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

/* Best Deals */
.best-deals {
  padding: 60px 0;
  background: var(--card);
}

.deals-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.carousel-controls {
  display: flex;
  gap: 8px;
}

.carousel-btn {
  width: 40px;
  height: 40px;
  background: var(--card);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.carousel-btn:hover:not(:disabled) {
  background: var(--red);
  color: white;
  border-color: var(--red);
}

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

.carousel-btn svg {
  width: 20px;
  height: 20px;
}

.deals-carousel {
  overflow: hidden;
  position: relative;
}

.deals-container {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 8px;
}

.deals-container::-webkit-scrollbar {
  display: none;
}

.deal-card {
  flex: 0 0 280px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: all 0.2s ease;
  scroll-snap-align: start;
  text-decoration: none;
  color: inherit;
}

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

.deal-image {
  width: 100%;
  height: 160px;
  object-fit: cover;
}

.deal-content {
  padding: 16px;
}

.deal-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  overflow: hidden;
}

.deal-price {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--red);
  margin-bottom: 8px;
}

.deal-location {
  font-size: 0.875rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.deal-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.875rem;
  color: var(--muted);
  margin-top: 8px;
}

.deals-empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 0;
}

/* Results Section */
.results-section {
  padding: 60px 0;
}

.rooms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.room-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: all 0.2s ease;
}

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

.room-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.room-content {
  padding: 20px;
}

.room-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.room-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--red);
  margin-bottom: 12px;
}

.room-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  background: var(--bg);
  color: var(--muted);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-ac {
  background: #dbeafe;
  color: var(--red);
}

.badge-location {
  background: #f0fdf4;
  color: var(--success-color);
}

/* Mobile App Section */
.mobile-app {
  padding: 60px 0;
  background: #f8fafc;
}

.app-content {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 40px;
  align-items: center;
}

.app-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.app-subtitle {
  color: var(--muted);
  margin-bottom: 24px;
}

.store-badges {
  display: flex;
  gap: 12px;
}

.store-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s ease;
  cursor: not-allowed;
  opacity: 0.6;
}

.store-icon {
  width: 24px;
  height: 24px;
}

.store-text {
  text-align: left;
}

.store-line1 {
  font-size: 0.75rem;
  color: var(--muted);
}

.store-line2 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.mockup-image {
  width: 100%;
  max-width: 200px;
  height: auto;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
}

/* Footer */
.footer {
  background: var(--card);
  border-top: 1px solid var(--border-color);
  padding: 40px 0 20px;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
  margin-bottom: 32px;
}

.footer-section h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 8px;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.2s ease;
}

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

.footer-bottom {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  color: var(--muted);
  font-size: 0.875rem;
}

/* Form Controls */
.form-control {
  width: 100%;
  padding: var(--spacing-md);
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 1rem;
  transition: border-color 0.2s ease;
  min-height: 44px;
}

.form-control:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.1);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-md) var(--spacing-lg);
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 48px;
}

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

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

.btn-outline:hover:not(:disabled) {
  background-color: var(--red);
  color: white;
}

/* Messages & States */
.alert {
  padding: var(--spacing-md);
  border-radius: var(--border-radius);
  margin-bottom: var(--spacing-md);
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 1000;
  max-width: 400px;
}

.alert-error {
  background-color: #fef2f2;
  color: var(--error-color);
  border: 1px solid #fecaca;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-2xl);
  color: var(--muted);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
}

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

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.empty-state {
  text-align: center;
  padding: var(--spacing-2xl);
  color: var(--muted);
}

.empty-state h3 {
  margin-bottom: var(--spacing-md);
  color: var(--text-secondary);
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }

  .header-content {
    flex-wrap: wrap;
    gap: 12px;
  }

  .brand {
    font-size: 1.25rem;
  }

  .host-btn {
    padding: 6px 12px;
    font-size: 0.75rem;
    min-height: 36px;
  }

  .hero-section {
    padding: 40px 0 60px;
  }

  .search-card {
    padding: 24px;
  }

  .search-title {
    font-size: 1.5rem;
  }

  .popular-areas,
  .best-deals,
  .results-section,
  .mobile-app {
    padding: 40px 0;
  }

  .section-title {
    font-size: 1.25rem;
    margin-bottom: 20px;
  }

  .area-chips {
    gap: 8px;
  }

  .area-chip {
    padding: 10px 16px;
    font-size: 0.8rem;
    min-height: 40px;
  }

  .deals-header {
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
    text-align: center;
  }

  .carousel-controls {
    justify-content: center;
  }

  .deal-card {
    flex: 0 0 260px;
  }

  .rooms-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .app-content {
    grid-template-columns: 1fr;
    gap: 24px;
    text-align: center;
  }

  .store-badges {
    flex-direction: column;
    align-items: center;
  }

  .store-badge {
    width: 180px;
  }

  .footer-content {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }

  .alert {
    position: static;
    margin: 16px;
  }

  .loading {
    position: static;
    transform: none;
    margin: 40px auto;
    max-width: 200px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 12px;
  }

  .header {
    height: 56px;
  }

  .brand-container {
    gap: 6px;
  }

  .brand-icon {
    width: 20px;
    height: 20px;
  }

  .brand {
    font-size: 1.125rem;
  }

  .search-card {
    padding: 20px;
  }

  .search-title {
    font-size: 1.25rem;
  }

  .search-input,
  .search-btn {
    padding: 14px;
  }

  .area-chip {
    padding: 8px 12px;
    min-height: 36px;
    font-size: 0.75rem;
  }

  .deal-card {
    flex: 0 0 240px;
  }

  .deal-content {
    padding: 12px;
  }

  .deal-title {
    font-size: 0.875rem;
  }

  .deal-price {
    font-size: 1rem;
  }

  .room-content {
    padding: 16px;
  }

  .room-title {
    font-size: 1rem;
  }

  .room-price {
    font-size: 1.125rem;
  }

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

  .store-badge {
    width: 160px;
    padding: 10px 12px;
  }

  .store-icon {
    width: 20px;
    height: 20px;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus styles for better accessibility */
.btn:focus,
.form-control:focus,
.area-chip:focus,
.carousel-btn:focus {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --red: #CC0000;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
  }
  
  .btn-outline {
    border-width: 3px;
  }
}

/* Room Page Specific Styles */
.room-header {
  background: var(--card);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border-color);
  height: 60px;
  display: flex;
  align-items: center;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: white;
  color: var(--red);
  border: 2px solid var(--red);
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  min-height: 44px;
  transition: all 0.2s ease;
}

.back-btn:hover {
  background: var(--red);
  color: white;
}

.back-btn svg {
  width: 16px;
  height: 16px;
}

/* Hero Image Section */
.hero-image {
  width: 100%;
  margin-top: 8px;
  padding: 0 var(--spacing-md);
}

.hero-img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

/* Room Detail Layout Adjustments */
.room-detail {
  margin-top: 2rem;
}

/* Responsive adjustments for room page */
@media (max-width: 768px) {
  .room-header .header-content {
    flex-wrap: nowrap;
    gap: 12px;
  }

  .back-btn {
    padding: 6px 12px;
    font-size: 0.75rem;
    min-height: 40px;
  }

  .hero-image {
    padding: 0 16px;
  }

  .hero-img {
    border-radius: 8px;
  }
}

@media (max-width: 480px) {
  .room-header {
    height: 56px;
  }

  .back-btn {
    padding: 6px 10px;
    gap: 4px;
  }

  .back-btn svg {
    width: 14px;
    height: 14px;
  }

  .hero-image {
    padding: 0 12px;
    margin-top: 6px;
  }

  .room-detail {
    margin-top: 1.5rem;
  }
}

/* Print styles */
@media print {
  .header,
  .hero-section,
  .popular-areas,
  .mobile-app,
  .footer {
    display: none !important;
  }

  .results-section {
    padding: 0 !important;
  }

  .room-card {
    box-shadow: none !important;
    border: 1px solid var(--border-color) !important;
    break-inside: avoid;
  }
}