/* =========================================================
   lamaPhotoResizer — lamaStudio.pk
   Design language: an "official document / passport photo"
   studio — seal & stamp motifs, ledger-style dashboard,
   emerald + gold on warm paper, deep navy dark mode.
   ========================================================= */

:root{
  --paper:        #F6F8F5;
  --paper-raised: #FFFFFF;
  --ink:          #10231C;
  --ink-soft:     #4B5B54;
  --line:         #DCE3DD;
  --line-strong:  #C3CDC5;

  --emerald:      #0F6A52;
  --emerald-dark: #0B5240;
  --gold:         #C98A12;
  --gold-soft:    #F1D9A5;
  --blue:         #1E6FD9;
  --navy:         #0B1F3A;
  --danger:       #B23A34;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --shadow-1: 0 1px 2px rgba(16,35,28,.06), 0 1px 1px rgba(16,35,28,.04);
  --shadow-2: 0 8px 24px rgba(16,35,28,.10);

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  color-scheme: light;
}

[data-theme="dark"]{
  --paper:        #0D1B16;
  --paper-raised: #14261F;
  --ink:          #EAF3EE;
  --ink-soft:     #9EB3A9;
  --line:         #22392F;
  --line-strong:  #2E4C40;

  --emerald:      #35C79A;
  --emerald-dark: #1D8E6C;
  --gold:         #E3B44A;
  --gold-soft:    #4A3E1E;
  --blue:         #5B9CF2;
  --navy:         #1B2A4A;

  --shadow-1: 0 1px 2px rgba(0,0,0,.3);
  --shadow-2: 0 10px 30px rgba(0,0,0,.45);
  color-scheme: dark;
}

*{ box-sizing: border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  transition: background .25s ease, color .25s ease;
}
button, input, select{ font-family: inherit; color: inherit; }
button{ cursor:pointer; }
img{ max-width:100%; display:block; }

.app-shell{ min-height:100vh; display:flex; flex-direction:column; }

/* ---------------- Topbar ---------------- */
.topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-raised);
  position: sticky; top:0; z-index: 20;
}
.brand{ display:flex; align-items:center; gap:12px; }
.brand-seal{ color: var(--emerald); flex-shrink:0; }
.brand-text{ display:flex; flex-direction:column; line-height:1.15; }
.brand-name{ font-family: var(--font-display); font-size: 21px; font-weight:600; letter-spacing:.2px; }
.brand-name em{ font-style: italic; color: var(--emerald); font-weight:600; }
.brand-sub{ font-size: 11.5px; letter-spacing:.14em; text-transform:uppercase; color: var(--ink-soft); margin-top:2px; }

.topbar-actions{ display:flex; align-items:center; gap:10px; }
.privacy-chip{
  display:inline-flex; align-items:center; gap:6px;
  font-size:12.5px; font-weight:600; color: var(--emerald-dark);
  background: color-mix(in srgb, var(--emerald) 12%, transparent);
  border:1px solid color-mix(in srgb, var(--emerald) 30%, transparent);
  padding: 6px 12px; border-radius: 999px;
}
[data-theme="dark"] .privacy-chip{ color: var(--emerald); }
.icon-btn{
  width:36px; height:36px; border-radius: 999px; border:1px solid var(--line);
  background: var(--paper); color: var(--ink); display:flex; align-items:center; justify-content:center;
  transition: border-color .15s, transform .15s;
}
.icon-btn:hover{ border-color: var(--line-strong); transform: translateY(-1px); }

/* ---------------- Body / layout ---------------- */
.app-body{ flex:1; display:flex; min-height:0; }

.sidebar{
  width: 320px; flex-shrink:0;
  background: var(--paper-raised);
  border-right: 1px solid var(--line);
  display:flex; flex-direction:column;
  height: calc(100vh - 65px);
  position: sticky; top:65px;
}
.sidebar-scroll{ flex:1; overflow-y:auto; padding: 20px 20px 8px; }
.sidebar-footer{
  padding: 16px 20px 20px; border-top:1px solid var(--line);
  display:flex; flex-direction:column; gap:10px;
}

.panel{ padding: 16px 0; border-bottom: 1px solid var(--line); }
.panel:first-child{ padding-top:2px; }
.panel-title{
  margin:0 0 6px; font-family: var(--font-body); font-weight:700; font-size:13.5px;
  letter-spacing:.02em; display:flex; align-items:baseline; gap:8px;
}
.eyebrow{
  font-family: var(--font-mono); font-size: 11px; color: var(--gold);
  border: 1px solid color-mix(in srgb, var(--gold) 50%, transparent);
  border-radius:5px; padding: 1px 5px;
}
.panel-hint{ margin: 0 0 12px; font-size: 12.5px; color: var(--ink-soft); }

.swatch-row{ display:flex; flex-direction:column; gap:8px; }
.swatch{
  display:flex; align-items:center; gap:10px;
  border:1px solid var(--line); background: var(--paper);
  border-radius: var(--radius-sm); padding: 9px 12px; font-size:13.5px; font-weight:500;
  text-align:left; transition: border-color .15s, background .15s;
}
.swatch[aria-pressed="true"]{ border-color: var(--emerald); background: color-mix(in srgb, var(--emerald) 8%, var(--paper)); }
.swatch:hover{ border-color: var(--line-strong); }
.swatch-chip{ width:18px; height:18px; border-radius:50%; flex-shrink:0; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.chip-none{ background: repeating-conic-gradient(#cfd6d0 0% 25%, transparent 0% 50%) 0 0/10px 10px; }

.field{ display:flex; flex-direction:column; gap:6px; font-size:12.5px; font-weight:600; color: var(--ink-soft); margin-bottom:10px; }
.field-row{ margin-bottom:10px; }
.field-row.two-col{ display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:0; }
.field-row.two-col .field{ margin-bottom:0; }

input[type="number"], input[type="text"], .select{
  border:1px solid var(--line-strong); background: var(--paper); color: var(--ink);
  border-radius: var(--radius-sm); padding: 9px 10px; font-size: 13.5px; font-family: var(--font-mono);
  width:100%;
}
.select{ font-family: var(--font-body); }
input[type="number"]:focus, input[type="text"]:focus, .select:focus, button:focus-visible, .swatch:focus-visible{
  outline: 2px solid var(--emerald); outline-offset: 1px;
}

.check-row{ display:flex; align-items:center; gap:8px; font-size:13px; margin-top:12px; color: var(--ink-soft); }
.check-row input{ width:16px; height:16px; accent-color: var(--emerald); }

.preset-panel{ border-bottom:none; }
.preset-status{ font-size:12px; color: var(--emerald-dark); margin-top:8px; min-height:16px; }
[data-theme="dark"] .preset-status{ color: var(--emerald); }

/* ---------------- Buttons ---------------- */
.btn{
  border-radius: var(--radius-sm); padding: 11px 16px; font-weight:600; font-size:13.5px;
  border:1px solid transparent; transition: transform .12s ease, box-shadow .12s ease, opacity .12s;
}
.btn:disabled{ opacity:.45; cursor:not-allowed; }
.btn-block{ width:100%; }
.btn-primary{ background: var(--emerald); color:#fff; }
.btn-primary:hover:not(:disabled){ background: var(--emerald-dark); }
.btn-accent{ background: var(--gold); color:#291d02; }
.btn-accent:hover:not(:disabled){ filter: brightness(0.94); }
.btn-ghost{ background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover:not(:disabled){ border-color: var(--emerald); color: var(--emerald-dark); }
.btn-small{ padding:7px 10px; font-size:12.5px; }
.link-btn{ background:none; border:none; color: var(--emerald-dark); font-weight:600; font-size:12.5px; text-decoration: underline; padding:0; }
[data-theme="dark"] .link-btn{ color: var(--emerald); }

/* ---------------- Main / dropzone ---------------- */
.main{ flex:1; min-width:0; padding: 26px 30px 60px; }

.dropzone{
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--paper-raised);
  padding: 44px 20px;
  text-align:center;
  cursor:pointer;
  transition: border-color .18s, background .18s;
}
.dropzone:hover, .dropzone.dragover{
  border-color: var(--emerald);
  background: color-mix(in srgb, var(--emerald) 6%, var(--paper-raised));
}
.dropzone-inner{ display:flex; flex-direction:column; align-items:center; gap:8px; color: var(--ink-soft); }
.dropzone-inner svg{ color: var(--emerald); margin-bottom:4px; }
.dz-title{ margin:0; font-family: var(--font-display); font-size:19px; font-weight:600; color: var(--ink); }
.dz-sub{ margin:0; font-size:12.5px; letter-spacing:.03em; }

.batch-bar{
  display:flex; align-items:center; gap:8px;
  margin: 18px 2px 6px; font-size:13px; color: var(--ink-soft); font-family: var(--font-mono);
}
.batch-bar .dot{ opacity:.5; }
#batchStatus{ color: var(--emerald-dark); font-weight:600; }
[data-theme="dark"] #batchStatus{ color: var(--emerald); }
.batch-bar .link-btn{ margin-left:auto; }

.empty-note{ text-align:center; color: var(--ink-soft); font-size:13px; margin-top:40px; }
.grid:not(:empty) + .empty-note{ display:none; }

.grid{
  display:grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr));
  gap:18px; margin-top:18px;
}

/* ---------------- Card ---------------- */
.card{
  background: var(--paper-raised);
  border:1px solid var(--line);
  border-radius: var(--radius-md);
  overflow:hidden;
  box-shadow: var(--shadow-1);
  display:flex; flex-direction:column;
}
.card-media{ display:grid; grid-template-columns: 1fr 1fr; gap:1px; background: var(--line); }
.img-pane{ position:relative; background: repeating-conic-gradient(#e9ede8 0% 25%, #f4f6f2 0% 50%) 0 0/16px 16px; aspect-ratio: 1/1; display:flex; align-items:center; justify-content:center; overflow:hidden; }
[data-theme="dark"] .img-pane{ background: repeating-conic-gradient(#152720 0% 25%, #10201a 0% 50%) 0 0/16px 16px; }
.img-pane img{ width:100%; height:100%; object-fit:contain; }
.pane-tag{
  position:absolute; left:6px; top:6px; font-size:10px; font-weight:700; letter-spacing:.06em; text-transform:uppercase;
  background: rgba(16,35,28,.72); color:#fff; padding:2px 7px; border-radius:5px;
}
.pane-tag-accent{ background: color-mix(in srgb, var(--gold) 85%, black 15%); }
.spinner{
  width:22px; height:22px; border-radius:50%;
  border:2.5px solid var(--line-strong); border-top-color: var(--emerald);
  animation: spin .8s linear infinite;
}
@keyframes spin{ to{ transform: rotate(360deg); } }
.stamp-badge{
  position:absolute; right:6px; bottom:6px; color: var(--emerald);
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.25));
  animation: stampIn .35s cubic-bezier(.2,1.4,.4,1);
}
@keyframes stampIn{ from{ transform: scale(1.6) rotate(-14deg); opacity:0; } to{ transform: scale(1) rotate(-8deg); opacity:1; } }

.card-meta{ padding: 10px 12px 4px; }
.card-name{ font-size:12.5px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.card-stats{ display:flex; gap:10px; margin-top:4px; font-family: var(--font-mono); font-size:11.5px; color: var(--ink-soft); }
.stat-size.ok{ color: var(--emerald-dark); }
[data-theme="dark"] .stat-size.ok{ color: var(--emerald); }
.stat-size.warn{ color: var(--danger); }

.card-actions{ display:flex; gap:8px; padding: 10px 12px 12px; }
.card-actions .btn{ flex:1; }

/* ---------------- Footer ---------------- */
.app-footer{
  text-align:center; font-size:11.5px; color: var(--ink-soft);
  padding: 16px; border-top:1px solid var(--line); background: var(--paper-raised);
}

/* ---------------- Responsive ---------------- */
@media (max-width: 920px){
  .app-body{ flex-direction:column; }
  .sidebar{
    width:100%; height:auto; position:relative; top:0;
    border-right:none; border-bottom:1px solid var(--line);
  }
  .sidebar-scroll{ max-height: 46vh; }
  .main{ padding: 20px 16px 50px; }
}
@media (max-width: 480px){
  .topbar{ padding: 12px 16px; }
  .brand-sub{ display:none; }
  .card-media{ grid-template-columns: 1fr 1fr; }
}

/* =========================================================
   v2 additions — license chip, engine switch, upgrade modal
   ========================================================= */

.license-chip{
  display:inline-flex; align-items:center; gap:7px;
  font-size:12.5px; font-weight:600;
  border:1px solid var(--line-strong); border-radius:999px;
  padding: 6px 12px; color: var(--ink-soft);
}
.license-dot{ width:8px; height:8px; border-radius:50%; background: var(--ink-soft); flex-shrink:0; }
.license-chip.trial .license-dot{ background: var(--gold); }
.license-chip.active .license-dot{ background: var(--emerald); }
.license-chip.expired .license-dot{ background: var(--danger); }

.bg-ai-status{ font-size:11.5px; color: var(--ink-soft); margin: 8px 0 0; min-height:14px; }

.engine-row{ display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-bottom:12px; }
.engine-btn{
  border:1px solid var(--line); background: var(--paper); border-radius: var(--radius-sm);
  padding: 9px 10px; text-align:left; display:flex; flex-direction:column; gap:2px;
  transition: border-color .15s, background .15s;
}
.engine-btn strong{ font-size:12.5px; }
.engine-btn span{ font-size:10.5px; color: var(--ink-soft); }
.engine-btn[aria-pressed="true"]{ border-color: var(--emerald); background: color-mix(in srgb, var(--emerald) 8%, var(--paper)); }

.removebg-key-row{ margin-bottom:14px; padding: 10px; border:1px dashed var(--line-strong); border-radius: var(--radius-sm); }
.removebg-key-row code{ font-family: var(--font-mono); font-size:11px; background: var(--paper); padding:1px 4px; border-radius:4px; }
.removebg-key-row a{ color: var(--emerald-dark); }
[data-theme="dark"] .removebg-key-row a{ color: var(--emerald); }

/* ---------------- Modal ---------------- */
.modal-backdrop{
  position: fixed; inset:0; background: rgba(10,18,15,.55);
  display:flex; align-items:center; justify-content:center; padding: 20px; z-index: 100;
}
.modal-backdrop[hidden]{ display:none; }
.modal{
  width:100%; max-width: 460px; max-height: 90vh; overflow-y:auto;
  background: var(--paper-raised); border-radius: var(--radius-lg); box-shadow: var(--shadow-2);
}
.modal-head{
  display:flex; align-items:center; justify-content:space-between;
  padding: 18px 20px; border-bottom:1px solid var(--line);
}
.modal-head h2{ margin:0; font-family: var(--font-display); font-size:19px; }
.modal-body{ padding: 18px 20px 22px; }

.plan-row{ display:grid; grid-template-columns: repeat(3,1fr); gap:8px; margin: 14px 0; }
.plan-btn{
  border:1px solid var(--line); background: var(--paper); border-radius: var(--radius-sm);
  padding: 10px 6px; text-align:center; display:flex; flex-direction:column; gap:3px;
}
.plan-btn strong{ font-size:12.5px; }
.plan-btn span{ font-size:10.5px; color: var(--ink-soft); font-family: var(--font-mono); }
.plan-btn[aria-pressed="true"]{ border-color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, var(--paper)); }

#paymentClaimForm .field{ margin-bottom:10px; }
.claim-status{ font-size:12.5px; margin-top:10px; min-height:16px; }
.claim-status.ok{ color: var(--emerald-dark); }
[data-theme="dark"] .claim-status.ok{ color: var(--emerald); }
.claim-status.error{ color: var(--danger); }

@media (max-width: 480px){
  .plan-row{ grid-template-columns: 1fr; }
  .engine-row{ grid-template-columns: 1fr; }
}
