/* =======================================================================
   NeuroMoney unified theme (static site + web app)
   - Header + footer match the marketing site
   - Auth (login/signup) uses the same card + form layout
   - Dark mode continues to work via body.dark-mode
   ======================================================================= */

:root {
  --bg: #f3f4f6;
  --bg-alt: #e5e7eb;
  --text: #111827;
  --muted: #353c46;
  --accent: #16a34a;
  --accent-hover: #15803d;
  --border: #e5e7eb;
  --card-bg: #ffffff;
  --input-bg: #f9fafb;
  --input-border: #d1d5db;
  --error: #b91c1c;

  --brand-blue: #1D5074;

  /* Select chevron icon (overridden in dark mode) */
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M6 8l4 4 4-4' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at top, #e5f3ff 0, var(--bg) 55%, var(--bg-alt) 100%);
}

/* Dark mode uses CSS variables so header/footer + auth pages update automatically */
body.dark-mode {
  --bg: #0b1220;
  --bg-alt: #111827;
  --text: #e5e7eb;
  --muted: #cbd5e1;
  --border: rgba(148, 163, 184, 0.22);
  --card-bg: rgba(17, 24, 39, 0.92);
  --input-bg: rgba(15, 23, 42, 0.8);
  --input-border: rgba(148, 163, 184, 0.35);
  --error: #fca5a5;

  /* Select chevron icon for dark mode */
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M6 8l4 4 4-4' stroke='%23e5e7eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");

  background: radial-gradient(circle at top, #0b2540 0, var(--bg) 55%, var(--bg-alt) 100%);
}

header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.04);
}

body.dark-mode header {
  background: rgba(17, 24, 39, 0.92);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.site-logo {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.site-logo .site-logo-text {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 1.5rem;
  color: var(--brand-blue);
  line-height: 1;
}

.site-logo .site-logo-text span { color: var(--accent); }

.main-nav {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  white-space: nowrap;
}

.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--accent-hover);
  text-decoration: underline;
}

.nav-link.active {
  color: var(--brand-blue);
  text-decoration: none;
}

.nav-separator { color: var(--muted); font-size: 0.85rem; }

main {
  flex: 1;
  padding: 8px 20px 20px;
}

/* Footer matches the static site */
footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  text-align: center;
  padding: 1rem 1.5rem 1.75rem;
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: rgba(249, 250, 251, 0.92);
}

body.dark-mode footer { background: rgba(15, 23, 42, 0.92); }

footer a {
  color: var(--brand-blue);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

footer a:hover { color: var(--accent-hover); text-decoration: underline; }

.footer-separator { color: var(--muted); }

.footer-note {
  font-size: 0.75rem;
  color: #6b7280;
  margin-left: 0.4rem;
}

body.dark-mode .footer-note { color: rgba(226, 232, 240, 0.78); }

@media (max-width: 640px) {
  .header-inner {
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .main-nav { font-size: 0.82rem; }

  footer { flex-wrap: wrap; }
}

/* Pills (used on auth cards too) */
.pill {
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background-color: rgba(255, 255, 255, 0.7);
  display: inline-flex;
  align-items: center;
  width: fit-content;
}

.pill--green {
  border-color: rgba(34, 197, 94, 0.4);
  color: var(--accent);
  background-color: rgba(240, 253, 244, 0.9);
}

body.dark-mode .pill { background-color: rgba(15, 23, 42, 0.55); }
body.dark-mode .pill--green { background-color: rgba(20, 83, 45, 0.25); }

/* =======================================================================
   Auth (Login / Sign up)
   ======================================================================= */

.auth-section {
  display: flex;
  justify-content: center;
  padding: 2.5rem 1.5rem 3rem;
}

.auth-shell { width: 100%; max-width: 520px; }

.auth-card {
  background: var(--card-bg);
  border-radius: 1.25rem;
  padding: 1.75rem 1.75rem 1.5rem;
  border: 1px solid rgba(209, 213, 219, 0.9);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

body.dark-mode .auth-card {
  border-color: rgba(148, 163, 184, 0.22);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
}

.auth-card h2 {
  margin: 0.75rem 0 0.25rem;
  font-size: 1.35rem;
  color: var(--text);
}

.auth-card p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.auth-form {
  margin-top: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.auth-form .field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.auth-form label {
  margin: 0;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}

.auth-form input,
.auth-form select {
  padding: 0.8rem 0.9rem;
  border-radius: 0.75rem;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.auth-form input::placeholder { color: #9ca3af; }

.auth-form input:focus,
.auth-form select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.35);
  background: #ffffff;
}

body.dark-mode .auth-form input:focus,
body.dark-mode .auth-form select:focus {
  background: rgba(15, 23, 42, 0.95);
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.2rem;
}

.btn {
  padding: 0.8rem 1.2rem;
  border-radius: 0.75rem;
  border: none;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.1s ease, border-color 0.15s ease;
}

.btn-primary {
  background: var(--brand-blue);
  color: #f9fafb;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(16, 185, 129, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.25);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.92);
  color: var(--brand-blue);
  border: 1px solid rgba(209, 213, 219, 0.9);
}

body.dark-mode .btn-secondary {
  background: rgba(15, 23, 42, 0.7);
  border-color: rgba(148, 163, 184, 0.25);
  color: var(--text);
}

.btn-secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
}

.status {
  font-size: 0.9rem;
  margin-top: 0.2rem;
  min-height: 1.2em;
  color: var(--error);
}

/* =======================================================================
   General form defaults for the rest of the app (keeps behaviour unchanged)
   ======================================================================= */

#new-product-form,
#new-subscription-form,
#new-bill-form,
#edit-profile-form {
  display: flex;
  flex-direction: column;
}

#new-product-form label,
#new-subscription-form label,
#new-bill-form label,
#edit-profile-form label {
  margin-bottom: 5px;
  font-weight: bold;
}

#new-product-form input,
#new-subscription-form input,
#new-bill-form input,
#edit-profile-form input,
#edit-profile-form select {
  margin-bottom: 15px;
  padding: 10px;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  font-size: 16px;
}

body.dark-mode #new-product-form input,
body.dark-mode #new-subscription-form input,
body.dark-mode #new-bill-form input,
body.dark-mode #edit-profile-form input,
body.dark-mode #edit-profile-form select {
  background-color: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: var(--text);
}

#new-product-form button,
#new-subscription-form button,
#new-bill-form button,
#edit-profile-form button {
  padding: 10px;
  background-color: var(--brand-blue);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  margin-top: 10px;
}

#new-product-form button:hover,
#new-subscription-form button:hover,
#new-bill-form button:hover,
#edit-profile-form button:hover {
  background-color: var(--accent-hover);
}

#signup-error-message,
#error-message,
#product-error-message,
#edit-error-message {
  color: var(--error);
  margin-top: 10px;
}


#product-list-container {
    height: calc(100vh - 300px); /* Adjust height dynamically */
    overflow-y: auto;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-top: 10px;
}

body.dark-mode #product-list-container {
    border: 1px solid #555;
    background-color: #1e1e1e;
}

#product-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.product-widget {
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    text-align: center;
    flex: 1 1 calc(50% - 10px);  /* Adjusts width to fit two per row */
    box-sizing: border-box;
}

body.dark-mode .product-widget {
    background-color: var(--card-bg);
    color: #e0e0e0;
}

.product-image {
    width: 100%;
    height: 150px;  /* Placeholder size for future product image */
    background-color: #ddd;
    border-radius: 8px;
    margin-bottom: 10px;
}

@media (min-width: 600px) {
    .product-widget {
        width: calc(50% - 10px);  /* Ensure two per row */
    }
}

@media (min-width: 900px) {
    .product-widget {
        width: calc(50% - 10px);  /* Ensure two per row */
    }
}

/* Settings Panel */
#settings-panel {
    position: fixed;
    top: 0;
    right: -100%;
    width: 300px;
    height: 100%;
    background-color: var(--card-bg);
    color: #fff;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.3);
    padding: 20px;
    transition: right 0.3s ease;
}

body.dark-mode #settings-panel {
    background-color: #444;
}

#settings-panel h3 {
    margin-top: 0;
}

#settings-panel button {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    background-color: var(--accent-hover);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
}

#settings-panel button:hover {
    background-color: #777;
}

#settings-panel.active {
    right: 0;
}

#floating-settings {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

/* Sign Out Confirmation Popup */
#signout-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;  /* Hidden by default */
    justify-content: center;
    align-items: center;
    z-index: 1001;
}

#popup-content {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    text-align: center;
}

body.dark-mode #popup-content {
    background-color: var(--card-bg);
    color: #e0e0e0;
}

.popup-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.popup-buttons button {
    padding: 10px;
    background-color: var(--brand-blue);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    width: 100px;
}

.popup-buttons button:hover {
    background-color: var(--accent-hover);
}

.remove-product, .remove-sub {
    background-color: red;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
}

.remove-product:hover, .remove-sub:hover {
    background-color: darkred;
}

#country-select, #shop-select, #sub-type, #bill-type {
    margin-bottom: 15px;
    padding: 10px;
    border: 1px solid var(--input-border);
    border-radius: 4px;
    font-size: 16px;
    width: 100%;
}

body.dark-mode #country-select, body.dark-mode #shop-select, body.dark-mode #sub-type, body.dark-mode #bill-type, body.dark-mode #shop-select {
    background-color: #121212;
    border: 1px solid #555;
    color: #f5f5f5;
}

/* Ensure hidden sections stay hidden */
#shopping-list,
#coming-soon-section {
    display: none;
}

#edit-profile-section, #accessibility-tools-section, #subscription-section {
    max-width: 400px;
    margin: auto;
    padding: 20px;
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

body.dark-mode #edit-profile-section, body.dark-mode #accessibility-tools-section, body.dark-mode #subscription-section  {
    background-color: #1e1e1e;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

#edit-profile-form {
    display: flex;
    flex-direction: column;
}

#edit-profile-form label {
    margin-bottom: 5px;
    font-weight: bold;
}

#edit-profile-form input, #edit-profile-form select {
    margin-bottom: 15px;
    padding: 10px;
    border: 1px solid var(--input-border);
    border-radius: 4px;
    font-size: 16px;
}

body.dark-mode #edit-profile-form input,
body.dark-mode #edit-profile-form select {
    background-color: var(--card-bg);
  border: 1px solid #555;
    color: #e0e0e0;
}

#edit-profile-form button, #close-accessibility {
    padding: 10px;
    background-color: var(--brand-blue);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    margin-top: 10px;
}

#edit-profile-form button:hover, #close-accessibility button:hover {
    background-color: var(--accent-hover);
}

#edit-error-message {
    color: red;
    margin-top: 10px;
}

#edit-confirm-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1001;
}

#edit-popup-content {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.popup-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.popup-buttons button {
    padding: 10px;
    background-color: var(--brand-blue);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    width: 100px;
}

.popup-buttons button:hover {
    background-color: var(--accent-hover);
}

/* Delete account button style */
#delete-account-btn {
    background-color: red;
    color: #fff;
}

#delete-account-btn:hover {
    background-color: darkred;
}

/* Delete account popup */
#delete-account-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1001;
}

#delete-popup-content {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    text-align: center;
    max-width: 400px;
}

body.dark-mode #delete-popup-content {
    background-color: var(--card-bg);
  color: #e0e0e0;
}

#delete-confirm-input {
    width: 100%;
    padding: 8px;
    margin-top: 10px;
    border-radius: 4px;
    border: 1px solid var(--input-border);
    box-sizing: border-box;
}

#delete-error-message {
    color: red;
    margin-top: 10px;
}

/* Make delete account button red, override default button styles */
#edit-profile-form #delete-account-btn {
    background-color: red;
    color: #fff;
}

#edit-profile-form #delete-account-btn:hover {
    background-color: darkred;
}


#new-subscription-form, #new-bill-form {
    width: 100%;
    background: none;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    margin-bottom: 0;
}

body.dark-mode #new-subscription-form, body.dark-mode #new-bill-form {
}


#monthly-sub-list, #yearly-sub-list, #monthly-bills-list, #yearly-bills-list {
    height: calc(100vh - 300px); /* Ensuring scrollable behavior */
    overflow-y: auto;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-top: 10px;
}

body.dark-mode #monthly-sub-list, body.dark-mode #yearly-sub-list,
 body.dark-mode #monthly-bills-list body.dark-mode #yearly-bills-list {
    border: 1px solid #555;
    background-color: #1e1e1e;
}

.sub-widget {
    background-color: var(--card-bg);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 10px;
}

body.dark-mode .sub-widget {
    background-color: var(--card-bg);
  color: #e0e0e0;
}

.subscription-summary-bill {
    border: 2px solid #4BC0C0;
}

body.dark-mode .subscription-summary-bill {
    border-color: #4BC0C0;
}

/* Chart container */
#chart-cards-section, #bills-chart-cards-section {
    display: flex;
    flex-direction: column; /* Default: Stacked on top of each other */
    align-items: center;
    width: 100%;
    gap: 20px; /* Space between charts */
}

/* Individual chart cards */
.chart-card {
    width: 90%; /* Adjust width for small screens */
    max-width: 400px; /* Prevents being too large on mobile */
    padding: 15px;
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.chart-card h2 {
    font-size: 18px;
}

/* Ensure the canvas scales dynamically */
canvas {
    width: 100% !important;
    height: auto !important;
    max-height: 300px; /* Prevents it from getting too big */
}

/* Dark mode adjustments */
body.dark-mode .chart-card {
    background-color: #1e1e1e;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

/* When the screen is landscape (width > height), place charts side by side */
@media (orientation: landscape) and (min-width: 768px) {
    #chart-cards-section, #bills-chart-cards-section {
        flex-direction: row; /* Display charts side by side */
        justify-content: center;
    }

    .chart-card {
        width: 45%; /* Give both charts equal space */
        max-width: 500px; /* Limit width for better spacing */
    }
}

/* Scale up charts as the screen gets larger */
@media (min-width: 1024px) {
    .chart-card {
        max-width: 600px; /* Make the charts larger */
    }
}

/* Extra large screens */
@media (min-width: 1440px) {
    .chart-card {
        max-width: 700px; /* Make charts even larger on wide screens */
    }
}

.chart-total-spend {
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    margin-top: 10px;
}

/* Dark mode adjustments */
body.dark-mode .chart-total-spend {
    color: white;
}




/* =======================================================================
   App page shells (match marketing site cards)
   ======================================================================= */

.app-shell {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
}

.page-shell {
  width: 100%;
  max-width: 960px;
  margin: 1.25rem auto 0;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 1.25rem;
  padding: 2rem 1.75rem 2.25rem;
  border: 1px solid rgba(209, 213, 219, 0.9);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

body.dark-mode .page-shell {
  background: var(--card-bg);
  border-color: rgba(148, 163, 184, 0.22);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
}

.page-shell h1,
.page-shell h2 {
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.page-shell h1 { font-size: 1.55rem; }
.page-shell h2 { font-size: 1.25rem; }

.page-shell h3 {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.page-shell p,
.page-shell li {
  color: var(--muted);
  line-height: 1.65;
}

/* Top bar link used on login/sign-up cards */
.auth-topbar {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 0.6rem;
}

.back-home-link {
  font-weight: 600;
  color: var(--brand-blue);
  text-decoration: none;
  font-size: 0.92rem;
}

.back-home-link:hover,
.back-home-link:focus-visible {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* =======================================================================
   App tabs (Shopping / Subscriptions / Bills) – match site styling
   ======================================================================= */

#main-nav {
  width: 100%;
  max-width: 960px;
  margin: 1.25rem auto 0;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(209, 213, 219, 0.9);
  border-radius: 1rem;
  padding: 0.65rem 0.75rem;
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.06);
}

body.dark-mode #main-nav {
  background: rgba(17, 24, 39, 0.92);
  border-color: rgba(148, 163, 184, 0.22);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.25);
}

#main-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
}

#main-nav ul li { margin: 0; }

#main-nav ul li a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.9rem;
  border-radius: 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease, color 0.15s ease;
}

body.dark-mode #main-nav ul li a {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(148, 163, 184, 0.25);
}

#main-nav ul li a:hover,
#main-nav ul li a:focus-visible {
  background: rgba(240, 253, 244, 0.9);
  color: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(16, 185, 129, 0.28);
}

#main-nav ul li a.active {
  background: var(--brand-blue);
  border-color: rgba(29, 80, 116, 0.55);
  color: #ffffff;
  box-shadow: 0 14px 30px rgba(29, 80, 116, 0.24);
}

/* =======================================================================
   Unified app form styling (shopping/subscriptions/bills/edit profile)
   ======================================================================= */

#new-product-form,
#new-subscription-form,
#new-bill-form,
#edit-profile-form {
  gap: 0.85rem;
}

#new-product-form label,
#new-subscription-form label,
#new-bill-form label,
#edit-profile-form label {
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

#new-product-form input,
#new-subscription-form input,
#new-bill-form input,
#edit-profile-form input,
#edit-profile-form select,
#new-product-form select {
  padding: 0.8rem 0.9rem;
  border-radius: 0.75rem;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  margin: 0 0 0.35rem 0;
}

#new-product-form input:focus,
#new-subscription-form input:focus,
#new-bill-form input:focus,
#edit-profile-form input:focus,
#edit-profile-form select:focus,
#new-product-form select:focus {
  border-color: rgba(34, 197, 94, 0.55);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

#new-product-form button,
#new-subscription-form button,
#new-bill-form button,
#edit-profile-form button,
#product-list button,
#main-nav button {
  border-radius: 0.75rem;
  border: none;
  font-weight: 700;
  cursor: pointer;
  padding: 0.75rem 1rem;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.1s ease;
}

#new-product-form button,
#new-subscription-form button,
#new-bill-form button,
#edit-profile-form button {
  background: var(--brand-blue);
  color: #ffffff;
}

#new-product-form button:hover,
#new-subscription-form button:hover,
#new-bill-form button:hover,
#edit-profile-form button:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(16, 185, 129, 0.3);
}

#download-data-btn {
  background: rgba(29, 80, 116, 0.14);
  color: var(--brand-blue);
  border: 1px solid rgba(29, 80, 116, 0.22);
}

#download-data-btn:hover {
  background: rgba(29, 80, 116, 0.2);
  box-shadow: none;
}

#delete-account-btn {
  background: rgba(185, 28, 28, 0.12);
  color: #b91c1c;
  border: 1px solid rgba(185, 28, 28, 0.22);
}

#delete-account-btn:hover {
  background: rgba(185, 28, 28, 0.18);
  box-shadow: none;
  transform: translateY(-1px);
}

#back-to-main,
#close-accessibility {
  background: rgba(229, 231, 235, 0.85);
  color: var(--text);
  border: 1px solid rgba(148, 163, 184, 0.35);
}

body.dark-mode #back-to-main,
body.dark-mode #close-accessibility {
  background: rgba(15, 23, 42, 0.7);
  color: var(--text);
}

#back-to-main:hover,
#close-accessibility:hover {
  background: rgba(229, 231, 235, 1);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

body.dark-mode #back-to-main:hover,
body.dark-mode #close-accessibility:hover {
  background: rgba(17, 24, 39, 0.92);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

/* =======================================================================
   Widgets / lists / charts (colour consistency)
   ======================================================================= */

#product-list-container,
#monthly-sub-list,
#yearly-sub-list,
#monthly-bills-list,
#yearly-bills-list {
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(255, 255, 255, 0.65);
  border-radius: 0.95rem;
}

body.dark-mode #product-list-container,
body.dark-mode #monthly-sub-list,
body.dark-mode #yearly-sub-list,
body.dark-mode #monthly-bills-list,
body.dark-mode #yearly-bills-list {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(148, 163, 184, 0.22);
}

.product-widget,
.sub-widget {
  background: var(--card-bg);
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.product-widget h3 { color: var(--text); }
.product-widget p { color: var(--muted); }

/* Buttons inside product widgets */
.product-widget button {
  width: 100%;
  margin-top: 0.5rem;
  background: var(--brand-blue);
  color: #fff;
}

.product-widget button:hover {
  background: var(--accent-hover);
}

.product-widget .remove-product {
  background: rgba(185, 28, 28, 0.12);
  color: #b91c1c;
  border: 1px solid rgba(185, 28, 28, 0.22);
}

.product-widget .remove-product:hover {
  background: rgba(185, 28, 28, 0.18);
}

.subscription-summary-bill {
  border: 2px solid rgba(29, 80, 116, 0.55);
}

/* Chart cards */
.chart-card {
  background: var(--card-bg);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 1.1rem;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.chart-total-spend {
  color: var(--muted);
  font-weight: 700;
}

/* Settings panel should feel like the same UI */
#settings-panel {
  background: var(--card-bg) !important;
  color: var(--text);
  border-left: 1px solid rgba(148, 163, 184, 0.22);
}

body.dark-mode #settings-panel {
  background: rgba(17, 24, 39, 0.92) !important;
}

#settings-panel a,
#settings-panel button {
  color: var(--text);
}




/* =======================================================================
   v4 polish fixes (colour consistency + auth alignment + dark-mode charts)
   ======================================================================= */

/* Auth buttons: always aligned + full-width on small screens */
.auth-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
  margin-top: 0.4rem;
}
@media (min-width: 560px) {
  .auth-actions { grid-template-columns: 1fr 1fr; }
}
.auth-actions .btn { width: 100%; }

.btn-full { width: 100%; }

/* Back-to-home button spacing on auth forms */
#back-home-login,
#back-home-signup {
  margin-top: 0.25rem;
}

/* Settings panel: blue buttons with green hover (match rest of UI) */
#settings-panel {
  color: var(--text) !important;
}
#settings-panel h3 { color: var(--text); }
#settings-panel button {
  background: var(--brand-blue) !important;
  color: #ffffff !important;
  border-radius: 0.75rem !important;
  border: 1px solid rgba(29, 80, 116, 0.35) !important;
}
#settings-panel button:hover {
  background: var(--accent-hover) !important;
}

/* Selects (retailer + monthly/yearly): consistent in light/dark mode */
#shop-select,
#sub-type,
#bill-type,
#signup-age,
#signup-country,
#edit-country,
#edit-age {
  background: var(--input-bg) !important;
  color: var(--text) !important;
  border: 1px solid var(--input-border) !important;
  border-radius: 0.75rem !important;
}
body.dark-mode #shop-select,
body.dark-mode #sub-type,
body.dark-mode #bill-type,
body.dark-mode #signup-age,
body.dark-mode #signup-country,
body.dark-mode #edit-country,
body.dark-mode #edit-age {
  background: var(--input-bg) !important;
  color: var(--text) !important;
  border-color: var(--input-border) !important;
}

/* Help browsers render dropdown lists in dark mode more cleanly */
body.dark-mode select,
body.dark-mode option {
  color: var(--text);
}
body.dark-mode option {
  background-color: rgba(17, 24, 39, 0.98);
}

/* Some browsers need the select itself to opt into dark UI for the dropdown list */
body.dark-mode select {
  color-scheme: dark;
}

/* Charts: keep cards consistent with the dark blue UI */
body.dark-mode .chart-card {
  background: var(--card-bg) !important;
  border-color: rgba(148, 163, 184, 0.22) !important;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35) !important;
}
body.dark-mode .chart-total-spend {
  color: rgba(226, 232, 240, 0.9) !important;
}

/* Remove buttons: consistent across Shopping / Subscriptions / Bills */
.remove-product,
.remove-sub,
#confirm-delete-btn {
  background: #b91c1c !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 0.75rem !important;
  padding: 0.6rem 0.9rem !important;
  font-weight: 800 !important;
  cursor: pointer;
}
.remove-product:hover,
.remove-sub:hover,
#confirm-delete-btn:hover {
  background: #7f1d1d !important;
}

.product-widget .remove-product,
.sub-widget .remove-sub {
  width: 100%;
}

/* Accessibility + Edit profile: remove the extra outer “square box”.
   Only the inner .page-shell should render as the card. */
#edit-profile-section,
#accessibility-tools-section {
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}
body.dark-mode #edit-profile-section,
body.dark-mode #accessibility-tools-section {
  background: transparent !important;
  box-shadow: none !important;
}


/* Delete account button: coloured (danger) -> white text */
#delete-account-btn {
  background: #b91c1c !important;
  color: #ffffff !important;
  border: none !important;
}
#delete-account-btn:hover {
  background: #7f1d1d !important;
}


/* =======================================================================
   V5 polish tweaks (spacing + selects + date icon)
   ======================================================================= */

/* Reduce the “blank band” between sticky header and the in-app tab bar */
header {
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}

main {
  padding-top: 8px;
}

#main-nav {
  margin-top: 0.35rem !important;
}

.page-shell {
  margin-top: 0.75rem;
}

/* Retailer dropdown: add a touch more breathing room under the label */
#dropdown-container label {
  margin-bottom: 10px !important;
}

/* Consistent selects with properly centered arrow (fixes dark-mode tiling) */
select,
#country-select,
#shop-select,
#sub-type,
#bill-type,
#signup-age,
#signup-country,
#edit-country,
#edit-age {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;

  /* Space for the chevron */
  padding-right: 2.85rem !important;

  /* Custom chevron (prevents weird tiling in dark mode) */
  background-image: var(--select-chevron) !important;
  background-repeat: no-repeat !important;
  background-position: calc(100% - 1.05rem) 50% !important;
  background-size: 16px 16px !important;
}

/* Date picker: make the calendar icon readable in dark mode */
body.dark-mode input[type='date']::-webkit-calendar-picker-indicator {
  filter: invert(1);
  opacity: 0.9;
}

/* =========================================================
   Dark mode: custom chevron, centered, and NEVER tiled
   (high specificity + background shorthand)
   ========================================================= */

body.dark-mode select#country-select,
body.dark-mode select#shop-select,
body.dark-mode select#sub-type,
body.dark-mode select#bill-type,
body.dark-mode select#signup-age,
body.dark-mode select#signup-country,
body.dark-mode select#edit-country,
body.dark-mode select#edit-age,
body.dark-mode select {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;

  /* keep dropdown menu UI dark */
  color-scheme: dark;

  /* space for chevron */
  padding-right: 2.85rem !important;

  /* one-shot background definition prevents tiling */
  background: var(--input-bg)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M6 8l4 4 4-4' stroke='%23e5e7eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    no-repeat
    calc(100% - 1.05rem)
    calc(50% + 1px)
    / 16px 16px !important;

  color: var(--text) !important;
  border-color: var(--input-border) !important;
}

/* =========================================
   Make Edit Profile "Back" match primary blue buttons
   ========================================= */

#back-to-main,
button#back-to-main,
a#back-to-main {
  background: var(--brand-blue) !important;
  color: #fff !important;
  border: none !important;
  border-radius: 0.75rem !important;
  padding: 0.75rem 1rem !important;
  font-weight: 700 !important;

  /* match your other big buttons */
  width: 100%;
  max-width: none !important;

  box-shadow: none !important;
  text-decoration: none !important;
}

#back-to-main:hover,
button#back-to-main:hover,
a#back-to-main:hover {
  background: var(--accent-hover) !important;
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(16, 185, 129, 0.30) !important;
}

#back-to-main:active,
button#back-to-main:active,
a#back-to-main:active {
  transform: translateY(0);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.20) !important;
}

/* =========================================
   Fix 1: Add 10px space between "Product Retailer" label and #shop-select
   ========================================= */
#shop-select {
  margin-top: 10px !important;
}

/* (optional safety) if your label has for="shop-select" */
label[for="shop-select"] {
  margin-bottom: 10px !important;
  display: block;
}

/* =========================================
   Fix 2: Edit Profile tooltip icons visible in dark mode
   - Works for both inline <svg> and <img src="*.svg">
   - Uses filter so hard-coded black SVGs turn white
   ========================================= */
body.dark-mode #edit-profile-form label svg,
body.dark-mode #edit-profile-form label img,
body.dark-mode #edit-profile-section label svg,
body.dark-mode #edit-profile-section label img,
body.dark-mode #edit-profile-form .tooltip svg,
body.dark-mode #edit-profile-form .tooltip img,
body.dark-mode #edit-profile-form [class*="tooltip"] svg,
body.dark-mode #edit-profile-form [class*="tooltip"] img,
body.dark-mode #edit-profile-form [class*="info"] svg,
body.dark-mode #edit-profile-form [class*="info"] img,
body.dark-mode #edit-profile-form [class*="help"] svg,
body.dark-mode #edit-profile-form [class*="help"] img {
  filter: invert(1) brightness(1.15) !important;
  opacity: 0.95;
}

#settings-panel {
  z-index: 9999 !important;              /* higher than sticky header */
  max-height: 100dvh !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* On small screens, make sure top buttons aren't trapped under the header */
@media (max-width: 680px) {
  #settings-panel {
    padding-top: max(20px, calc(env(safe-area-inset-top, 0px) + 96px)) !important;
  }
}

/* Keep the floating settings button above everything too */
#floating-settings {
  z-index: 10000 !important;
}

#main-nav ul li.nav-divider {
  position: relative;
  margin-left: 28px;      /* space after Bills */
  padding-left: 28px;     /* space before burger */
}

/* Divider between nav items and settings burger */
#main-nav ul li.nav-divider::before {
  content: " ";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted); /* light mode */
}

/* Dark mode override */
body.dark-mode #main-nav ul li.nav-divider::before {
  color: var(--muted); /* same variable, different value in dark mode */
}
.ad-card {
  width: 100%;
  margin: 18px auto 0;
  padding: 14px 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--input-border);
  background: var(--card-bg);
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  position: relative;
}

.ad-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 10px;
}

.ad-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--input-border);
  color: var(--muted);
  background: var(--input-bg);
}

/* Logo pinned top-right */
.ad-brand {
  position: absolute;
  top: 12px;
  right: 12px;
  height: 50px;
  width: auto;
  display: block;
}

/* Default: reserve room for logo so text doesn't overlap */
.ad-title,
.ad-subtitle {
  padding-right: 140px;
}

.ad-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}

.ad-subtitle {
  font-size: 0.92rem;
  color: var(--muted);
  margin-bottom: 12px;
  line-height: 1.4;
}

.ad-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--brand-blue);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}

.ad-cta:hover {
  background: var(--accent-hover);
}

.ad-disclaimer {
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--muted);
}

/* ✅ Small screens: shrink logo and remove the big reserved padding */
@media (max-width: 480px) {
  .ad-brand {
    height: 34px;      /* smaller logo */
    top: 10px;
    right: 10px;
  }

  .ad-title,
  .ad-subtitle {
    padding-right: 0;  /* don't create whitespace */
  }

  .ad-title {
    padding-top: 34px; /* give content a little breathing room under logo */
  }
}

.ad-card { position: relative; }

.ad-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 10px;
}

/* pinned, scales with screen size */
.ad-brand{
  position: absolute;
  top: 12px;
  right: 12px;

  /* 1.25x bigger on small, much bigger on large */
  height: clamp(42px, 18vw, 95px);

  width: auto;
  margin: 0;
  display: block;
}


/* reserve space so title/subtitle don't sit under logo */
.ad-title,
.ad-subtitle {
  padding-right: clamp(0px, 32vw, 160px);
}

/* extra tweak for very small screens */
@media (max-width: 360px) {
  .ad-title,
  .ad-subtitle { padding-right: 0; }

  .ad-title { padding-top: 6px; } /* tiny breathing room */
}

/* Compact ad style (product placement-ish) */
.ad-card--compact{
  padding: 10px 10px 12px;
}

.ad-card--compact .ad-header{
  margin-bottom: 6px;
}

/* override your absolute-position logo ONLY inside compact */
/* Make all compact logos the same visual size */
.ad-card--compact .ad-brand{
  position: static;
  height: 40px;        /* uniform height */
  width: auto;
  max-width: 100px;    /* prevents extra-wide logos */
  object-fit: contain;
  display: block;
}

.ad-header--compact{
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ad-body--compact{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ad-card--compact .ad-title{
  font-size: 0.92rem;
  margin: 0;
  line-height: 1.15;
  padding-right: 0; /* cancel the big-screen reserve space */
}

.ad-card--compact .ad-subtitle{
  font-size: 0.82rem;
  margin: 2px 0 0;
  line-height: 1.2;
  padding-right: 0;
  /* keep it from growing tall */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ad-cta--sm{
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  white-space: nowrap;
  color: #fff;
}

.ad-card--compact .ad-cta--sm {
  color: #fff !important;
}


.ad-card--compact .ad-disclaimer{
  margin-top: 6px;
  font-size: 0.7rem;
  line-height: 1.25;
}

/* just spacing inside settings */
.ad-card--settings{
  margin-top: 12px;
}

.ad-card--settings { margin-top: 10px; }

/* Dark mode: turn ONLY the Amazon Music logo white */
/* Dark mode: make ONLY the Amazon Music SVG appear white */
body.dark-mode #ad-settings-music .ad-brand,
body.darkmode  #ad-settings-music .ad-brand {  /* (optional) if you ever use this class name */
  filter: invert(1) brightness(1.15);
}

/* Large ads: logo centered vertically with ~15px right padding */
.ad-card:not(.ad-card--compact) .ad-brand {
  position: absolute;
  right: 45px;
  top: 50%;
  transform: translateY(-50%);
}

/* Small screens: keep logo in the top-right like before */
@media (max-width: 480px) {
  .ad-card:not(.ad-card--compact) .ad-brand {
    top: 12px;
    right: 12px;
    transform: none;
  }
}

/* Mobile nav: keep tabs + burger on one row */
@media (max-width: 520px) {
  #main-nav ul{
    flex-wrap: nowrap;            /* prevent the burger wrapping under */
    justify-content: flex-start;  /* tabs left */
    gap: 0.45rem;
  }

  #main-nav ul li a{
    padding: 0.5rem 0.7rem;
    font-size: 0.9rem;
    white-space: nowrap;
  }

  /* remove the "spacer/divider" behaviour on mobile and push burger to the right */
  #main-nav ul li.nav-divider{
    margin-left: auto;   /* pushes it to far right */
    padding-left: 0;
  }

  #main-nav ul li.nav-divider::before{
    display: none;       /* hide divider on small screens */
  }

  /* make the burger a bit tighter so it fits */
  #main-nav ul li.nav-divider a{
    padding: 0.5rem 0.65rem;
    min-width: 2.25rem;
  }
}

/* Extra small phones: shrink a touch more */
@media (max-width: 360px) {
  #main-nav ul { gap: 0.35rem; }
  #main-nav ul li a { padding: 0.45rem 0.6rem; font-size: 0.85rem; }
}

/* NAV (base) */
.main-nav {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  white-space: nowrap;
}

.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--accent-hover);
  text-decoration: underline;
}

.nav-link.active {
  color: var(--brand-blue);
  text-decoration: none;
}

.nav-separator {
  color: var(--muted);
  font-size: 0.85rem;
}

/* DROPDOWN */
.nav-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.nav-dropdown__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-caret {
  font-size: 0.8em;
  line-height: 1;
  opacity: 0.9;
}

.nav-dropdown__menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.35rem; /* slight spacing but still connected */
  min-width: 180px;
  padding: 0.35rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
  display: none;
  z-index: 50;
}

/* Show on hover + keyboard focus */
.nav-dropdown:hover .nav-dropdown__menu,
.nav-dropdown:focus-within .nav-dropdown__menu {
  display: block;
}

/* Hover bridge so it doesn't collapse when moving mouse down */
.nav-dropdown::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 16px;
}

.nav-dropdown__item {
  display: block;
  padding: 0.55rem 0.7rem;
  border-radius: 0.7rem;
  text-decoration: none;
  white-space: nowrap;
}

.nav-dropdown__item:hover,
.nav-dropdown__item:focus-visible {
  background: rgba(22, 163, 74, 0.08);
  text-decoration: none;
}

/* Forgot password link */
.forgot-row {
  margin-top: -8px;
  margin-bottom: 12px;
}

.forgot-link {
  font-size: 0.95rem;
  color: var(--brand-blue);
  text-decoration: underline;
  cursor: pointer;
}

.forgot-link:hover {
  color: var(--accent-hover);
}

/* ===== MODALS (OTP + Reset Password) ===== */
.modal-overlay {
  display: none;                 /* hidden by default */
  position: fixed;
  inset: 0;                      /* top/right/bottom/left = 0 */
  z-index: 99999;
  background: rgba(0, 0, 0, 0.55);

  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay.is-open {
  display: flex;
}

.modal-card {
  width: min(520px, 92vw);
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}

.modal-card input {
  width: 100%;
  max-width: 320px;
  padding: 10px 12px;
  margin-top: 10px;
}

body.modal-open {
  overflow: hidden;
}

/* hidden by default like your other overlays */
#forgot-email-popup { display: none; }
#forgot-email-popup.is-open { display: flex; }

/* === Make ALL modal inputs match normal auth-form inputs === */
#otp-code,
#forgot-email,
#reset-new-password,
#reset-confirm-password,
#delete-confirm-input {
  width: 100%;
  padding: 0.9rem 1rem;
  font-size: 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.75rem;  /* same as your login/signup inputs */
  background: #fff;
  color: #111827;
  box-sizing: border-box;
}

#otp-code:focus,
#forgot-email:focus,
#reset-new-password:focus,
#reset-confirm-password:focus,
#delete-confirm-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

/* Optional: make these look good in dark mode too */
body.dark-mode #otp-code,
body.dark-mode #forgot-email,
body.dark-mode #reset-new-password,
body.dark-mode #reset-confirm-password,
body.dark-mode #delete-confirm-input {
  background: rgba(15, 23, 42, 0.75);
  border-color: rgba(148, 163, 184, 0.35);
  color: #e5e7eb;
}

/* === Uniform popup buttons: match the app button style === */
.popup-buttons button,
#confirm-otp, #cancel-otp,
#confirm-forgot-email, #cancel-forgot-email,
#confirm-reset, #cancel-reset,
#confirm-delete-btn, #cancel-delete-btn,
#confirm-signout, #cancel-signout {
  border-radius: 0.75rem;
}

/* If your Cancel delete is still squared, force it */
#cancel-delete-btn {
  border-radius: 0.75rem !important;
}

.popup-buttons button {
  padding: 0.7rem 1rem;
  font-weight: 700;
}

/* Force inputs inside popups to fill available width */
#otp-popup input,
#reset-password-popup input,
#forgot-email-popup input,
#delete-account-popup input {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Make sure popup inner content isn't constraining width */
#otp-popup .popup-content,
#reset-password-popup .popup-content,
#forgot-email-popup .popup-content,
#delete-account-popup .popup-content {
  width: 100%;
}

/* =========================================================
   Shopping > New Product form (wrapped rows)
   ========================================================= */

/* Each row becomes a vertical stack again */
#new-product-form #dropdown-container,
#new-product-form #asin-row,
#new-product-form #name-row,
#new-product-form #ebay-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
}

/* Force label to occupy full line */
#new-product-form #dropdown-container > label,
#new-product-form #asin-row > label,
#new-product-form #name-row > label {
  display: block;
  margin-bottom: 0;
}

/* Make controls stretch full width (this is what you lost) */
#new-product-form #dropdown-container > select,
#new-product-form #asin-row > input,
#new-product-form #name-row > input {
  width: 100%;
}

/* Retailer tip should not look like an error */
#retailer-hint {
  margin: 0;
  color: var(--muted);
}
body.dark-mode #retailer-hint {
  color: rgba(226, 232, 240, 0.78);
}

/* eBay block hidden by default; JS will show it */
#ebay-row {
  display: none;
}

/* Nice “coming soon” styling */
.retailer-note {
  margin: 0;
  padding: 0.65rem 0.8rem;
  border-radius: 0.75rem;
  border: 1px dashed rgba(148, 163, 184, 0.45);
  background: rgba(255, 255, 255, 0.55);
  color: var(--muted);
}
body.dark-mode .retailer-note {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(148, 163, 184, 0.25);
}

.product-image {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  font-weight: 800;
  color: rgba(15, 23, 42, 0.55);
  background: rgba(148, 163, 184, 0.18);
}
body.dark-mode .product-image {
  color: rgba(226, 232, 240, 0.7);
  background: rgba(148, 163, 184, 0.12);
}

/* ================================
   Subscription page polish
   ================================ */

/* Remove the "double card" effect:
   #subscription-section is styled as a card in one place,
   while .page-shell is also a card. Keep only .page-shell. */
#subscription-section {
  max-width: none;
  margin: 0;
  padding: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}
body.dark-mode #subscription-section {
  background: transparent;
  box-shadow: none;
}

/* Keep this page shell a bit narrower than the default 960px */
#subscription-section .page-shell {
  max-width: 520px;
}

/* Button stack spacing so hover "lift" doesn't overlap the next button */
#subscription-section .plan-btn-row {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.75rem;
}
#subscription-section .plan-btn-row .btn {
  width: 100%;
}

/* Promo row: aligned input + button with consistent sizing */
#subscription-section .promo-row {
  display: flex;
  gap: 0.65rem;
  align-items: stretch;
  margin: 0.5rem 0 0.25rem;
}

#subscription-section #promo-code-input {
  flex: 1;
  min-width: 0;
  padding: 0.8rem 0.9rem;
  border-radius: 0.75rem;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  box-sizing: border-box;
}

#subscription-section #promo-code-input:focus {
  border-color: rgba(34, 197, 94, 0.55);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

body.dark-mode #subscription-section #promo-code-input {
  background: rgba(15, 23, 42, 0.75);
  border-color: rgba(148, 163, 184, 0.35);
  color: var(--text);
}

/* Keep the promo button from shrinking oddly */
#subscription-section #promo-claim-btn {
  white-space: nowrap;
}

/* Mobile: stack promo input/button nicely */
@media (max-width: 420px) {
  #subscription-section .promo-row {
    flex-direction: column;
  }
  #subscription-section #promo-claim-btn {
    width: 100%;
  }
}