/* ===== CSS Variables ===== */
:root {
  --primary-green: #1E4A3A;
  --light-green: #2D5A4A;
  --accent: #E6A83D;
  --blue: #4A8FA8;
  --light-blue: #5A9FB8;

  --white: #FFFFFF;
  --black: #000000;
  --grey: #6B7280;
  --light-grey: #F3F4F6;
  --dark-grey: #374151;

  --success: #10B981;
  --warning: #F59E0B;
  --error: #EF4444;

  --text-primary: #111827;
  --text-secondary: #6B7280;
  --text-light: #9CA3AF;

  --nav-height: 60px;
  --app-bar-height: 56px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text-primary);
  background-color: var(--light-grey);
  overflow-x: hidden;
}

#app {
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

.screen {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

/* ===== Welcome Screen ===== */
#welcome-screen {
  background-color: var(--primary-green);
  color: var(--white);
  justify-content: space-between;
  padding: 24px;
}

.welcome-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.welcome-content {
  flex: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.logo-container {
  margin-bottom: 24px;
}

.logo-image {
  width: 220px;
  height: 220px;
  object-fit: contain;
  background-color: var(--white);
  border-radius: 110px;
  padding: 20px;
}

.welcome-title-light {
  font-size: 24px;
  font-weight: 300;
  margin-bottom: 8px;
}

.welcome-title-bold {
  font-size: 32px;
  font-weight: bold;
  margin-bottom: 16px;
}

.welcome-subtitle {
  font-size: 16px;
  font-weight: 300;
  opacity: 0.9;
  max-width: 400px;
}

.welcome-actions {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 12px;
}

/* ===== Auth Screens ===== */
.auth-container {
  padding: 24px;
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
}

.back-btn {
  background: none;
  border: none;
  color: var(--primary-green);
  font-size: 16px;
  cursor: pointer;
  padding: 8px 0;
  margin-bottom: 16px;
}

.auth-container h2 {
  font-size: 28px;
  margin-bottom: 24px;
  color: var(--text-primary);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--grey);
  border-radius: 8px;
  font-size: 16px;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-green);
}

.error-message {
  color: var(--error);
  background-color: rgba(239, 68, 68, 0.1);
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

.auth-footer {
  margin-top: 24px;
  text-align: center;
}

.auth-footer a {
  color: var(--primary-green);
  text-decoration: none;
  font-weight: 500;
}

.auth-footer p {
  margin-top: 16px;
  color: var(--text-secondary);
}

/* ===== Buttons ===== */
.btn {
  padding: 16px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}

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

#welcome-screen .btn-primary {
  background-color: var(--white);
  color: var(--primary-green);
}

#main-app .btn-primary,
.auth-container .btn-primary {
  background-color: var(--primary-green);
  color: var(--white);
}

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

#main-app .btn-outline {
  color: var(--primary-green);
  border-color: var(--primary-green);
}

.btn-text {
  background: none;
  color: var(--white);
  text-decoration: underline;
}

.btn-danger {
  background-color: var(--error);
  color: var(--white);
}

.btn-full {
  width: 100%;
}

.btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.icon-btn {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  font-size: 20px;
}

/* ===== Main App Layout ===== */
#main-app {
  display: flex;
  flex-direction: column;
}

.app-bar {
  height: var(--app-bar-height);
  background-color: var(--primary-green);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  z-index: 100;
}

.app-bar h1 {
  font-size: 20px;
  font-weight: 600;
}

.app-bar .icon {
  filter: brightness(0) invert(1);
}

.content-container {
  flex: 1;
  overflow-y: auto;
  position: relative;
  height: calc(100vh - var(--app-bar-height) - var(--nav-height));
}

.view {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  overflow-y: auto;
}

.view.active {
  display: block;
}

/* ===== Bottom Navigation ===== */
.bottom-nav {
  height: var(--nav-height);
  background-color: var(--white);
  display: flex;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--grey);
  transition: color 0.2s;
}

.nav-item.active {
  color: var(--primary-green);
}

.nav-icon {
  font-size: 24px;
}

.nav-label {
  font-size: 12px;
  font-weight: 500;
}

/* ===== Map View ===== */
#map {
  width: 100%;
  height: 100%;
}

.fab {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 28px;
  background-color: var(--primary-green);
  color: var(--white);
  border: none;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.fab:active {
  transform: scale(0.95);
}

/* ===== Filter Section ===== */
.filter-section {
  background-color: var(--light-grey);
  padding: 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.search-box {
  margin-bottom: 12px;
}

.search-box input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--grey);
  border-radius: 8px;
  font-size: 16px;
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary-green);
}

.category-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.category-chips::-webkit-scrollbar {
  height: 4px;
}

.category-chip {
  padding: 8px 16px;
  border: 1px solid var(--grey);
  border-radius: 16px;
  background-color: var(--white);
  cursor: pointer;
  white-space: nowrap;
  font-size: 14px;
  transition: all 0.2s;
}

.category-chip.active {
  background-color: rgba(30, 74, 58, 0.2);
  border-color: var(--primary-green);
  color: var(--primary-green);
}

/* ===== List Container ===== */
.list-container {
  padding: 8px 0;
}

.card {
  background-color: var(--white);
  margin: 8px 16px;
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.2s;
}

.card:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 4px;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--grey);
  font-size: 12px;
  margin-top: 8px;
}

.offer-badge {
  background-color: var(--accent);
  color: var(--white);
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
}

.offers-count {
  color: var(--primary-green);
  font-weight: 500;
}

/* ===== Settings View ===== */
.settings-container {
  padding: 16px;
}

.settings-section {
  background-color: var(--white);
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 16px;
}

.settings-section h3 {
  font-size: 18px;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.setting-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--light-grey);
}

.setting-item:last-child {
  border-bottom: none;
}

.settings-link {
  color: var(--primary-green);
  text-decoration: none;
  font-size: 14px;
  display: inline-block;
  transition: opacity 0.2s;
}

.settings-link:hover {
  opacity: 0.7;
  text-decoration: underline;
}

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  background-color: var(--light-grey);
  color: var(--text-secondary);
}

.status-badge.premium {
  background-color: var(--accent);
  color: var(--white);
}

/* ===== Modal ===== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-content {
  background-color: var(--white);
  border-radius: 12px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  padding: 24px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 32px;
  cursor: pointer;
  color: var(--grey);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.modal-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 16px;
}

.modal h2 {
  font-size: 24px;
  margin-bottom: 16px;
}

.modal-section {
  margin-bottom: 16px;
}

.modal-section h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.modal-section p {
  color: var(--text-primary);
  line-height: 1.5;
}

/* ===== Loading & Feedback ===== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

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

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

.snackbar {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--dark-grey);
  color: var(--white);
  padding: 12px 24px;
  border-radius: 8px;
  z-index: 1500;
  animation: slideUp 0.3s ease;
}

.snackbar.success {
  background-color: var(--success);
}

.snackbar.error {
  background-color: var(--error);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-secondary);
}

.empty-state .icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* ===== Responsive Design ===== */

/* Tablet */
@media (min-width: 768px) {
  .welcome-title-bold {
    font-size: 40px;
  }

  .welcome-subtitle {
    font-size: 18px;
  }

  .auth-container {
    padding: 48px;
  }

  .list-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 16px;
  }

  .card {
    margin: 0;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .bottom-nav {
    justify-content: center;
    gap: 8px;
    padding: 0 24px;
  }

  .nav-item {
    flex: 0 0 auto;
    min-width: 120px;
    padding: 12px 24px;
  }

  .list-container {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1440px) {
  .list-container {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Subscription Modal Styling */
.subscription-container {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

.subscription-container h2 {
  color: var(--primary-green);
  margin-bottom: 8px;
}

.subscription-container > p {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.edition-group {
  margin-bottom: 32px;
}

.edition-group h3 {
  color: var(--text-primary);
  margin-bottom: 16px;
  font-size: 20px;
}

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

.tier-card {
  background: white;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  text-align: left;
  transition: all 0.3s ease;
}

.tier-card:hover {
  border-color: var(--primary-green);
  box-shadow: 0 4px 12px rgba(30, 74, 58, 0.1);
  transform: translateY(-2px);
}

.tier-card-vip {
  border-color: var(--accent-gold);
  background: linear-gradient(135deg, #fff9e6 0%, #ffffff 100%);
}

.tier-card-vip:hover {
  border-color: var(--accent-gold);
  box-shadow: 0 4px 16px rgba(230, 168, 61, 0.2);
}

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

.tier-header h4 {
  font-size: 18px;
  color: var(--text-primary);
  margin: 0;
}

.tier-badge {
  background: var(--accent-gold);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tier-badge-upgrade {
  background: var(--primary-green);
  color: white;
}

.tier-card-upgrade {
  border-color: var(--primary-green);
  background: linear-gradient(135deg, #e8f5f1 0%, #ffffff 100%);
}

.tier-card-upgrade:hover {
  border-color: var(--primary-green);
  box-shadow: 0 4px 16px rgba(30, 74, 58, 0.3);
}

.current-plan-banner {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  color: #0c4a6e;
  font-size: 14px;
}

.current-plan-info {
  text-align: center;
  padding: 40px 20px;
  background: linear-gradient(135deg, #e8f5f1 0%, #ffffff 100%);
  border-radius: 12px;
  border: 2px solid var(--primary-green);
}

.current-plan-info .info-icon {
  width: 60px;
  height: 60px;
  background: var(--primary-green);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 16px auto;
}

.current-plan-info h3 {
  color: var(--primary-green);
  margin-bottom: 12px;
}

.current-plan-info p {
  color: var(--text-secondary);
  line-height: 1.6;
}

.tier-price {
  margin-bottom: 16px;
}

.price-amount {
  font-size: 36px;
  font-weight: 700;
  color: var(--primary-green);
}

.price-currency {
  font-size: 14px;
  color: var(--text-secondary);
  margin-left: 4px;
  text-transform: uppercase;
}

.tier-description {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 20px;
  min-height: 60px;
}

.subscription-footer {
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
  margin-top: 24px;
}

#subscription-loading {
  text-align: center;
  padding: 40px 20px;
}

#subscription-loading .spinner {
  margin: 0 auto 16px auto;
}

#subscription-loading p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Redemption Modals */
.redemption-container {
  text-align: center;
  padding: 20px;
}

.redemption-code-input {
  width: 200px;
  height: 80px;
  font-size: 48px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 16px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  margin: 0 auto 24px auto;
  display: block;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.redemption-code-input:focus {
  outline: none;
  border-color: var(--primary-green);
  box-shadow: 0 0 0 3px rgba(30, 74, 58, 0.1);
}

.redemption-success-content {
  background: var(--primary-green) !important;
  text-align: center;
  padding: 60px 40px;
  border-radius: 16px;
}

.redemption-success-checkmark {
  width: 120px;
  height: 120px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

/* Redemption History Styles */
.redemption-history-item {
  background: var(--white);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid #E5E7EB;
}

.redemption-history-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.redemption-history-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.redemption-history-business {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
}

.redemption-history-date {
  font-size: 12px;
  color: var(--text-light);
  margin: 0;
  margin-top: 4px;
}

/* ===== Launch Announcement Banner ===== */
.launch-banner {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 1000;
  background: linear-gradient(135deg, #f97316 0%, #f59e0b 100%);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: slideDown 0.3s ease-out;
}

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

.banner-content {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
}

.banner-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  flex-shrink: 0;
}

.banner-icon span {
  font-size: 24px;
}

.banner-text {
  flex: 1;
  color: white;
}

.banner-title {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 4px;
}

.banner-message {
  font-size: 14px;
  opacity: 0.95;
  line-height: 1.4;
}

.banner-close {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  margin: -4px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.2s;
  flex-shrink: 0;
}

.banner-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.banner-close:active {
  background: rgba(255, 255, 255, 0.3);
}
