/* RedLinz Web App — app.css */
:root {
  --bg: #0a0a0a;
  --surface: #111;
  --surface-2: #181818;
  --border: #2a2a2a;
  --text: #f0f0f0;
  --muted: #888;
  --red: #E8201A;
  --blue: #6C8EFF;
  --radius: 10px;
  --font: 'Inter', system-ui, sans-serif;
  --header-h: 56px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body { font-family: var(--font); background: var(--bg); color: var(--text); display: flex; flex-direction: column; -webkit-font-smoothing: antialiased; }

/* ── HEADER ── */
.app-header {
  height: var(--header-h);
  background: rgba(10,10,10,0.97);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
  flex-shrink: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
}
.app-logo img { height: 28px; width: auto; object-fit: contain; display: block; }
.app-header-center {
  flex: 1;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  pointer-events: none;
}
.app-header-right { display: flex; align-items: center; gap: 8px; }

.hdr-btn {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px; font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.hdr-btn:hover { background: var(--surface-2); color: var(--text); border-color: #444; }
.hdr-btn-export {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  position: relative;
}
.hdr-btn-export:hover { background: #c41a15; border-color: #c41a15; }

.export-count {
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; color: var(--red);
  border-radius: 10px; min-width: 18px; height: 18px;
  font-size: 11px; font-weight: 800;
  padding: 0 4px; margin-left: 2px;
}

/* ── MAIN ── */
.app-main {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* ── TOOLBAR ── */
.toolbar {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  background: rgba(15,17,28,0.97);
  border: 1.5px solid rgba(108,142,255,0.3);
  border-radius: 18px;
  padding: 12px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  backdrop-filter: blur(20px);
  user-select: none;
}

.toolbar-drag {
  width: 28px; height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  cursor: grab; margin-bottom: 4px;
}
.toolbar-drag:active { cursor: grabbing; }

.tb-section { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tb-divider { width: 28px; height: 1px; background: rgba(255,255,255,0.08); margin: 4px 0; }

.tb-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1.5px solid transparent;
  background: transparent;
  color: rgba(255,255,255,0.5);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.15s;
}
.tb-btn:hover { background: rgba(108,142,255,0.15); color: #fff; }
.tb-btn.active { background: rgba(108,142,255,0.25); color: var(--blue); border-color: rgba(108,142,255,0.5); }

.tb-swatch {
  width: 20px; height: 20px; border-radius: 50%;
  cursor: pointer; border: 2px solid transparent;
  transition: transform 0.12s, border-color 0.12s;
}
.tb-swatch:hover { transform: scale(1.2); }
.tb-swatch.active { border-color: #fff; transform: scale(1.15); }

.tb-size {
  border-radius: 50%;
  background: rgba(255,255,255,0.65);
  cursor: pointer;
  transition: transform 0.12s, background 0.12s;
}
.tb-size:hover { background: var(--blue); transform: scale(1.2); }
.tb-size.active { background: var(--blue); transform: scale(1.1); }

/* ── CANVAS AREA ── */
.canvas-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  background: #0d0d0d;
  background-image: radial-gradient(rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* DROP ZONE */
.dropzone {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  transition: background 0.2s;
}
.dropzone.drag-over { background: rgba(108,142,255,0.06); }
.dropzone-inner {
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.dropzone-inner h2 { font-size: 22px; font-weight: 700; color: rgba(255,255,255,0.5); }
.dropzone-inner p { font-size: 14px; color: var(--muted); }

.upload-btn {
  display: inline-flex; align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text); font-size: 13px; font-weight: 600;
  padding: 8px 20px; cursor: pointer;
  transition: all 0.15s; margin-top: 4px;
}
.upload-btn:hover { background: var(--surface-2); border-color: #444; }

/* CANVAS WRAPPER */
.canvas-wrapper {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  line-height: 0;
}
#bgCanvas, #drawCanvas {
  display: block;
  max-width: calc(100vw - 100px);
  max-height: calc(100vh - var(--header-h) - 40px);
}
#bgCanvas { position: absolute; top: 0; left: 0; }
#drawCanvas { position: relative; cursor: crosshair; }
#drawCanvas.tool-text { cursor: text; }

.inline-text-input {
  position: absolute;
  background: rgba(15,17,28,0.96);
  border: 1.5px solid var(--blue);
  border-radius: 8px;
  color: #fff;
  font-size: 14px; font-weight: 600;
  padding: 6px 10px; min-width: 160px;
  outline: none; z-index: 100;
  font-family: var(--font);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

/* ── EXPORT MODAL ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
}
.modal-box {
  background: #0F1120;
  border: 1.5px solid rgba(108,142,255,0.4);
  border-radius: 20px;
  padding: 28px 32px;
  width: 580px; max-width: 92vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.8);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.modal-header h2 { font-size: 18px; font-weight: 700; font-family: 'Space Grotesk', sans-serif; }
.modal-close {
  background: none; border: none; color: var(--muted);
  cursor: pointer; padding: 4px; border-radius: 6px; transition: color 0.15s;
}
.modal-close:hover { color: var(--text); }
.modal-sub { font-size: 13px; color: var(--muted); margin-bottom: 16px; line-height: 1.6; }
#modalPreview {
  width: 100%; border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 16px; display: block;
}
#modalPrompt {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(108,142,255,0.25);
  border-radius: 12px;
  color: rgba(255,255,255,0.8);
  font-size: 13px; line-height: 1.7;
  padding: 14px 16px;
  resize: vertical; min-height: 120px;
  font-family: var(--font);
  margin-bottom: 16px; outline: none;
}
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.modal-btn {
  flex: 1; min-width: 130px;
  padding: 11px 18px;
  border-radius: 100px;
  font-size: 13px; font-weight: 700;
  cursor: pointer; border: 1.5px solid transparent;
  transition: all 0.15s; text-align: center;
}
.modal-btn.primary {
  background: linear-gradient(180deg, #7B9FFF 0%, #5572EE 40%, #3A52D4 100%);
  color: #fff; border-color: rgba(190,205,240,0.5);
  box-shadow: 0 6px 0 #1A30A0, 0 9px 20px rgba(38,64,168,0.4);
}
.modal-btn.primary:active { transform: translateY(4px); box-shadow: 0 2px 0 #1A30A0; }
.modal-btn.secondary {
  background: transparent; color: rgba(255,255,255,0.65);
  border-color: rgba(255,255,255,0.18);
}
.modal-btn.secondary:hover { color: #fff; border-color: rgba(108,142,255,0.5); }
