/* ============================================================
   ReceptoCraft · Global CSS
   Unified design system across Design, Create, Develop tools
   ============================================================ */

/* ── TOKENS ─────────────────────────────────────────────────── */
:root {
  /* Backgrounds & Surfaces */
  --bg:      #e8e4db;
  --bg2:     #f0ece4;
  --bg3:     #dfd9cf;
  --bg4:     #d5cec3;
  --surface: #faf8f5;
  --white:   #ffffff;

  /* Borders */
  --bdr:  rgba(60,50,30,0.10);
  --bdr2: rgba(60,50,30,0.18);
  --bdr3: rgba(60,50,30,0.25);

  /* Text */
  --txt:  #1e1c18;
  --txt2: #4a4538;
  --txt3: #8a8070;

  /* Tool Accents */
  --car:    #4a7c5e;  --car-bg:  rgba(74,124,94,0.08);
  --fp:     #5a5aab;  --fp-bg:   rgba(90,90,171,0.08);
  --bsp:    #b85c38;  --bsp-bg:  rgba(184,92,56,0.08);
  --dev:    #3a6fc7;  --dev-bg:  rgba(58,111,199,0.08);
  --amber:  #b07a18;  --amber-bg:rgba(176,122,24,0.09);
  --green:  #4a7c5e;  --red:     #b84030;

  /* Radii */
  --r:  6px;  --r2: 10px;  --r3: 14px;

  /* Nav height */
  --nav-h: 52px;
}

/* ── RESET ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--txt);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}
input, textarea, select, button { font-family: inherit; }
button { cursor: pointer; }
a { color: var(--dev); text-decoration: none; }
a:hover { text-decoration: underline; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bdr2); border-radius: 4px; }

/* ── NAVIGATION ──────────────────────────────────────────────── */
.app-nav {
  position: sticky; top: 0; z-index: 200;
  height: var(--nav-h);
  background: var(--white);
  border-bottom: 1px solid var(--bdr);
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 1rem;
}
.nav-brand {
  display: flex; align-items: center; gap: 8px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 600; font-size: 16px;
  color: var(--txt); cursor: pointer;
  text-decoration: none; white-space: nowrap;
}
.brand-dot {
  width: 26px; height: 26px;
  border-radius: 50%; overflow: hidden; flex-shrink: 0;
  background: var(--car-bg);
}
.brand-dot img { width: 100%; height: 100%; object-fit: cover; }
.nav-links {
  display: flex; gap: 4px;
  position: absolute; left: 50%; transform: translateX(-50%);
}
.nav-link {
  font-size: 13px; padding: .45rem 1rem;
  border-radius: 20px; border: 1px solid transparent;
  color: var(--txt2); transition: all .14s;
  white-space: nowrap;
}
.nav-link:hover { background: var(--bg3); color: var(--txt); text-decoration: none; }
.nav-link.active { background: var(--car-bg); color: var(--car); border-color: rgba(74,124,94,.25); }
.nav-right { display: flex; align-items: center; gap: 8px; }

/* Trial badge */
.trial-badge {
  font-family: 'DM Mono', monospace; font-size: 10px;
  padding: 2px 8px; border-radius: 10px;
  background: var(--amber-bg); color: var(--amber);
  border: 1px solid rgba(176,122,24,.25);
  white-space: nowrap;
}
.trial-badge.expired { background: rgba(184,64,48,.08); color: var(--red); border-color: rgba(184,64,48,.25); }

.nav-btn-upgrade {
  font-family: 'DM Mono', monospace; font-size: 11px;
  padding: 5px 14px; border-radius: 5px;
  background: var(--car); color: #f0ece4;
  border: none; white-space: nowrap; transition: all .14s;
}
.nav-btn-upgrade:hover { background: #3a6450; text-decoration: none; }

/* User menu */
.nav-user-menu { position: relative; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.nav-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--dev-bg); color: var(--dev);
  font-family: 'DM Mono', monospace; font-size: 12px; font-weight: 500;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(58,111,199,.25);
}
.nav-username { font-size: 12px; color: var(--txt2); }
.nav-dropdown {
  display: none; position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--surface); border: 1px solid var(--bdr2);
  border-radius: var(--r2); padding: 6px;
  min-width: 180px; box-shadow: 0 4px 20px rgba(30,28,24,.12);
  z-index: 999;
}
.nav-dropdown.open { display: block; }
.nav-dropdown a, .nav-dropdown hr {
  display: block; padding: 7px 10px;
  font-size: 12px; color: var(--txt2); border-radius: var(--r);
  transition: background .1s;
}
.nav-dropdown hr { border: none; border-top: 1px solid var(--bdr); margin: 4px 0; padding: 0; }
.nav-dropdown a:hover { background: var(--bg3); color: var(--txt); text-decoration: none; }

/* ── PAGE WRAPPER ────────────────────────────────────────────── */
.page-wrap { padding: 24px; max-width: 1400px; margin: 0 auto; }
.tool-page-wrap { padding: 1rem; }

/* ── CARDS & PANELS ─────────────────────────────────────────── */
.card { background: var(--bg2); border: 1px solid var(--bdr); border-radius: var(--r2); padding: 18px; }
.panel { background: var(--bg2); border: 1px solid var(--bdr); border-radius: var(--r2); overflow: hidden; margin-bottom: 1.25rem; }
.panel:last-child { margin-bottom: 0; }
.panel-header {
  display: flex; align-items: center; gap: .75rem;
  padding: .85rem 1.25rem; border-bottom: 1px solid var(--bdr);
}
.panel-body { padding: 1.25rem; }

/* ── FORMS ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group:last-child { margin-bottom: 0; }
.form-label {
  font-family: 'DM Mono', monospace; font-size: 10px;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--txt3); margin-bottom: .3rem;
  display: flex; justify-content: space-between; align-items: center;
}
.form-input, .form-select, .form-textarea {
  width: 100%; background: var(--bg3);
  border: 1px solid var(--bdr2); border-radius: 5px;
  padding: .55rem .8rem;
  font-family: 'DM Mono', monospace; font-size: 12px;
  color: var(--txt); outline: none;
  transition: border-color .15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--bdr3); }
.form-input::placeholder, .form-textarea::placeholder { color: var(--txt3); }
.form-textarea { resize: vertical; min-height: 72px; line-height: 1.6; }
.form-select { cursor: pointer; }
.form-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.form-grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .75rem; }
.form-error {
  font-family: 'DM Mono', monospace; font-size: 11px;
  color: var(--red); margin-top: .3rem;
}
.form-section {
  border: 1px solid var(--bdr); border-radius: var(--r2);
  padding: 14px; margin-bottom: 14px; background: var(--bg2);
}
.form-section-title {
  font-family: 'DM Mono', monospace; font-size: 11px;
  font-weight: 500; color: var(--car);
  margin-bottom: 12px; text-transform: uppercase; letter-spacing: .06em;
}

/* ── BUTTONS ─────────────────────────────────────────────────── */
.btn {
  font-family: 'DM Mono', monospace; font-size: 11px;
  padding: 7px 16px; border-radius: 5px; border: 1px solid;
  letter-spacing: .04em; transition: all .15s; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
}
.btn-primary { background: var(--car); border-color: var(--car); color: #f0ece4; }
.btn-primary:hover { background: #3a6450; border-color: #3a6450; }
.btn-car   { background: var(--car-bg); border-color: rgba(74,124,94,.3); color: var(--car); }
.btn-fp    { background: var(--fp-bg);  border-color: rgba(90,90,171,.3);  color: var(--fp);  }
.btn-bsp   { background: var(--bsp-bg); border-color: rgba(184,92,56,.3);  color: var(--bsp); }
.btn-dev   { background: var(--dev-bg); border-color: rgba(58,111,199,.3); color: var(--dev); }
.btn-ghost { background: transparent; border-color: var(--bdr2); color: var(--txt2); }
.btn-ghost:hover { background: var(--bg3); color: var(--txt); }
.btn-danger { color: var(--red); border-color: rgba(184,64,48,.25); background: transparent; }
.btn-danger:hover { background: rgba(184,64,48,.08); }
.btn-car:hover   { background: rgba(74,124,94,.15); }
.btn-fp:hover    { background: rgba(90,90,171,.15); }
.btn-bsp:hover   { background: rgba(184,92,56,.15); }
.btn-dev:hover   { background: rgba(58,111,199,.15); }
.btn-sm  { font-size: 10px; padding: 4px 10px; }
.btn-xs  { font-size: 10px; padding: 3px 7px; }

/* ── ALERTS ──────────────────────────────────────────────────── */
.alert {
  padding: .75rem 1rem; border-radius: var(--r);
  font-size: 12px; margin-bottom: 1rem;
  border-left: 3px solid;
}
.alert-success { background: var(--car-bg); border-color: var(--car); color: var(--car); }
.alert-error   { background: rgba(184,64,48,.08); border-color: var(--red); color: var(--red); }
.alert-warning { background: var(--amber-bg); border-color: var(--amber); color: var(--amber); }
.alert-info    { background: var(--dev-bg); border-color: var(--dev); color: var(--dev); }

/* ── CALLOUT ─────────────────────────────────────────────────── */
.callout {
  background: var(--bg3); border-left: 3px solid var(--bdr2);
  border-radius: 0 5px 5px 0; padding: .75rem 1rem;
  font-size: 12px; color: var(--txt2); line-height: 1.65; margin: .75rem 0;
}
.callout-label {
  font-family: 'DM Mono', monospace; font-size: 9px;
  letter-spacing: .1em; text-transform: uppercase; margin-bottom: .3rem;
}

/* ── SAVE BAR (sticky, tool pages) ──────────────────────────── */
.save-bar {
  position: sticky; top: var(--nav-h); z-index: 100;
  background: var(--surface); border-bottom: 1px solid var(--bdr);
  padding: .55rem 1rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.save-bar-left { display: flex; align-items: center; gap: .75rem; }
.save-status {
  font-family: 'DM Mono', monospace; font-size: 10px;
  color: var(--txt3);
}
.save-status.dirty { color: var(--amber); }
.save-status.saved { color: var(--car); }

/* ── TOAST ───────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999;
  background: var(--bg4); border: 1px solid var(--bdr2);
  border-radius: 7px; padding: .6rem 1rem;
  font-family: 'DM Mono', monospace; font-size: 11px; color: var(--txt);
  opacity: 0; transform: translateY(8px);
  transition: all .2s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-color: var(--car); }
.toast.error   { border-color: var(--red); }

/* ── DIVIDER ─────────────────────────────────────────────────── */
.sdiv { display: flex; align-items: center; gap: .75rem; margin: .75rem 0; }
.sdiv-label {
  font-family: 'DM Mono', monospace; font-size: 9px;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--txt3); white-space: nowrap;
}
.sdiv-line { flex: 1; height: 1px; background: var(--bdr); }

/* ── MODAL ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(30,28,24,.45); backdrop-filter: blur(4px);
  display: none; align-items: flex-start; justify-content: center;
  padding: 20px; overflow-y: auto;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--bdr2);
  border-radius: var(--r3); width: 100%; max-width: 560px;
  padding: 24px; position: relative; margin: auto;
}
.modal-header {
  display: flex; justify-content: space-between;
  align-items: flex-start; margin-bottom: 20px;
}
.modal-title { font-family: 'Montserrat', sans-serif; font-weight: 600; font-size: 16px; }
.modal-close {
  width: 28px; height: 28px; background: var(--bg3);
  border: 1px solid var(--bdr); border-radius: var(--r);
  color: var(--txt2); cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}

/* ── STATS / METRICS ─────────────────────────────────────────── */
.stat-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 1px; background: var(--bdr); border: 1px solid var(--bdr);
  border-radius: 6px; overflow: hidden; margin-top: .75rem;
}
.stat-cell { background: var(--bg3); padding: .7rem .9rem; }
.stat-cell-label {
  font-family: 'DM Mono', monospace; font-size: 9px;
  color: var(--txt3); text-transform: uppercase;
  letter-spacing: .06em; margin-bottom: .2rem;
}
.stat-cell-val { font-family: 'DM Mono', monospace; font-size: 15px; font-weight: 500; color: var(--txt); }
.stat-cell-sub { font-family: 'DM Mono', monospace; font-size: 10px; color: var(--txt3); margin-top: .1rem; }

/* ── RESULT BOX ──────────────────────────────────────────────── */
.result-box {
  background: var(--bg3); border: 1px solid var(--bdr);
  border-radius: 6px; padding: 1rem;
  font-family: 'DM Mono', monospace; font-size: 12px;
  line-height: 1.7; color: var(--txt2);
  word-break: break-all; white-space: pre-wrap;
  min-height: 48px; margin-top: .75rem; position: relative;
}
.copy-btn {
  position: absolute; top: .6rem; right: .6rem;
  font-family: 'DM Mono', monospace; font-size: 9px;
  padding: 3px 8px; background: var(--bg4);
  border: 1px solid var(--bdr2); border-radius: 4px;
  color: var(--txt3); cursor: pointer;
}
.copy-btn:hover { color: var(--txt); }

/* ── DASHBOARD GRID ──────────────────────────────────────────── */
.session-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.session-card {
  background: var(--bg2); border: 1px solid var(--bdr);
  border-radius: var(--r2); padding: 16px; cursor: pointer;
  transition: all .17s; position: relative; overflow: hidden;
}
.session-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 2px;
}
.session-card.tool-design::before  { background: var(--car); }
.session-card.tool-create::before  { background: var(--dev); }
.session-card.tool-develop::before { background: var(--amber); }
.session-card:hover { border-color: var(--bdr2); transform: translateY(-1px); }
.session-card-title { font-weight: 500; font-size: 13px; margin-bottom: 4px; }
.session-card-meta {
  font-family: 'DM Mono', monospace; font-size: 10px;
  color: var(--txt3); margin-bottom: 8px;
}
.session-card-badge {
  font-family: 'DM Mono', monospace; font-size: 9px;
  padding: 2px 7px; border-radius: 10px; display: inline-block;
}
.badge-design  { background: var(--car-bg); color: var(--car); }
.badge-create  { background: var(--dev-bg); color: var(--dev); }
.badge-develop { background: var(--amber-bg); color: var(--amber); }

/* ── AUTH PAGES ──────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  padding: 2rem; background: var(--bg);
}
.auth-card {
  background: var(--surface); border: 1px solid var(--bdr2);
  border-radius: var(--r3); padding: 2.5rem;
  width: 100%; max-width: 440px;
}
.auth-logo {
  display: flex; align-items: center; gap: 10px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700; font-size: 20px;
  color: var(--txt); margin-bottom: 1.75rem;
  justify-content: center;
}
.auth-title {
  font-family: 'Montserrat', sans-serif;
  font-weight: 600; font-size: 22px; margin-bottom: .5rem;
}
.auth-sub { font-size: 13px; color: var(--txt2); margin-bottom: 1.5rem; }
.auth-divider {
  display: flex; align-items: center; gap: .75rem;
  margin: 1.25rem 0;
  font-family: 'DM Mono', monospace; font-size: 10px;
  color: var(--txt3); text-transform: uppercase; letter-spacing: .08em;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--bdr);
}
.auth-footer { margin-top: 1.25rem; text-align: center; font-size: 12px; color: var(--txt2); }

/* ── FOOTER ──────────────────────────────────────────────────── */
.app-footer {
  background: var(--bg2); border-top: 1px solid var(--bdr);
  padding: 1rem 20px; margin-top: 3rem;
}
.footer-inner {
  display: flex; align-items: center;
  justify-content: space-between; flex-wrap: wrap; gap: .5rem;
  font-family: 'DM Mono', monospace; font-size: 10px; color: var(--txt3);
}
.footer-links { display: flex; gap: 1rem; flex-wrap: wrap; }
.footer-links a { color: var(--txt3); font-size: 10px; }
.footer-links a:hover { color: var(--txt2); }

/* ── UPGRADE / TRIAL BANNER ──────────────────────────────────── */
.upgrade-banner {
  background: var(--amber-bg); border: 1px solid rgba(176,122,24,.25);
  border-radius: var(--r2); padding: 1rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem; flex-wrap: wrap; gap: .75rem;
}
.upgrade-banner p { font-size: 13px; color: var(--txt2); }
.upgrade-banner strong { color: var(--amber); }

/* ── SPINNER ─────────────────────────────────────────────────── */
.spinning { display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── TAGS ────────────────────────────────────────────────────── */
.tag {
  font-family: 'DM Mono', monospace; font-size: 10px;
  padding: 2px 7px; border-radius: 10px; white-space: nowrap;
}

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-username { display: none; }
  .form-grid, .form-grid3 { grid-template-columns: 1fr; }
  .page-wrap { padding: 16px; }
}
