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

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  background: #f5f5f5;
  color: #333;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

[hidden] {
  display: none !important;
}

/* ---- Header ---- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: #1a1a2e;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.header__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
}

.header__accent {
  color: #e2a84b;
}

.header__nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header__nav .btn--outline {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
  box-shadow: none;
}

.header__nav .btn--outline:hover:not(:disabled) {
  background: #ffffff;
  color: #1a1a2e;
  border-color: #ffffff;
  transform: translateY(-2px);
}

.header__email {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.7);
  margin-right: 0.25rem;
}

/* ---- Main ---- */
.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
  flex: 1;
  width: 100%;
}

/* ---- Controls ---- */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.controls .input {
  flex: 1 1 200px;
}

.controls .select {
  flex: 0 1 180px;
}

/* ---- Results Bar ---- */
.results-bar {
  margin-bottom: 1rem;
}

.results-count {
  font-size: 0.85rem;
  color: #888;
  font-weight: 500;
}

/* ---- Inputs / Selects / Buttons ---- */
.input,
.select {
  padding: 0.5rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.875rem;
  background: #fff;
}

.input:focus,
.select:focus {
  outline: none;
  border-color: #4a90d9;
  box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.25);
}

textarea.input {
  resize: vertical;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.4rem;
  border: none;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  min-width: 6rem;
  width: auto;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  gap: 0.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(1);
}

.btn--primary {
  background: linear-gradient(135deg, #4a90d9 0%, #357abd 100%);
  color: #fff;
}

.btn--primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(74, 144, 217, 0.3);
  filter: brightness(1.1);
}

.btn--outline {
  background: #fff;
  border: 1.5px solid #e5e7eb;
  color: #4b5563;
}

.btn--outline:hover:not(:disabled) {
  background: #f9fafb;
  border-color: #4a90d9;
  color: #4a90d9;
  transform: translateY(-2px);
}

.btn--danger {
  background: #fee2e2;
  color: #dc2626;
}

.btn--danger:hover:not(:disabled) {
  background: #dc2626;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(220, 38, 38, 0.2);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
  filter: brightness(0.9);
}

.btn--small {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
}

/* ---- Store Grid ---- */
.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 2rem;
  transition: opacity 0.2s ease;
  min-height: 748px;
  align-content: start;
}

.store-grid--loading {
  opacity: 0.4;
  pointer-events: none;
}

.store-grid__empty {
  grid-column: 1 / -1;
  text-align: center;
  color: #888;
  padding: 3rem 0;
}

/* ---- Card ---- */
.card {
  background: #fff;
  border: none;
  border-left: 5px solid #e2a84b;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  padding: 1.5rem;
  height: auto;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
  animation: card-in 0.3s ease both;
}

.card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  transform: translateY(-5px);
  border-left-color: #4a90d9;
}

.card__name {
  color: #2c3e50;
  font-size: 1.2rem;
  margin-bottom: 0.25rem;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card__district-badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--badge-bg, #fef3e2);
  color: var(--badge-fg, #92600a);
}

.card__url {
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card__url a {
  color: #666;
  text-decoration: none;
}

.card__url a:hover {
  color: #333;
  text-decoration: underline;
}

.card__actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.5rem;
}

/* ---- Pagination ---- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.pagination__info {
  font-size: 0.9rem;
  font-weight: 600;
  color: #6b7280;
  background: #f3f4f6;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  min-width: auto;
}

.pagination-limit {
  display: flex;
  justify-content: center;
  margin-top: 0.5rem;
}

/* ---- Footer ---- */
.footer {
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: 0.8rem;
  color: #999;
  border-top: 1px solid #e0e0e0;
  margin-top: 2rem;
}

/* ---- Modals ---- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal[hidden] {
  display: none;
}

.modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.modal__box {
  position: relative;
  background: #fff;
  border-radius: 10px;
  padding: 1.5rem;
  width: 90%;
  max-width: 440px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.modal__box h2 {
  margin-bottom: 1rem;
  font-size: 1.15rem;
}

.modal__actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
}

.field span {
  font-size: 0.85rem;
  font-weight: 500;
}

.field .input {
  width: 100%;
}

/* ---- Toasts ---- */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.5rem;
  z-index: 200;
}

.toast {
  padding: 0.75rem 1.25rem;
  border-radius: 6px;
  color: #fff;
  font-size: 0.875rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  animation: toast-in 0.25s ease;
  max-width: 360px;
}

.toast--success {
  background: #28a745;
}

.toast--error {
  background: #d9534f;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .header {
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
  }

  .controls {
    flex-direction: column;
  }

  .controls .input,
  .controls .select {
    flex: 1 1 auto;
  }

  .store-grid {
    grid-template-columns: 1fr;
    min-height: auto;
  }
}
