/* =========================================================
   Deals-4Me — site/theme.css   (ONE BIG POND)
   Purpose:
   - Global theme tokens (colors, spacing, surfaces)
   - Global base styles (body, links, layout)
   - Reusable components (toolbar, buttons, cards, tables, forms)
   - Utility helpers
   - Auth + Signup layout (kept here per "one big pond")
   ========================================================= */


/* =========================================================
   1) THEME CONTROL PANEL (Change once, affects everything)
   Light Theme: soft blue-gray background + calm blue accent
   ========================================================= */

:root{
  /* Base background + text */
  --bg-main: #E3E9F1;                  /* soft blue-gray (RGB 227,233,241) */
  --text-main: rgba(15, 23, 42, 0.92); /* deep navy text */
  --text-muted: rgba(15, 23, 42, 0.72);

  /* Accent / links */
  --accent: #3A6EA5;                   /* calm steel blue (RGB 58,110,165) */
  --link: var(--accent);

  /* Surfaces */
  --surface-1: rgba(255,255,255,0.78); /* cards / panels */
  --surface-2: rgba(255,255,255,0.62); /* toolbar / header */
  --surface-3: rgba(255,255,255,0.92); /* higher contrast surfaces */

  /* Borders */
  --border-1: rgba(15, 23, 42, 0.12);
  --border-2: rgba(15, 23, 42, 0.16);

  /* Shadows */
  --shadow-1: 0 10px 30px rgba(0,0,0,0.10);

  /* Buttons */
  --btn-bg: rgba(15, 23, 42, 0.06);
  --btn-bg-hover: rgba(15, 23, 42, 0.10);

  /* Inputs */
  --input-bg: rgba(255,255,255,0.80);
  --placeholder: rgba(15, 23, 42, 0.45);

  /* Status colors */
  --ok: #16A34A;
  --warn: #D97706;
  --err: #DC2626;

  /* “Money palette” tokens (kept for later use if needed) */
  --money-green-1: #0b5f3b;
  --money-green-2: #1f8a5b;
  --money-green-3: #e9fff6;
}


/* =========================================================
   2) BASE / RESET
   ========================================================= */

*{ box-sizing: border-box; }

html, body{
  height: 100%;
}

body{
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg-main);
  color: var(--text-main);
}

a{ color: var(--link); }

img{ max-width: 100%; height: auto; }

button, input, select, textarea{
  font: inherit;
}

main{ padding: 18px; }


/* =========================================================
   3) LAYOUT HELPERS (Containers + titles)
   ========================================================= */

/* Existing page shell */
.page-shell{
  max-width: 1100px;
  margin: 0 auto;
}

/* Standardized container for public/legal/static pages */
.d4m-container{
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 18px;
}

/* Readable text column for long docs (privacy/terms/etc.) */
.d4m-doc{
  max-width: 900px;
  margin: 40px auto 50px;
}

/* Titles */
.page-title{
  margin: 0 0 6px 0;
  font-size: 1.6rem;
  letter-spacing: 0.2px;
}
.page-subtitle{
  margin: 0 0 18px 0;
  color: var(--text-muted);
}


/* =========================================================
   4) TOOLBAR (In-app toolbar — not for login/signup/pin)
   Single source of truth:
   - .d4m-toolbar
   - .d4m-toolbar__row / __left / __center / __right
   - .d4m-link / .d4m-btn / #toolbarUserName
   ========================================================= */

.d4m-toolbar{
  width: 100%;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.d4m-toolbar__row{
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
}

/* Left & right take equal space so center stays truly centered */
.d4m-toolbar__left,
.d4m-toolbar__right{
  flex: 1;
  display: flex;
  align-items: center;
}

.d4m-toolbar__left{ justify-content: flex-start; }
.d4m-toolbar__right{ justify-content: flex-end; }

/* Center hugs content and stays centered */
.d4m-toolbar__center{
  flex: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  white-space: nowrap;
}

/* Links: no pills, simple underline on hover/active */
.d4m-link{
  color: var(--text-main);
  font-weight: 800;
  text-decoration: none;
  padding: 0;
  border-radius: 0;
}

.d4m-link:hover{
  text-decoration: underline;
  text-underline-offset: 4px;
}

.d4m-link.is-active{
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Pipes between center links */
.d4m-toolbar__center > span[aria-hidden="true"]{
  color: var(--text-muted);
  opacity: 0.85;
}

/* Right side username + logout stacked */
.d4m-userwrap{
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.d4m-user{
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
  line-height: 1.1;
}

/* Logout button */
.d4m-btn{
  border: 1px solid var(--border-2);
  background: var(--btn-bg);
  color: var(--text-main);
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 800;
  cursor: pointer;
  min-width: 130px;
  text-align: center;
}

.d4m-btn:hover{
  background: var(--btn-bg-hover);
}

/* stack + spacing */
.d4m-userwrap .d4m-btn{
  width: 130px;
}

.d4m-userwrap .d4m-btn + .d4m-btn{
  margin-top: 4px;
}

/* Mobile */
@media (max-width: 720px){
  .d4m-toolbar__row{ flex-wrap: wrap; justify-content: center; }
  .d4m-toolbar__left, .d4m-toolbar__right{ flex: 0; }
  .d4m-toolbar__center{ order: 3; width: 100%; }
  .d4m-userwrap{ align-items: center; }
}


/* =========================================================
   5) BUTTONS + INPUTS (Global)
   ========================================================= */

.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-2);

  background: var(--btn-bg);
  color: var(--text-main);
  font-weight: 800;
  cursor: pointer;
}

.btn:hover{
  background: var(--btn-bg-hover);
}

.btn:disabled{
  opacity: 0.6;
  cursor: not-allowed;
}

.input, .select, .textarea{
  width: 100%;
  border: 1px solid var(--border-2);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--input-bg);
  color: var(--text-main);
}

.input::placeholder, .textarea::placeholder{
  color: var(--placeholder);
}

.label{
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin: 8px 0 6px;
}


/* =========================================================
   6) CARDS / PANELS / TABLES (Global)
   ========================================================= */

.card{
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow-1);
}

.tableWrap{
  overflow: auto;
  border: 1px solid var(--border-1);
  border-radius: 12px;
  background: var(--surface-1);
}

.table{
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.table th, .table td{
  padding: 10px 12px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  text-align: left;
}

.table th{
  color: var(--text-muted);
  font-weight: 800;
  background: rgba(15, 23, 42, 0.05);
}


/* =========================================================
   7) UTILITIES
   ========================================================= */

.row{ display: flex; gap: 12px; align-items: center; }
.row-wrap{ display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.space-between{ justify-content: space-between; }
.center{ text-align: center; }
.mt-8{ margin-top: 8px; }
.mt-12{ margin-top: 12px; }
.mt-18{ margin-top: 18px; }
.hidden{ display: none !important; }


/* =========================================================
   8) AUTH / LOGIN / SIGNUP LAYOUT
   (Kept here per "one big pond")
   ========================================================= */

.auth-shell{
  min-height: calc(100vh - 36px);
  display: grid;
  place-items: center;
  padding: 18px;
}

.auth-card{
  width: min(520px, 92vw);
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow-1);
}

.auth-title{
  margin: 0 0 6px 0;
  font-size: 20px;
}

.auth-subtitle{
  margin: 0 0 14px 0;
  color: var(--text-muted);
  font-size: 14px;
}

.auth-actions{
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.auth-link{
  font-size: 14px;
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
}


/* Signup layout (two-column) */
.signup-shell{
  max-width: 1100px;
  margin: 18px auto 50px;
  padding: 0 18px;

  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 18px;
}

.signup-left{
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow-1);
}

.signup-left h1{
  margin: 0 0 6px 0;
  font-size: 24px;
}

.signup-left p{
  margin: 0 0 12px 0;
  color: var(--text-muted);
}

/* Form grid */
.form-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.span-2{ grid-column: span 2; }

/* Consent / fine text */
.consent{
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.consent a{
  color: var(--link);
}

.primary-btn{
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(58,110,165,0.24);
  background: rgba(58,110,165,0.14);
  font-weight: 900;
  cursor: pointer;
}

.primary-btn:hover{
  background: rgba(58,110,165,0.24);
}

.below-btn{
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.fineprint{
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Right side info card */
.signup-right{
  display: flex;
  justify-content: stretch;
}

.info-card{
  width: 100%;
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow-1);
}

.info-card h2{
  margin: 0 0 10px 0;
  font-size: 18px;
}

.info-card p{
  margin: 0 0 10px 0;
  color: var(--text-muted);
}

.info-card ul{
  margin: 10px 0 12px 18px;
  padding: 0;
}

.info-card li{
  margin: 8px 0;
}

/* Signup responsive */
@media (max-width: 980px){
  .signup-shell{ grid-template-columns: 1fr; }
}

@media (max-width: 640px){
  .form-grid{ grid-template-columns: 1fr; }
  .span-2{ grid-column: span 1; }
}

/* ===============================
   DASHBOARD — YOUR STORES
   =============================== */

#storesGrid.storesGrid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 220px));
  gap: 18px;
  align-items: start;
}

.storeCardWrap{
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.storeBtn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--border-2);
  background: var(--btn-bg);
  color: var(--text-main);
  border-radius: 10px;
  text-decoration: none;
  font-weight: 700;
}

.storeBtn:hover{
  background: var(--btn-bg-hover);
  text-decoration: none;
}

.storeCard{
  width: 100%;
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: 14px;
  padding: 14px 14px 12px;
  cursor: pointer;
  box-shadow: var(--shadow-1);
}

.storeCard.is-active{
  border-color: var(--accent);
}

.storeCard__name{
  font-weight: 800;
  font-size: 18px;
  line-height: 1.2;
  margin-bottom: 8px;
}

.storeCard__meta{
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.storeCard__pill{
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--border-1);
  background: rgba(15, 23, 42, 0.05);
}

/* ===============================
   MY LIST (checkbox output)
   =============================== */

.myList{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.myListItem{
  border: 1px solid var(--border-1);
  background: var(--surface-1);
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.myListItem button{
  border: none;
  background: transparent;
  cursor: pointer;
  font-weight: bold;
}