/* pandadesk light — app.css */

/* ============================================================
   CSS Variables
============================================================ */
:root {
  --sidebar-width:    280px;
  --header-height:    52px;
  --footer-height:    36px;
  --ad-leaderboard-h: 58px;
  --bg:               #f5f5f4;
  --surface:          #ffffff;
  --border:           #e5e5e4;
  --text:             #1c1917;
  --text-muted:       #78716c;
  --accent:           #16a34a;
  --accent-hover:     #15803d;
  --danger:           #dc2626;
  --danger-hover:     #b91c1c;
  --radius:           8px;
  --shadow:           0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  font-family: 'DM Sans', sans-serif;
}

/* ============================================================
   Reset
============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
button { cursor: pointer; font-family: inherit; }
input  { font-family: inherit; }
ul { list-style: none; }

/* ============================================================
   Header
============================================================ */
.app-header {
  height: var(--header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  flex-shrink: 0;
  z-index: 50;
}
.app-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}
.app-logo .logo-light {
  color: var(--accent);
  font-weight: 400;
}
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.header-tagline { font-size: 12px; color: var(--text-muted); }

/* ============================================================
   Footer
============================================================ */
.app-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: var(--footer-height);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-muted);
  z-index: 100;
  gap: 4px;
}
.app-footer a {
  color: var(--accent);
  text-decoration: none;
}
.app-footer a:hover {
  text-decoration: underline;
}

/* ============================================================
   Ad slots
============================================================ */
.ad-leaderboard {
  background: #fafaf9;
  border-bottom: none;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 0;
  padding: 0;
  flex-shrink: 0;
  overflow: hidden;
}
.ad-column {
  width: 0;
  min-width: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  background: var(--surface);
  border: none;
  overflow: hidden;
}
.ad-column__label {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
/* Placeholder styling — remove once real ads are live */
.ad-placeholder {
  background: #f0f0ef;
  border: 1px dashed #ccc;
  color: #aaa;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}
.ad-placeholder--leaderboard { width: 728px; height: 44px; }
.ad-placeholder--skyscraper  { width: 120px; height: 600px; }

/* ============================================================
   Notification / Error bars
============================================================ */
.notif-bar {
  background: #dcfce7;
  color: #166534;
  font-size: 13px;
  padding: 6px 20px;
  flex-shrink: 0;
}
.error-bar {
  background: #fee2e2;
  color: #991b1b;
  font-size: 13px;
  padding: 6px 20px;
  flex-shrink: 0;
  cursor: pointer;
}

/* ============================================================
   Workspace
============================================================ */
.workspace {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}
.workspace--empty .sidebar,
.workspace--empty .sidebar-resize-handle { display: none; }

/* ============================================================
   Sidebar
============================================================ */
.sidebar {
  width: var(--sidebar-width);
  min-width: 200px;
  max-width: 480px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 12px;
  overflow-y: auto;
  flex-shrink: 0;
}
.sidebar-spacer { flex: 1; }

.sidebar-resize-handle {
  width: 6px;
  cursor: col-resize;
  background: transparent;
  transition: background .15s;
  flex-shrink: 0;
}
.sidebar-resize-handle:hover { background: var(--border); }

/* ============================================================
   Upload zone
============================================================ */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px 12px;
  text-align: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  transition: border-color .15s, background .15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.upload-zone:hover, .upload-zone.drag-active {
  border-color: var(--accent);
  background: #f0fdf4;
  color: var(--accent);
}
.upload-zone svg { opacity: .6; }
.upload-zone p { line-height: 1.5; }
.upload-zone small { font-size: 11px; opacity: .7; }

/* ============================================================
   File list
============================================================ */
.file-list { display: flex; flex-direction: column; gap: 4px; }
.file-list__item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 0;
}
.file-list__name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-list__del {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
  transition: background .12s, color .12s;
}
.file-list__del:hover { background: #fee2e2; color: var(--danger); }

/* ============================================================
   Thumbnail size slider
============================================================ */
.thumb-size-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.thumb-size-row input[type=range] { width: 100%; accent-color: var(--accent); }

/* ============================================================
   Save section
============================================================ */
.save-section { display: flex; flex-direction: column; gap: 8px; }
.filename-input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color .15s;
}
.filename-input:focus { border-color: var(--accent); }

/* ============================================================
   Buttons
============================================================ */
.btn {
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn--primary  { background: var(--accent); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn--primary:disabled { opacity: .5; cursor: not-allowed; }
.btn--ghost    { background: transparent; border-color: var(--border); color: var(--text-muted); }
.btn--ghost:hover { background: var(--bg); color: var(--text); }
.btn--full     { width: 100%; }

/* ============================================================
   Main panel
============================================================ */
.main-panel {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  padding-bottom: var(--footer-height);
  display: flex;
  flex-direction: column;
}

/* ============================================================
   Empty state
============================================================ */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-muted);
  text-align: center;
  padding: 40px;
}
.empty-state svg { opacity: .3; }
.empty-state h2 { font-size: 20px; font-weight: 600; color: var(--text); }
.empty-state p  { font-size: 13px; max-width: 360px; line-height: 1.6; }

/* ============================================================
   Page grid
============================================================ */
.page-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-content: flex-start;
}

/* ============================================================
   Thumbnail card
============================================================ */
.page-thumb {
  position: relative;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: grab;
  transition: transform .12s, box-shadow .12s;
  user-select: none;
}
.page-thumb:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.page-thumb.dragging { opacity: .45; cursor: grabbing; }
.page-thumb.drag-over { outline: 2px solid var(--accent); outline-offset: 2px; }

.page-thumb canvas { display: block; width: 100%; height: auto; }

.page-thumb__label {
  font-size: 10px;
  color: var(--text-muted);
  padding: 4px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--surface);
}

/* Action pill */
.page-thumb__actions {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,.92);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 6px;
  opacity: 0;
  transition: opacity .15s;
  pointer-events: none;
  backdrop-filter: blur(4px);
}
.page-thumb:hover .page-thumb__actions {
  opacity: 1;
  pointer-events: all;
}

.thumb-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: background .12s, color .12s;
}
.thumb-btn:hover         { background: var(--bg); color: var(--text); }
.thumb-btn--danger:hover { background: #fee2e2;   color: var(--danger); }

/* ============================================================
   Zoom modal
============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(2px);
}
.modal-box {
  background: var(--surface);
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  position: relative;
  padding: 16px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
}
.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 16px;
  color: var(--text-muted);
  cursor: pointer;
}
.modal-close:hover { color: var(--text); }
.zoom-canvas-container canvas { display: block; max-width: 80vw; max-height: 80vh; }

/* ============================================================
   Converter page — secondary outlined button
============================================================ */
.btn-secondary {
  background: #fff;
  border: 1px solid #e5e5e4;
  border-radius: 6px;
  font-size: 13px;
  padding: 6px 14px;
  cursor: pointer;
  color: #1c1917;
  font-family: inherit;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-secondary:hover {
  background: #f5f5f4;
  border-color: #d4d4d2;
}

/* ============================================================
   Converter page — JSON mode toggle
============================================================ */
.json-mode-btn {
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 6px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease;
}
.json-mode-btn--active  { background: #16a34a; color: #fff; border: none; }
.json-mode-btn--inactive { background: #fff; border: 1px solid #e5e5e4; color: #78716c; }
.json-mode-btn--inactive:hover { background: #f5f5f4; }

/* ============================================================
   Alpine [x-cloak]
============================================================ */
[x-cloak] { display: none !important; }
