/* CSS RESET & VARIABLES */
:root {
  /* Modern Palette */
  --primary-gradient: linear-gradient(135deg, #2e7d32 0%, #00c853 100%);
  --surface-dark: #121212;
  --surface-card: rgba(30, 30, 30, 0.7);
  --surface-card-hover: rgba(50, 50, 50, 0.8);
  --border-color: rgba(255, 255, 255, 0.1);

  /* Status Colors */
  --status-garbage: #ef5350;
  --status-recycle: #42a5f5;
  --status-yard: #8d6e63;
  --status-special: #ffa726;

  /* Text */
  --text-primary: #ffffff;
  --text-secondary: #b0bec5;
  --text-muted: #78909c;

  /* Dimensions */
  --radius-lg: 16px;
  --radius-pill: 50px;
  --header-height: 70px;
}

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

body {
  font-family: "Inter", sans-serif;
  background-color: var(--surface-dark);
  background-image: radial-gradient(at 0% 0%, rgba(46, 125, 50, 0.15) 0px, transparent 50%), radial-gradient(at 100% 100%, rgba(66, 165, 245, 0.1) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  background: rgba(18, 18, 18, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  width: 100%;
  display: flex;
  justify-content: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 1.8rem;
  filter: drop-shadow(0 0 5px rgba(0, 200, 83, 0.5));
}

h1 {
  font-family: "Poppins", sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.5px;
  background: white;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* LAYOUT & CONTAINER */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.app-main {
  padding: 40px 0;
  flex: 1;
  display: flex;
}

/* The Main Card */
.main-card {
  background: var(--surface-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  /* Contains children */

  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-title {
  font-family: "Poppins", sans-serif;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  /* margin: 30px 0 15px 0; */
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 5px;
}

/* SUBSECTION CONTAINER (Groups Saved & Results) */
.content-grid {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 100%;

  /* Visual Distinctness */
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 25px;
}

.search-section {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 100%;

  /* Visual Distinctness */
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 25px;
}

.results-column {
  display: flex;
  flex-direction: column;
  width: 100%;
}

@media (max-width: 768px) {
  .content-grid {
    padding: 15px;
    gap: 20px;
  }
}

/* ACTION BUTTONS (Top Row) */
.action-buttons {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

#notificationButton,
#installButton {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.3s ease;
  cursor: pointer;
}

#notificationButton:hover,
#installButton:hover {
  background: rgba(255, 255, 255, 0.2);
}

#notificationButton.notification-enabled,
#installButton.app-installed {
  background: rgba(0, 200, 83, 0.2);
  color: #69f0ae;
  border-color: rgba(0, 200, 83, 0.4);
}

/* FAVORITES SECTION */
#favAddressButtons {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fav-item {
  display: flex;
  align-items: stretch;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.2s;
  border: 1px solid transparent;
}

.fav-item:hover {
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.06);
}

.address-btn {
  flex: 1;
  background: transparent;
  color: var(--text-primary);
  border: none;
  padding: 15px 20px;
  text-align: left;
  font-size: 1rem;
  cursor: pointer;
  font-family: "Inter", sans-serif;
}

.delete-btn {
  background: transparent;
  width: 50px;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: bold;
  font-size: 1.1rem;
  transition:
    color 0.2s,
    background 0.2s;
}

.delete-btn:hover {
  background: rgba(239, 83, 80, 0.2);
  color: #ef5350;
}

.fav-message {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  padding: 20px;
}

/* SEARCH INPUT */
.input-group {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.search-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 1rem;
  font-family: "Inter", sans-serif;
  transition: border-color 0.3s;
}

.search-input:focus {
  outline: none;
  border-color: #00c853;
}

.search-button {
  background: var(--primary-gradient);
  color: white;
  border: none;
  padding: 12px 25px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.3s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-button:hover {
  filter: brightness(1.1);
}

/* DROPDOWN RESULTS */
.address-dropdown {
  list-style: none;
  margin-top: 10px;
  background: #1e1e1e;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  max-height: 250px;
  overflow-y: auto;
}

.address-dropdown li button {
  width: 100%;
  text-align: left;
  padding: 12px 20px;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: background 0.2s;
}

.address-dropdown::-webkit-scrollbar {
  width: 0.5rem;
}

.address-dropdown::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
}

.address-dropdown::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  border: 1px solid #1e1e1e;
}

.address-dropdown::-webkit-scrollbar-thumb:hover {
  background: var(--surface-card-hover);
}

.address-dropdown li button:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

/* COLLECTION CARDS (The Results) */
.pickup-dates {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

.pickup-dates h3 {
  grid-column: 1 / -1;
  font-family: "Poppins", sans-serif;
  /* margin-bottom: 10px; */
}

/* Collection Item Layout */
.collection-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  display: flex;
  gap: 4px;
  justify-content: space-around;
}

/* Colored accent bars on the left */
.collection-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}

.collection-item.garbage::before {
  background: var(--status-garbage);
  box-shadow: 0 0 10px var(--status-garbage);
}

.collection-item.recycle::before {
  background: var(--status-recycle);
  box-shadow: 0 0 10px var(--status-recycle);
}

.collection-item.yard::before {
  background: var(--status-yard);
  box-shadow: 0 0 10px var(--status-yard);
}

.collection-item.special::before {
  background: var(--status-special);
  box-shadow: 0 0 10px var(--status-special);
}

.collection-item h4 {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.collection-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.collection-label {
  font-family: "Poppins", sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.collection-date {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-primary);
}

/* Right Side: Days Badge */
.days-badge {
  background: rgba(255, 255, 255, 0.08);
  color: #69f0ae;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 10px 15px;
  min-width: 90px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  font-size: 1.1rem;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2);
}

/* Badge Text Colors */
.today {
  color: var(--status-garbage);
  animation: pulse 2s infinite;
}
.tomorrow {
  color: var(--status-special);
}
.days {
  color: #69f0ae;
}

@keyframes pulse {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }

  100% {
    opacity: 1;
  }
}

/* SAVE BUTTON WRAPPER */
.save-container {
  margin-top: 30px;
  display: flex;
  justify-content: center;
}

.save-button {
  background: #6200ea;
  /* Deep Purple */
  background: linear-gradient(135deg, #651fff 0%, #4615b2 100%);
  color: white;
  border: none;
  padding: 12px 30px;
  border-radius: var(--radius-pill);
  font-size: 1rem;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(101, 31, 255, 0.4);
  cursor: pointer;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

.save-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(101, 31, 255, 0.6);
}

.save-button:disabled {
  background: #424242;
  box-shadow: none;
  cursor: default;
  transform: none;
}

/* UTILITIES & FOOTER */
#connectionStatus {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  backdrop-filter: blur(5px);
  z-index: 200;
  top: auto;
  /* Override old CSS */
}

.online-status {
  background: rgba(0, 200, 83, 0.8);
  color: white;
}

.offline-status {
  background: rgba(211, 47, 47, 0.8);
  color: white;
}

.loading-spinner {
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top: 3px solid #00c853;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  margin: 30px auto;
  animation: spin 1s linear infinite;
}

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

  100% {
    transform: rotate(360deg);
  }
}

.app-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 20px;
}

/* Mobile Tweak */
@media (max-width: 600px) {
  .app-main {
    padding: 15px 0;
  }

  .main-card {
    padding: 20px;
    border-radius: 0;
    border: none;
    background: transparent;
    box-shadow: none;
  }

  .fav-item {
    flex-direction: row;
  }

  .input-group {
    flex-direction: column;
  }

  .search-button {
    justify-content: center;
    padding: 14px;
  }

  #connectionStatus {
    top: 10px;
    bottom: auto;
    right: 10px;
    font-size: 0.75rem;
  }
}
