/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
  overflow-x: hidden;
}

/* App Container - Responsive Design */
.app-container {
  max-width: 430px;
  margin: 0 auto;
  background: #ffffff;
  min-height: 100vh;
  position: relative;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.1);
}

/* Responsive breakpoints */
@media (min-width: 768px) {
  .app-container {
    max-width: 600px;
  }
}

@media (min-width: 1024px) {
  .app-container {
    max-width: 800px;
  }
}

@media (min-width: 1200px) {
  .app-container {
    max-width: 1000px;
  }
}

/* Header */
.header {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  padding: 1rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(99, 102, 241, 0.3);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo i {
  font-size: 1.8rem;
}

.install-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.install-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

/* Location Section */
.location-section {
  padding: 1.5rem;
  background: white;
}

/* Responsive location section */
@media (min-width: 768px) {
  .location-section {
    padding: 2rem 3rem;
  }
}

.location-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.current-location {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  color: #374151;
}

.current-location i {
  color: #6366f1;
  font-size: 1.1rem;
}

.location-btn, .precise-location-btn {
  background: #f3f4f6;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  color: #6366f1;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.precise-location-btn {
  background: #ede9fe;
  color: #7c3aed;
}

.location-btn:hover, .precise-location-btn:hover {
  background: #e5e7eb;
  transform: translateY(-1px);
}

.precise-location-btn:hover {
  background: #ddd6fe;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  backdrop-filter: blur(10px);
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: white;
  border-radius: 20px;
  width: 90%;
  max-width: 400px;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 1.3rem;
  font-weight: 600;
  color: #111827;
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #6b7280;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.close-btn:hover {
  background: #f3f4f6;
  color: #374151;
}

.modal-body {
  padding: 1.5rem;
  max-height: 50vh;
  overflow-y: auto;
}

.search-container {
  position: relative;
  margin-bottom: 1rem;
}

.search-container i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
}

.search-container input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border: 2px solid #f3f4f6;
  border-radius: 12px;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.search-container input:focus {
  outline: none;
  border-color: #6366f1;
}

.search-options {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.extended-search-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: #374151;
  margin-bottom: 0.5rem;
}

.extended-search-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #6366f1;
}

.search-status {
  font-size: 0.8rem;
  color: #6b7280;
  font-style: italic;
}

.cities-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.city-item {
  padding: 0.75rem;
  border-radius: 12px;
  background: #f9fafb;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.city-item:hover {
  background: #f3f4f6;
  border-color: #e5e7eb;
}

.city-item.active {
  background: #ede9fe;
  border-color: #6366f1;
  color: #6366f1;
}

.loading-cities, .no-results, .search-limit-message {
  padding: 1rem;
  text-align: center;
  color: #6b7280;
  font-style: italic;
  font-size: 0.9rem;
}

.loading-cities {
  background: #f8fafc;
  border-radius: 8px;
  border: 1px dashed #d1d5db;
}

.no-results {
  color: #ef4444;
}

.search-limit-message {
  background: #fef3c7;
  color: #d97706;
  border-radius: 6px;
  font-size: 0.8rem;
  margin-top: 0.5rem;
  border: 1px solid #fbbf24;
}

/* Gender Section */
.gender-section {
  padding: 0 1.5rem 1.5rem;
  background: white;
}

/* Responsive gender section */
@media (min-width: 768px) {
  .gender-section {
    padding: 0 3rem 2rem;
  }
}

.gender-toggle {
  display: flex;
  background: #f3f4f6;
  border-radius: 12px;
  padding: 4px;
}

.gender-btn {
  flex: 1;
  padding: 0.75rem;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.gender-btn.active {
  background: white;
  color: #6366f1;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Loading State */
.loading {
  padding: 4rem 1.5rem;
  text-align: center;
  background: white;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f4f6;
  border-top: 4px solid #6366f1;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.loading p {
  color: #6b7280;
  font-weight: 500;
}

/* Main Content */
.main-content {
  background: white;
}

/* Day Tabs */
.day-tabs {
  display: flex;
  overflow-x: auto;
  padding: 1rem 1rem 0;
  gap: 0.4rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
  /* Ensure all tabs are visible */
  min-height: 80px;
}

.day-tabs::-webkit-scrollbar {
  display: none;
}

.day-tab {
  flex-shrink: 0;
  padding: 0.6rem 0.5rem;
  border: none;
  background: #f9fafb;
  border-radius: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 70px;
  text-align: center;
  white-space: nowrap;
  font-size: 0.85rem;
  /* Calculate width to fit 5 tabs with gaps */
  flex: 1;
  max-width: calc((100vw - 4rem) / 5 - 0.4rem);
}

.day-tab.active {
  background: #6366f1;
  color: white;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
}

.day-tab-date {
  font-size: 0.7rem;
  opacity: 0.8;
  margin-top: 0.2rem;
}

/* Responsive day tabs */
@media (min-width: 768px) {
  .day-tabs {
    justify-content: center;
    flex-wrap: wrap;
    overflow-x: visible;
    padding: 1rem 3rem 0;
    gap: 0.8rem;
  }

  .day-tab {
    min-width: 100px;
    flex: 1;
    max-width: 120px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }

  .day-tab-date {
    font-size: 0.8rem;
    margin-top: 0.25rem;
  }
}

@media (min-width: 1024px) {
  .day-tab {
    min-width: 120px;
    max-width: 150px;
    padding: 1rem 1.5rem;
    font-size: 1rem;
  }

  .day-tab-date {
    font-size: 0.85rem;
  }
}

/* Weather Info */
.weather-info {
  padding: 1.5rem;
  text-align: center;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  margin: 1rem 1.5rem;
  border-radius: 20px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}

/* Responsive weather info */
@media (min-width: 768px) {
  .weather-info {
    margin: 1.5rem 3rem;
    padding: 2rem 3rem;
  }

  .weather-details {
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    margin-top: 2rem;
  }
}

.weather-main {
  margin-bottom: 1rem;
}

.weather-temp {
  font-size: 3rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 0.5rem;
}

.weather-desc {
  font-size: 1.1rem;
  color: #6b7280;
  font-weight: 500;
  text-transform: capitalize;
}

.weather-feels {
  font-size: 1rem;
  color: #374151;
  margin-top: 0.5rem;
}

.weather-details {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
}

.weather-detail {
  text-align: center;
}

.weather-detail-label {
  font-size: 0.8rem;
  color: #9ca3af;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.weather-detail-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: #374151;
  margin-top: 0.25rem;
}

/* Time Tabs */
.time-tabs {
  display: flex;
  padding: 1rem 1.5rem;
  gap: 0.5rem;
}

/* Responsive time tabs */
@media (min-width: 768px) {
  .time-tabs {
    padding: 1.5rem 3rem;
    gap: 1rem;
    justify-content: center;
  }
}

.time-tab {
  flex: 1;
  padding: 0.75rem;
  border: none;
  background: #f9fafb;
  border-radius: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.time-tab.active {
  background: #fbbf24;
  color: white;
  box-shadow: 0 4px 20px rgba(251, 191, 36, 0.3);
}

.sticky-date {
  display: none; /* Initially hidden from layout */
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 0;
  padding-right: 1rem;
  font-weight: 500;
  white-space: nowrap;
  text-align: center;
  color: #4b5563;
  transform: translateX(-15px); /* Start more offset for smoother animation */
  transition: opacity 1s ease-out, transform 1s ease-out; /* Smooth animation */
}

.sticky-date.showing {
  display: flex; /* In layout but invisible for transition */
}

.sticky-date-day {
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.2;
}

.sticky-date-date {
  font-size: 0.7rem;
  opacity: 0.8;
  margin-top: 0.2rem;
}

.time-tabs.sticky .sticky-date.visible {
  display: flex; /* Show as flex when visible */
  opacity: 1;
  transform: translateX(0); /* Slide into final position */
  transition: opacity 1s ease-out, transform 1s ease-out; /* Smooth fade animation */
}

.time-tabs.sticky {
  display: flex;
  align-items: center;
  padding-left: 1.5rem; /* Match other padding */
  position: sticky;
  background: white;
  z-index: 99;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* Recommendations */
.recommendations {
  padding: 0 1.5rem 2rem;
}

/* Responsive recommendations */
@media (min-width: 768px) {
  .recommendations {
    padding: 0 3rem 3rem;
  }
}

.recommendations-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 1rem;
  text-align: center;
}

.clothing-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.clothing-item {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  cursor: pointer;
}

.clothing-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.clothing-item img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.clothing-item:hover img {
  transform: scale(1.05);
}

.clothing-item-info {
  padding: 1rem;
  text-align: center;
}

.clothing-item-name {
  font-weight: 500;
  color: #374151;
  font-size: 0.9rem;
  line-height: 1.4;
}

/* Error State */
.error-state {
  padding: 4rem 1.5rem;
  text-align: center;
  background: white;
}

.error-content i {
  font-size: 4rem;
  color: #ef4444;
  margin-bottom: 1rem;
}

.error-content h2 {
  color: #111827;
  margin-bottom: 0.5rem;
}

.error-content p {
  color: #6b7280;
  margin-bottom: 2rem;
}

.retry-btn {
  background: #6366f1;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.retry-btn:hover {
  background: #5856eb;
  transform: translateY(-2px);
}

/* Responsive Design */
@media (min-width: 768px) {
  .clothing-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .clothing-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
  }

  .clothing-item img {
    height: 250px;
  }
}

@media (min-width: 1200px) {
  .clothing-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* Animations */
.fade-in {
  animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* PWA Styling */
@media (display-mode: standalone) {
  .header {
    padding-top: calc(1rem + env(safe-area-inset-top));
  }
}

/* Custom scrollbar for webkit browsers */
.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}
