/* PicPresso - style.css */

:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface2: #f0f3f8;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #eff6ff;
  --success: #16a34a;
  --success-bg: #f0fdf4;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10);
  --transition: 0.2s ease;
  --font: 'Inter', system-ui, sans-serif;
}

.dark {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface2: #172033;
  --border: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --primary: #60a5fa;
  --primary-dark: #3b82f6;
  --primary-light: #1e3a5f;
  --success: #4ade80;
  --success-bg: #052e16;
  --danger: #f87171;
  --danger-bg: #450a0a;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 15px;
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ===== HEADER ===== */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.header-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  text-decoration: none;
}
.logo-icon {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-icon svg { color: white; }
.logo span.accent { color: var(--primary); }
nav { display: flex; align-items: center; gap: 4px; }
nav a {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
  transition: color var(--transition), background var(--transition);
}
nav a:hover { color: var(--text); background: var(--surface2); text-decoration: none; }
.header-right { display: flex; align-items: center; gap: 8px; }
#dark-toggle {
  background: none; border: none; cursor: pointer;
  padding: 7px; border-radius: var(--radius-sm);
  color: var(--text-muted);
  display: flex; align-items: center;
  transition: background var(--transition), color var(--transition);
}
#dark-toggle:hover { background: var(--surface2); color: var(--text); }
#mobile-menu-btn {
  display: none;
  background: none; border: none; cursor: pointer;
  padding: 7px; border-radius: var(--radius-sm);
  color: var(--text-muted);
}
#mobile-nav {
  display: none;
  flex-direction: column;
  border-top: 1px solid var(--border);
  padding: 8px 20px;
  background: var(--surface);
}
#mobile-nav a {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-muted);
}
#mobile-nav a:hover { background: var(--surface2); color: var(--text); text-decoration: none; }
#mobile-nav.open { display: flex; }

/* ===== MAIN ===== */
main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 32px 20px;
  flex: 1;
  width: 100%;
}

/* ===== PAGE HERO ===== */
.hero {
  text-align: center;
  margin-bottom: 32px;
}
.hero h1 {
  font-size: clamp(24px, 5vw, 36px);
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 12px;
}
.hero p {
  color: var(--text-muted);
  font-size: 15px;
  max-width: 560px;
  margin: 0 auto 16px;
}
.format-tags {
  display: flex; flex-wrap: wrap; gap: 6px;
  justify-content: center;
}
.tag {
  font-size: 11px;
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--text-muted);
}
.preset-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.preset-badge::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--primary);
}

/* ===== CARD ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

/* ===== SETTINGS ===== */
.settings-card { margin-bottom: 16px; }
.settings-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 600; color: var(--text);
  margin-bottom: 14px;
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.setting-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.quality-value { color: var(--text); font-weight: 700; }
input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 99px;
  background: var(--border);
  outline: none;
  cursor: pointer;
  accent-color: var(--primary);
  margin-bottom: 4px;
}
.range-labels {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text-muted);
}
input[type="number"], input[type="text"] {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color var(--transition);
}
input[type="number"]:focus, input[type="text"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  cursor: pointer; border: 1px solid transparent;
  transition: all var(--transition);
  font-family: var(--font);
}
.btn-primary {
  background: var(--primary); color: white;
  border-color: var(--primary-dark);
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline {
  background: var(--bg); color: var(--text-muted);
  border-color: var(--border);
}
.btn-outline:hover { color: var(--text); border-color: var(--primary); }
.btn-toggle {
  width: 100%; height: 36px;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer; font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: all var(--transition);
  font-family: var(--font);
}
.btn-toggle.active {
  background: var(--primary); color: white; border-color: var(--primary-dark);
}
.auto-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--primary);
  background: var(--primary-light);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}

/* ===== DROPZONE ===== */
#dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 16px;
  text-align: center;
}
#dropzone:hover, #dropzone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}
#dropzone.drag-over { transform: scale(1.01); }
.drop-icon {
  width: 56px; height: 56px;
  background: var(--surface2);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
#dropzone:hover .drop-icon, #dropzone.drag-over .drop-icon {
  background: rgba(59,130,246,0.15);
}
.drop-title { font-size: 15px; font-weight: 600; color: var(--text); }
.drop-sub { font-size: 12px; color: var(--text-muted); max-width: 400px; }

/* ===== ACTIONS BAR ===== */
.actions-bar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  margin-bottom: 12px;
}
.action-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.status-text { font-size: 13px; color: var(--text-muted); }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== IMAGE CARDS ===== */
.results { display: flex; flex-direction: column; gap: 12px; }
.img-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.img-card-top {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
}
.thumb {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--surface2);
  flex-shrink: 0;
}
.img-info { flex: 1; min-width: 0; }
.img-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.img-meta {
  display: flex; align-items: center; gap: 8px;
  margin-top: 3px; flex-wrap: wrap;
}
.img-status { font-size: 12px; color: var(--text-muted); }
.img-status.done { color: var(--success); font-weight: 500; }
.img-status.error { color: var(--danger); }
.size-info { font-size: 12px; color: var(--text-muted); }
.reduction-badge {
  font-size: 11px; font-weight: 600;
  background: var(--success-bg);
  color: var(--success);
  padding: 2px 7px; border-radius: 99px;
}
.img-card-actions { display: flex; gap: 4px; flex-shrink: 0; }
.icon-btn {
  width: 32px; height: 32px;
  border: none; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; background: none;
  color: var(--text-muted);
  transition: all var(--transition);
}
.icon-btn:hover { background: var(--surface2); color: var(--text); }
.icon-btn.download:hover { background: var(--primary-light); color: var(--primary); }
.icon-btn.remove:hover { background: var(--danger-bg); color: var(--danger); }

/* ===== BEFORE/AFTER PREVIEW ===== */
.preview-section {
  border-top: 1px solid var(--border);
  padding: 16px;
  display: none;
}
.preview-section.open { display: block; }
.preview-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.preview-label {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-align: center; margin-bottom: 6px;
}
.preview-label.compressed { color: var(--success); }
.preview-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  aspect-ratio: 4/3;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.preview-box img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ===== FEATURES ===== */
.features {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
  margin-top: 40px;
}
.feature {
  display: flex; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.feature-icon {
  width: 36px; height: 36px;
  background: var(--primary-light);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--primary);
}
.feature h3 { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.feature p { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* ===== TOOL GRID ===== */
.section-title { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 16px; margin-top: 40px; }
.tool-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-decoration: none; color: inherit;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  display: block;
}
.tool-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  text-decoration: none;
}
.tool-card-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 8px;
}
.tool-card h3 { font-size: 13px; font-weight: 600; color: var(--text); }
.tool-card:hover h3 { color: var(--primary); }
.tool-card p { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.kb-badge {
  font-size: 11px; font-weight: 600;
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 8px; border-radius: 99px;
  margin-bottom: 6px; display: inline-block;
}

/* ===== TRY OTHER SIZES ===== */
.other-sizes { margin-top: 32px; }
.other-sizes h2 { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 12px; }
.size-links { display: flex; flex-wrap: wrap; gap: 8px; }
.size-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 13px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: all var(--transition);
}
.size-link:hover {
  border-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
}

/* ===== SEO TEXT ===== */
.seo-text { margin-top: 32px; }
.seo-text p { font-size: 14px; color: var(--text-muted); line-height: 1.75; margin-bottom: 14px; }

/* ===== RELATED TOOLS ===== */
.related-tools { margin-top: 32px; }
.related-tools h2 { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 12px; }
.related-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.related-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-decoration: none; color: inherit;
  display: block;
  transition: all var(--transition);
}
.related-card:hover { border-color: var(--primary); text-decoration: none; }
.related-card h3 { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.related-card:hover h3 { color: var(--primary); }
.related-card p { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* ===== INFO BOX ===== */
.info-box { margin-top: 32px; }
.info-box h2 { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.info-box p, .info-box li { font-size: 13px; color: var(--text-muted); line-height: 1.6; }
.info-box ol, .info-box ul { padding-left: 18px; }
.info-box li { margin-bottom: 5px; }
.info-section { margin-bottom: 20px; }

/* ===== SIMPLE PAGES ===== */
.simple-page { max-width: 720px; margin: 0 auto; }
.simple-page h1 { font-size: 28px; font-weight: 800; margin-bottom: 6px; }
.simple-page .subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }
.simple-page h2 { font-size: 16px; font-weight: 600; color: var(--text); margin: 20px 0 6px; }
.simple-page p { font-size: 14px; color: var(--text-muted); line-height: 1.75; margin-bottom: 10px; }
.alert-box {
  background: var(--primary-light);
  border: 1px solid rgba(59,130,246,0.3);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 13px;
  color: var(--primary);
  font-weight: 500;
  margin-bottom: 20px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 20px 0; }
.mini-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px; text-align: center;
}
.mini-card .mini-icon {
  width: 36px; height: 36px;
  background: var(--primary-light);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 8px; color: var(--primary);
}
.mini-card h3 { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.mini-card p { font-size: 12px; color: var(--text-muted); }
.contact-form input, .contact-form select, .contact-form textarea {
  width: 100%; margin-bottom: 12px;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px;
}
.contact-form textarea { min-height: 100px; resize: vertical; }
.contact-form input:focus, .contact-form select:focus, .contact-form textarea:focus {
  outline: none; border-color: var(--primary);
}
.contact-form label { display: block; font-size: 12px; font-weight: 500; color: var(--text-muted); margin-bottom: 4px; }
.btn-full { width: 100%; height: 40px; }
.cta-center { text-align: center; margin-top: 24px; }
.btn-lg { padding: 0 24px; height: 42px; font-size: 14px; border-radius: 9px; }

/* ===== TOAST ===== */
#bookmark-toast {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999;
  max-width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 14px 16px;
  display: flex; align-items: flex-start; gap: 12px;
  opacity: 0; pointer-events: none;
  transform: translateY(16px);
  transition: opacity 0.3s, transform 0.3s;
}
#bookmark-toast.show { opacity: 1; pointer-events: all; transform: translateY(0); }
.toast-icon {
  width: 32px; height: 32px; flex-shrink: 0;
  background: var(--primary-light); border-radius: 8px;
  display: flex; align-items: center; justify-content: center; color: var(--primary);
}
.toast-body { flex: 1; }
.toast-body strong { font-size: 13px; font-weight: 600; color: var(--text); display: block; }
.toast-body span { font-size: 12px; color: var(--text-muted); }
.toast-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 2px;
  border-radius: 4px;
}
.toast-close:hover { color: var(--text); }

/* ===== FOOTER ===== */
footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  margin-top: 48px;
}
.footer-inner {
  max-width: 1000px; margin: 0 auto;
  padding: 40px 20px 24px;
}
.footer-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 32px;
  margin-bottom: 32px;
}
.footer-brand p { font-size: 13px; color: var(--text-muted); margin-top: 8px; line-height: 1.6; }
.footer-col h3 { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 10px; }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 6px; }
.footer-col a { font-size: 13px; color: var(--text-muted); transition: color var(--transition); }
.footer-col a:hover { color: var(--primary); text-decoration: none; }
.footer-bottom {
  border-top: 1px solid var(--border); padding-top: 20px;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 8px;
  font-size: 12px; color: var(--text-muted);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  nav { display: none; }
  #mobile-menu-btn { display: flex; }
  .settings-grid { grid-template-columns: 1fr; }
  .tool-grid { grid-template-columns: repeat(2, 1fr); }
  .related-grid { grid-template-columns: 1fr 1fr; }
  .features { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .preview-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  main { padding: 20px 16px; }
  .hero h1 { font-size: 22px; }
  .tool-grid { grid-template-columns: 1fr; }
  .related-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  #dropzone { padding: 32px 16px; }
}
