/* ===== CSS VARIABLES & BASE ===== */

:root {
  /* Brand – green-based palette */
  --primary-color: #004619;
  --secondary-color: #008d2a;
  --accent-color: #00b53a;
  --accent-secondary: #00a133;

  --background-color: #f4f8f4;
  --card-background: #ffffff;
  --card-tint: #e9fce9;

  --text-color: #102418;

  --border-radius-lg: 12px;
  --border-radius-md: 8px;
  --shadow-soft: 0 10px 25px rgba(0, 0, 0, 0.06);
  --shadow-subtle: 0 2px 8px rgba(0, 0, 0, 0.04);
  --max-width: 960px;
  --transition-fast: 0.18s ease-out;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: "Quicksand", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  color: var(--text-color);
  background-color: var(--background-color);
}

/* Headings & logo text use Bree Serif */
h1,
h2,
h3,
h4,
.brand-text {
  font-family: "Bree Serif", Georgia, "Times New Roman", serif;
}

/* ===== LAYOUT ===== */

.main {
  min-height: calc(100vh - 56px - 56px); /* header + footer */
  padding: 1.5rem 1rem 2rem;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
}

/* ===== TOP NAV ===== */

.top-nav {
  background-color: #ffffff;
  color: var(--primary-color);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #d6e3d6;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;          /* space between pill and button */
}

/* On small screens, hide the header CTA to avoid crowding */
@media (max-width: 640px) {
  .nav-create-btn {
    display: none;
  }
}



.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  color: inherit;
}

.brand-logo {
  width: 28px;
  height: 28px;
  display: block;
}

.brand-text {
  font-size: 1.1rem;
  letter-spacing: 0.06em;
  text-transform: lowercase;
}

.code-pill {
  padding: 0.25rem 0.9rem;
  border-radius: 999px;
  background-color: rgba(0, 141, 42, 0.08);
  border: 1px solid rgba(0, 141, 42, 0.4);
  font-size: 0.85rem;
  white-space: nowrap;
  color: var(--secondary-color);
}

.code-pill--hidden {
  visibility: hidden;
}


.code-pill-content {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.code-pill-icon {
  width: 14px;
  height: 14px;
  display: block;
}


/* ===== TYPOGRAPHY ===== */

h1 {
  font-size: 1.9rem;
  line-height: 1.2;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

h2.section-heading {
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--secondary-color);
  margin: 2rem 0 0.75rem;
}

p.bundle-description {
  color: #4b5b4b;
  margin-bottom: 1.5rem;
}

/* ===== HOME – SINGLE CARD WITH TABS ===== */

.home-layout {
  max-width: 1040px;
  margin: 2.5rem auto 0;
  padding: 0 0.5rem;
}

.home-card {
  background: var(--card-tint);
  border-radius: 24px;
  box-shadow: var(--shadow-soft);
  padding: 1.5rem 1.5rem 1.75rem;
}

.home-tabs {
  display: flex;
  flex-wrap: wrap;          /* ⬅ allow multiple rows */
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.home-tab {
  flex: 1 1 45%;            /* ⬅ roughly 2 per row on small screens */
  border: none;
  padding: 0.55rem 1.2rem;
  font: inherit;
  cursor: pointer;
  border-radius: 999px;
  background-color: #d8e5d8;
  color: #355335;
  transition: background-color 0.18s ease-out,
              color 0.18s ease-out,
              box-shadow 0.18s ease-out,
              transform 0.18s ease-out;
}

@media (max-width: 600px) {
  .home-tab {
    flex: 1 1 45%;
  }
}


.home-tab.is-active {
  background-color: #ffffff;
  color: var(--secondary-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.home-tabpanels {
  display: grid;
}

.home-panel {
  display: none;
}

.home-panel.is-active {
  display: block;
}

.home-panel h1 {
  margin-bottom: 0.75rem;
}

.home-panel p {
  font-size: 0.97rem;
  color: #435543;
  margin-bottom: 1rem;
}

.home-panel h3 {
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
}

.home-panel ul {
  padding-left: 1.1rem;
  margin-bottom: 0.75rem;
  font-size: 0.97rem;
  color: #435543;
}

.home-panel li + li {
  margin-top: 0.25rem;
}

/* Reuse existing inline form styling for the search section */
.form-inline {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

/* ===== SEARCH FIELD + AUTOCOMPLETE ===== */

.search-input-wrapper {
  position: relative;
  flex: 1 1 auto;
}

.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.25rem;
  background-color: #ffffff;
  border-radius: var(--border-radius-md);
  border: 1px solid #c7d8c7;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.12);
  max-height: 260px;
  overflow-y: auto;
  z-index: 35;
  display: none;
}

.search-suggestions.is-visible {
  display: block;
}

.search-suggestion {
  padding: 0.4rem 0.65rem;
  cursor: pointer;
  border-bottom: 1px solid #edf5ed;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.search-suggestion:last-child {
  border-bottom: none;
}

.search-suggestion:hover {
  background-color: #f5fbf5;
}

.search-suggestion-slug {
  font-size: 0.85rem;
  font-weight: 600;
  color: #314731;
}

.search-suggestion-name {
  font-size: 0.8rem;
  color: #6a7b6a;
}

/* ===== RECENTLY ADDED CODES ===== */

.home-recent-codes {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #dde8dd;
}

.home-recent-header {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6a7b6a;
  margin-bottom: 0.5rem;
}

.home-recent-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.home-recent-item {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.home-recent-link {
  padding: 0;
  border: none;
  background: none;
  color: var(--secondary-color);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.home-recent-name {
  font-size: 0.8rem;
  color: #435543;
}


/* ===== EDIT CODE FLOW ===== */

.edit-step {
  margin-top: 1.2rem;
  padding-top: 0.9rem;
  border-top: 1px solid #dde8dd;
}

.edit-step-title {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6a7b6a;
  margin-bottom: 0.6rem;
}

.edit-step--hidden {
  display: none;
}



/* ===== CREATE CODE FORM ===== */

.create-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  margin-top: 1rem;
  max-width: 720px;
}

.create-form .form-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
}

.create-form .form-field label {
  font-weight: 600;
  color: #314731;
}

.create-form .form-field small {
  color: #6a7b6a;
  font-size: 0.8rem;
}

/* Label row + tooltip */
.form-field-label-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.field-tooltip {
  position: relative;
  border: 1px solid #c7d8c7;
  background: #f5fbf5;
  cursor: pointer;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #314731;
  padding: 0;
}

.field-tooltip:focus {
  outline: 2px solid var(--secondary-color);
  outline-offset: 2px;
}

.field-tooltip-content {
  position: absolute;
  bottom: calc(100% + 0.45rem);
  left: 50%;
  transform: translateX(-50%);
  background-color: #ffffff;
  border-radius: var(--border-radius-md);
  border: 1px solid #c7d8c7;
  padding: 0.55rem 0.75rem;
  font-size: 0.8rem;
  color: #314731;
  width: 260px;
  max-width: 70vw;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 20;
}

.field-tooltip:hover .field-tooltip-content,
.field-tooltip:focus .field-tooltip-content {
  opacity: 1;
  pointer-events: auto;
}

.create-form input[type="email"],
.create-form textarea {
  font: inherit;
  padding: 0.55rem 0.75rem;
  border-radius: var(--border-radius-md);
  border: 1px solid #c7d8c7;
  background-color: #ffffff;
  color: var(--text-color);
  min-width: 0;
}

.create-form input[type="email"]:focus,
.create-form textarea:focus {
  outline: none;
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 1px rgba(0, 141, 42, 0.2);
}

.create-form textarea {
  resize: vertical;
  min-height: 70px;
}

/* Checkbox-style row (still used for some fields if needed) */
.create-form .form-field--inline {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

/* Visibility toggle */
.visibility-toggle-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.visibility-label-text {
  font-weight: 600;
  color: #314731;
}

.visibility-mode-label {
  font-size: 0.85rem;
  color: #314731;
  min-width: 3.4rem;
}

/* Switch styling */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #d0e2d0;
  border-radius: 999px;
  transition: 0.2s;
}

.switch-slider::before {
  content: "";
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background-color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: 0.2s;
}

.switch input:checked + .switch-slider {
  background-color: var(--secondary-color);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(18px);
}

/* Address rows */
.address-rows-header {
  font-size: 0.9rem;
  font-weight: 600;
  color: #314731;
  margin-top: 0.5rem;
}

.address-rows-sub {
  font-size: 0.8rem;
  color: #6a7b6a;
  margin-bottom: 0.4rem;
}

.address-rows {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.address-row {
  padding: 0.75rem 0.8rem;
  border-radius: var(--border-radius-md);
  border: 1px dashed #c7d8c7;
  background-color: #f5fbf5;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  grid-template-rows: auto auto auto;
  gap: 0.45rem 0.5rem;
}

.address-row input[type="text"] {
  width: 100%;
}

.address-row-notes {
  grid-column: 1 / -1;
}

.address-row-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
}

.address-row-remove {
  font-size: 0.8rem;
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

/* Add-address button */
.add-address-btn {
  margin-top: 0.35rem;
  align-self: flex-start;
}

/* Form footer / messages */
.create-form-footer {
  margin-top: 0.5rem;
}

.create-form-message {
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

.create-form-message--error {
  color: #a32020;
}

.create-form-message--success {
  color: #0b6b2a;
}

.create-form-fineprint {
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: #6a7b6a;
}



/* ===== HOME & NOT-FOUND / ERROR STATES (legacy card) ===== */

.centered {
  max-width: 420px;
  margin: 3rem auto 0;
  text-align: center;
  padding: 2rem 1.75rem;
  background-color: var(--card-background);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-soft);
}

.centered h1 {
  margin-bottom: 0.5rem;
}

.centered p {
  font-size: 0.97rem;
  color: #435543;
  margin-bottom: 1.5rem;
}

.centered small {
  display: block;
  margin-top: 0.5rem;
  color: #6a7b6a;
}

/* ===== INPUTS & BUTTONS ===== */

input[type="text"] {
  font: inherit;
  padding: 0.55rem 0.75rem;
  border-radius: var(--border-radius-md);
  border: 1px solid #c7d8c7;
  background-color: #ffffff;
  color: var(--text-color);
  min-width: 0;
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 1px rgba(0, 141, 42, 0.2);
}

.btn {
  font: inherit;
  border-radius: 999px;
  border: none;
  padding: 0.55rem 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  white-space: nowrap;
  transition: background-color var(--transition-fast),
    transform var(--transition-fast), box-shadow var(--transition-fast),
    border-color var(--transition-fast), color var(--transition-fast);
}

.btn-primary {
  background-color: var(--accent-color);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 181, 58, 0.4);
  border: 1px solid var(--accent-secondary);
}

.btn-primary:hover {
  background-color: var(--accent-secondary);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 161, 51, 0.4);
}

.btn-secondary {
  background-color: transparent;
  color: var(--secondary-color);
  border: 1px dashed #b7cab7;
}

.btn-secondary:hover {
  background-color: rgba(0, 141, 42, 0.06);
  border-style: solid;
}

/* Full-width primary button at bottom */
.save-addister-btn {
  margin-top: 1.5rem;
  width: 100%;
  font-weight: 600;
}

/* ===== BUNDLE LAYOUT ===== */

.bundle-wrapper {
  max-width: var(--max-width);
  margin: 1.5rem auto 0;
}

.bundle-header {
  padding: 1.25rem 1.25rem 1.5rem;
  background-color: var(--card-background);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-soft);
  border: 1px solid #d7e4d7;
}

.badge-subtle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background-color: rgba(0, 141, 42, 0.06);
  color: #435543;
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 0.65rem;
}

.bundle-share {
  margin-top: 0.35rem;
  font-size: 0.95rem;
}

.bundle-cta-inline {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: #215434; /* softer green text */
}

.bundle-cta-link {
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

/* ===== ADDRESS CARDS ===== */

.card-list {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.address-card {
  background-color: var(--card-background);
  border-radius: var(--border-radius-lg);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-subtle);
  border: 1px solid #d7e4d7;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.address-main {
  flex: 1;
}

.location-label {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--secondary-color);
  margin-bottom: 0.3rem;
}

.address-text {
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 0.25rem;
}

.address-notes {
  font-size: 0.9rem;
  color: #515f51;
}

.address-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ===== POWERED BAND ===== */

.powered-band {
  margin-top: 1.5rem;
  padding: 0.7rem 1rem;
  border-radius: var(--border-radius-lg);
  background: linear-gradient(
    135deg,
    rgba(0, 94, 31, 0.98),
    rgba(0, 63, 21, 0.98)
  );
  color: #ffffff;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  box-shadow: var(--shadow-soft);
}

.powered-band span {
  opacity: 0.96;
}

.powered-badge {
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background-color: rgba(232, 255, 237, 0.12);
  border: 1px solid rgba(232, 255, 237, 0.9);
  font-size: 0.75rem;
}

/* ===== STATUS / ERROR MESSAGES ===== */

.status {
  max-width: 420px;
  margin: 2.5rem auto 0;
  text-align: center;
  color: #4b5b4b;
}

.status span.loader {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  border: 2px solid rgba(0, 141, 42, 0.15);
  border-top-color: var(--secondary-color);
  animation: spin 0.7s linear infinite;
  margin-right: 0.4rem;
  vertical-align: middle;
}

/* ===== FOOTER ===== */

.site-footer {
  height: 56px;
  background-color: #ffffff;
  border-top: 1px solid #d6e3d6;
  display: flex;
  align-items: center;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: #6a7b6a;
}

.footer-note {
  opacity: 0.9;
}

/* ===== FLOATING SEARCH BUTTON ===== */

.search-fab {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  padding: 0.7rem 1.1rem;
  background-color: #e7fbe7;
  color: var(--secondary-color);
  border-radius: 999px;
  border: 1px solid #c5dec5;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: transform var(--transition-fast),
    box-shadow var(--transition-fast), background-color var(--transition-fast),
    color var(--transition-fast);
}

.search-fab:hover {
  transform: translateY(-1px);
  color: #ffffff;
  background-color: var(--secondary-color);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.search-fab--hidden {
  display: none;
}

/* ===== SEARCH MODAL ===== */

.search-modal {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-modal--hidden {
  display: none;
}

.search-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
}

.search-modal-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  margin: 1rem;
  padding: 1.5rem 1.5rem 1.25rem;
  background-color: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.35);
}

.search-modal-panel h2 {
  font-size: 1.15rem;
  color: var(--primary-color);
  margin-bottom: 0.35rem;
}

.search-modal-description {
  font-size: 0.92rem;
  color: #435543;
  margin-bottom: 1rem;
}

.search-modal-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.search-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* ===== RESPONSIVE ===== */

@media (min-width: 640px) {
  .main {
    padding: 2rem 1.5rem 2.5rem;
  }

  .bundle-header {
    padding: 1.5rem 1.75rem 1.75rem;
  }

  .address-card {
    padding: 1.1rem 1.3rem;
    flex-direction: row;
    align-items: center;
  }

  .address-actions {
    justify-content: flex-end;
    min-width: 230px;
  }

  .home-card {
    padding: 1.75rem 2rem 2rem;
  }
}

/* ===== UTILITIES ===== */

.visually-hidden {
  position: absolute;
  inset: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* ===== ANIMATIONS ===== */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}


