/* ============================================================
   Geo-Immo — shared stylesheet
   ============================================================ */

/* --- Variables & reset ------------------------------------ */
:root {
  --navy:       #0f2d4a;
  --navy-light: #1a4268;
  --gold:       #c9a84c;
  --bg:         #f0f4f8;
  --white:      #ffffff;
  --text:       #1e293b;
  --muted:      #64748b;
  --border:     #e2e8f0;
  --green:      #16a34a;
  --green-bg:   #dcfce7;
  --amber:      #b45309;
  --amber-bg:   #fef3c7;
  --red:        #dc2626;
  --red-bg:     #fee2e2;
  --radius:     12px;
  --shadow:     0 4px 24px rgba(0,0,0,.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg);
       color: var(--text); line-height: 1.5; }

/* --- Centered card pages (login / reset / buy) ------------ */
.page-centered {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, #1e4d7b 100%);
}
.card {
  background: var(--white); border-radius: var(--radius);
  padding: 2.8rem 2.4rem; box-shadow: 0 20px 60px rgba(0,0,0,.3);
  width: 100%; max-width: 380px;
}
.card-wide { max-width: 420px; }

/* --- Logo (card pages) ------------------------------------ */
.logo { text-align: center; margin-bottom: 2rem; }
.logo-mark { display: inline-flex; align-items: center; gap: .5rem;
             font-size: 1.6rem; font-weight: 700; color: var(--navy); }
.logo-mark span { color: var(--gold); }
.logo-sub { font-size: .8rem; color: var(--muted); margin-top: .2rem;
            letter-spacing: .08em; text-transform: uppercase; }

/* --- Forms ------------------------------------------------ */
label { display: block; font-size: .82rem; font-weight: 600;
        color: var(--muted); margin-bottom: .35rem; letter-spacing: .03em; }
.field { margin-bottom: 1.1rem; }
input {
  width: 100%; padding: .65rem 1rem; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: .95rem; font-family: inherit;
  transition: border-color .15s;
}
input:focus { outline: none; border-color: var(--gold);
              box-shadow: 0 0 0 3px rgba(201,168,76,.15); }
button {
  width: 100%; padding: .75rem; margin-top: .5rem;
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  color: white; border: none; border-radius: 8px;
  font-size: .95rem; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: opacity .15s;
}
button:hover { opacity: .9; }

/* --- Messages --------------------------------------------- */
.msg-ok {
  background: var(--green-bg); border-left: 3px solid var(--green);
  border-radius: 6px; padding: .7rem .9rem; color: var(--green);
  font-size: .87rem; margin-bottom: 1.2rem;
}
.msg-err, .error {
  background: var(--red-bg); border-left: 3px solid var(--red);
  border-radius: 6px; padding: .7rem .9rem; color: var(--red);
  font-size: .87rem; margin-bottom: 1.2rem;
}
.back { display: block; text-align: center; margin-top: 1.2rem;
        font-size: .85rem; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--navy); }

/* --- App header (index + history) ------------------------- */
header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: white; padding: 0 2rem;
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; box-shadow: 0 2px 12px rgba(0,0,0,.2);
  position: sticky; top: 0; z-index: 100;
}
.header-logo { display: flex; align-items: center; }
.header-logo img { height: 52px; width: auto; }
.header-logo span { color: var(--gold); }
.header-right { display: flex; align-items: center; gap: 1.2rem; }
.nav-btn, .logout-btn {
  font-size: .82rem; color: rgba(255,255,255,.75); text-decoration: none;
  border: 1px solid rgba(255,255,255,.25); border-radius: 6px;
  padding: .3rem .75rem; transition: all .15s;
}
.nav-btn:hover, .logout-btn:hover { background: rgba(255,255,255,.1); color: white; }
.credits-badge {
  display: inline-flex; align-items: center; gap: .4rem;
  background: rgba(201,168,76,.15); border: 1px solid var(--gold);
  border-radius: 20px; padding: .3rem .9rem;
  color: var(--gold); font-size: .82rem; font-weight: 600; text-decoration: none;
}

/* --- Main layout ------------------------------------------ */
main { max-width: 980px; margin: 2rem auto; padding: 0 1.5rem 3rem; }

/* --- Search card (index) ---------------------------------- */
.search-card {
  background: var(--white); border-radius: var(--radius);
  padding: 1.8rem 2rem; box-shadow: var(--shadow); margin-bottom: 1.8rem;
  border-top: 3px solid var(--gold);
}
.search-tabs { display: flex; gap: .4rem; margin-bottom: 1.2rem; }
.search-tab {
  width: auto; margin: 0; padding: .4rem 1.1rem;
  font-size: .85rem; font-weight: 600;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 6px; color: var(--muted); cursor: pointer; transition: all .15s;
}
.search-tab.active {
  background: var(--navy); color: white; border-color: var(--navy); opacity: 1;
}
.search-tab:hover:not(.active) { border-color: var(--gold); color: var(--navy); opacity: 1; }
.tab-panel label { font-weight: 600; font-size: .9rem; }
.search-card label { font-weight: 600; font-size: .9rem; margin-bottom: .6rem; }
.input-row { display: flex; gap: .6rem; }
.input-row input {
  flex: 1; padding: .7rem 1rem; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: .95rem; font-family: inherit;
  transition: border-color .15s;
}
.input-row input:focus { outline: none; border-color: var(--gold);
                          box-shadow: 0 0 0 3px rgba(201,168,76,.15); }
.input-row button {
  padding: .7rem 1.6rem; white-space: nowrap; width: auto; margin-top: 0;
}
.input-row button:hover { opacity: .88; }
.loading { display: none; align-items: center; gap: .6rem;
           margin-top: .9rem; font-size: .88rem; color: var(--muted); }
.spinner {
  width: 16px; height: 16px; border: 2px solid var(--border);
  border-top-color: var(--gold); border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Info grid (index) ------------------------------------ */
.info-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem; margin-bottom: 1.8rem;
}
.info-box {
  background: var(--white); border-radius: var(--radius);
  padding: 1.2rem 1.4rem; box-shadow: var(--shadow);
  border-bottom: 3px solid var(--gold);
}
.info-box .lbl { font-size: .72rem; font-weight: 600; color: var(--muted);
                 text-transform: uppercase; letter-spacing: .07em; }
.info-box .val { font-size: 1.2rem; font-weight: 700; color: var(--navy); margin-top: .3rem; }

/* --- Section / results (index) ---------------------------- */
.section {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 1.8rem; overflow: hidden;
}
.section-header {
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  color: white; padding: 1rem 1.5rem;
  display: flex; align-items: center; gap: .6rem;
}
.section-header h2 { font-size: 1rem; font-weight: 600; flex: 1; }
.show-more-btn {
  width: auto; margin: .8rem 0 0; padding: .4rem 1.1rem;
  font-size: .82rem; font-weight: 600;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 6px; color: var(--navy); cursor: pointer; transition: border-color .15s;
}
.show-more-btn:hover { border-color: var(--gold); background: #fffbf0; opacity: 1; }
.open-all-btn {
  width: auto; margin-top: 0; padding: .35rem .9rem;
  font-size: .78rem; font-weight: 600;
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.4);
  border-radius: 6px; color: white; cursor: pointer; transition: background .15s;
}
.open-all-btn:hover { background: rgba(255,255,255,.28); opacity: 1; }
.section-body { padding: 1.5rem; }
.subsection-title {
  font-size: .88rem; font-weight: 700; color: var(--navy);
  margin: 1.4rem 0 .8rem; padding-bottom: .4rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.subsection-title:first-child { margin-top: 0; }
.count-badge {
  background: var(--navy); color: white; font-size: .72rem;
  font-weight: 700; padding: .15rem .55rem; border-radius: 20px;
}

/* --- Tables ----------------------------------------------- */
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
thead tr { background: #f8fafc; }
th { padding: .55rem .9rem; text-align: left; font-weight: 600;
     color: var(--muted); font-size: .78rem; text-transform: uppercase;
     letter-spacing: .05em; border-bottom: 1px solid var(--border); }
td { padding: .55rem .9rem; border-bottom: 1px solid #f1f5f9; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f8fafc; }

/* --- Badges ----------------------------------------------- */
.badge-exact {
  background: var(--green-bg); color: var(--green);
  padding: .2rem .6rem; border-radius: 20px; font-size: .78rem; font-weight: 700;
}
.badge-diff {
  background: var(--amber-bg); color: var(--amber);
  padding: .2rem .6rem; border-radius: 20px; font-size: .78rem; font-weight: 600;
}
.badge { font-size: .75rem; font-weight: 600; padding: .15rem .6rem; border-radius: 20px; }
.badge-city  { background: #e0f2fe; color: #0369a1; }
.badge-surf  { background: var(--amber-bg); color: var(--amber); }
.badge-price { background: #f0fdf4; color: var(--green); }
.badge-count { background: var(--navy); color: white; }

/* --- Map link --------------------------------------------- */
.gmaps-link {
  display: inline-flex; align-items: center; gap: .3rem;
  color: #1a73e8; text-decoration: none; font-weight: 500; font-size: .85rem;
}
.gmaps-link:hover { text-decoration: underline; }
.gmaps-link::before { content: "📍"; font-size: .8rem; }
.gmaps-tick { color: var(--green); font-weight: 700; }

/* --- Misc ------------------------------------------------- */
.empty { color: var(--muted); font-style: italic; font-size: .88rem; padding: .5rem 0; }
.error-msg {
  background: var(--red-bg); border-left: 3px solid var(--red);
  border-radius: 8px; padding: 1rem 1.2rem; color: var(--red); margin-bottom: 1.5rem;
}

/* --- Buy page --------------------------------------------- */
.balance { text-align: center; background: var(--bg); border-radius: 10px;
           padding: 1rem; margin-bottom: 1.8rem; }
.balance-num { font-size: 2rem; font-weight: 700; color: var(--navy); }
.balance-lbl { font-size: .8rem; color: var(--muted); text-transform: uppercase;
               letter-spacing: .06em; margin-top: .1rem; }
.packs { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem;
         margin-bottom: 1.5rem; }
.pack { border: 2px solid var(--border); border-radius: 10px; padding: .9rem .5rem;
        text-align: center; cursor: pointer; transition: all .15s; user-select: none; }
.pack:hover, .pack.selected { border-color: var(--gold); background: #fffbf0; }
.pack .credits { font-size: 1.4rem; font-weight: 700; color: var(--navy); }
.pack .label   { font-size: .72rem; color: var(--muted); margin-top: .1rem; }
.pack .price   { font-size: .85rem; font-weight: 600; color: var(--gold); margin-top: .3rem; }
.stripe-note { text-align: center; font-size: .75rem; color: var(--muted); margin-top: .8rem; }

/* --- History page ----------------------------------------- */
.history-main { max-width: 1100px; margin: 2rem auto; padding: 0 1.5rem 3rem; }
.history-main h1 { font-size: 1.4rem; font-weight: 700; color: var(--navy); margin-bottom: 1.4rem; }
.history-card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 1.2rem; overflow: hidden;
}
.history-header {
  background: #f8fafc; padding: .8rem 1.4rem;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border); cursor: pointer; user-select: none;
}
.history-header:hover { background: #f1f5f9; }
.history-meta  { display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap; }
.history-date  { font-size: .78rem; color: var(--muted); }
.history-title { font-weight: 600; color: var(--navy); font-size: .95rem; }
.history-badges { display: flex; gap: .5rem; flex-wrap: wrap; }
.toggle-icon { font-size: 1rem; color: var(--muted); transition: transform .2s; }
.history-body { padding: 1.2rem 1.4rem; display: none; }
.history-body.open { display: block; }
.result-url { word-break: break-all; font-size: .8rem; color: var(--muted); margin-bottom: 1rem; }
.result-url a { color: #1a73e8; }
.history-subsection {
  font-size: .85rem; font-weight: 700; color: var(--navy);
  margin: 1rem 0 .6rem; padding-bottom: .3rem;
  border-bottom: 1px solid var(--border);
}
.empty-sub { color: var(--muted); font-style: italic; font-size: .85rem; }
.popup-warning {
  background: var(--amber-bg); border-left: 3px solid var(--amber);
  border-radius: 6px; padding: .65rem 1rem; color: var(--amber);
  font-size: .85rem; font-weight: 500; margin-bottom: 1rem;
}
