/* ─────────────────────────────────────────────────────────────────────────────
   CoolPDFs Design System
   Import on every page: <link rel="stylesheet" href="/design.css">
   ───────────────────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&display=swap');

/* ── TOKENS ── */
:root {
  /* Brand */
  --red:        #E8001D;
  --red-dark:   #C4001A;
  --red-light:  rgba(232,0,29,0.07);
  --red-mid:    rgba(232,0,29,0.14);

  /* Ami */
  --ami:        #B45309;
  --ami-light:  rgba(180,83,9,0.08);
  --ami-mid:    rgba(180,83,9,0.15);
  --ami-glow:   rgba(180,83,9,0.2);

  /* Surface */
  --bg:         #FFFFFF;
  --bg2:        #F7F7F7;
  --bg3:        #EFEFEF;
  --bg4:        #E8E8E8;

  /* Border */
  --border:     #E5E5E5;
  --border2:    #D0D0D0;
  --border3:    #BBBBBB;

  /* Text */
  --text:       #1A1A1A;
  --text2:      #404040;
  --muted:      #767676;
  --light:      #B0B0B0;
  --white:      #FFFFFF;

  /* Semantic */
  --success:    #2E7D32;
  --success-bg: #EDF7EE;
  --warn:       #B45309;
  --warn-bg:    #FEF3C7;
  --error:      #C62828;
  --error-bg:   #FFEBEE;

  /* Shadow */
  --shadow-xs:  0 1px 2px rgba(0,0,0,0.06);
  --shadow-sm:  0 1px 4px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:     0 4px 16px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-lg:  0 16px 48px rgba(0,0,0,0.10), 0 4px 12px rgba(0,0,0,0.05);
  --shadow-xl:  0 24px 64px rgba(0,0,0,0.12), 0 8px 24px rgba(0,0,0,0.06);

  /* Radius */
  --r-sm:  6px;
  --r:     8px;
  --r-md:  10px;
  --r-lg:  12px;
  --r-xl:  16px;
  --r-2xl: 20px;

  /* Spacing */
  --nav-h: 60px;
  --ami-w: 360px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ── TYPOGRAPHY ── */
.t-display {
  font-family: 'Instrument Serif', Georgia, serif;
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

.t-serif { font-family: 'Instrument Serif', Georgia, serif; }

h1, h2, h3 { letter-spacing: -0.02em; line-height: 1.2; }

/* ── NAVIGATION ── */
.cp-nav {
  position: sticky;
  top: 0; z-index: 200;
  height: var(--nav-h);
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
}

.cp-nav-logo {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; color: var(--text);
  font-weight: 700; font-size: 1rem;
  letter-spacing: -0.01em; flex-shrink: 0;
}

.cp-nav-mark {
  width: 27px; height: 27px;
  background: var(--red); border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 0.68rem; font-weight: 700;
}

.cp-nav-links {
  display: flex; align-items: center;
  gap: 2px; list-style: none;
}

.cp-nav-links a {
  color: var(--text2); text-decoration: none;
  font-size: 0.875rem; font-weight: 500;
  padding: 6px 12px; border-radius: var(--r-sm);
  transition: background 0.15s, color 0.15s;
}

.cp-nav-links a:hover { background: var(--bg2); color: var(--text); }
.cp-nav-links a.active { color: var(--text); font-weight: 600; }

.cp-nav-actions { display: flex; gap: 8px; align-items: center; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 20px; border-radius: var(--r);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem; font-weight: 600;
  text-decoration: none; border: none; cursor: pointer;
  transition: all 0.15s; white-space: nowrap;
  line-height: 1;
}

.btn-sm { padding: 7px 14px; font-size: 0.82rem; }
.btn-lg { padding: 13px 28px; font-size: 0.95rem; }

.btn-red {
  background: var(--red); color: white;
  box-shadow: 0 2px 8px rgba(232,0,29,0.2);
}
.btn-red:hover {
  background: var(--red-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(232,0,29,0.28);
}

.btn-outline {
  background: white; color: var(--text2);
  border: 1.5px solid var(--border2);
}
.btn-outline:hover { background: var(--bg2); border-color: var(--border3); }

.btn-ghost {
  background: none; color: var(--text2);
  border: 1px solid transparent;
}
.btn-ghost:hover { background: var(--bg2); }

.btn-ami {
  background: var(--ami-light); color: var(--ami);
  border: 1px solid var(--ami-mid);
}
.btn-ami:hover { background: var(--ami-mid); }

.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ── FORM ELEMENTS ── */
.cp-input,
.cp-select,
.cp-textarea {
  width: 100%;
  background: white;
  border: 1.5px solid var(--border2);
  border-radius: var(--r);
  padding: 10px 13px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.cp-input:focus,
.cp-select:focus,
.cp-textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-light);
}

.cp-input::placeholder { color: var(--light); }

.cp-select {
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='7'%3E%3Cpath d='M1 1l4.5 4.5L10 1' stroke='%23B0B0B0' stroke-width='1.5' stroke-linecap='round' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

.cp-label {
  display: block;
  font-size: 0.8rem; font-weight: 600;
  color: var(--text2); margin-bottom: 6px;
  letter-spacing: 0.01em;
}

.cp-field { margin-bottom: 16px; }

/* ── DROP ZONE ── */
.cp-drop {
  border: 2px dashed var(--border2);
  border-radius: var(--r-xl);
  padding: 48px 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg2);
  position: relative;
}

.cp-drop:hover,
.cp-drop.over {
  border-color: var(--red);
  background: var(--red-light);
}

.cp-drop input[type="file"] {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer;
  width: 100%; height: 100%;
}

.cp-drop-icon {
  font-size: 2.4rem; margin-bottom: 12px;
  display: block; color: var(--light);
}

.cp-drop-title {
  font-weight: 700; font-size: 1rem;
  margin-bottom: 5px; color: var(--text);
}

.cp-drop-sub { font-size: 0.82rem; color: var(--muted); }

.cp-drop-sub span { color: var(--red); font-weight: 600; }

/* ── FILE CHIP ── */
.cp-file-chip {
  display: flex; align-items: center; gap: 12px;
  background: white; border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 12px 16px;
  box-shadow: var(--shadow-xs);
}

.cp-file-chip-icon {
  width: 36px; height: 36px;
  background: var(--red-light); border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0; color: var(--red);
}

.cp-file-chip-info { flex: 1; min-width: 0; }
.cp-file-chip-name { font-weight: 600; font-size: 0.875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-file-chip-meta { font-size: 0.75rem; color: var(--muted); margin-top: 1px; }

.cp-file-chip-remove {
  background: none; border: none;
  color: var(--light); cursor: pointer;
  font-size: 1rem; padding: 4px;
  transition: color 0.15s; flex-shrink: 0;
  font-family: inherit;
}
.cp-file-chip-remove:hover { color: var(--error); }

/* ── ALERTS ── */
.cp-alert {
  padding: 11px 14px; border-radius: var(--r);
  font-size: 0.855rem; line-height: 1.5;
  display: flex; align-items: flex-start; gap: 10px;
}

.cp-alert-error   { background: var(--error-bg); color: var(--error); border: 1px solid rgba(198,40,40,0.15); }
.cp-alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(46,125,50,0.15); }
.cp-alert-warn    { background: var(--warn-bg); color: var(--warn); border: 1px solid rgba(180,83,9,0.15); }
.cp-alert-info    { background: var(--bg2); color: var(--text2); border: 1px solid var(--border); }

/* ── CARD ── */
.cp-card {
  background: white; border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 24px;
  box-shadow: var(--shadow-xs);
}

.cp-card-title {
  font-weight: 700; font-size: 0.95rem;
  margin-bottom: 16px; letter-spacing: -0.01em;
}

/* ── PROGRESS ── */
.cp-progress-track {
  height: 4px; background: var(--bg3);
  border-radius: 2px; overflow: hidden;
}

.cp-progress-fill {
  height: 100%; background: var(--red);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* ── BADGE ── */
.cp-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 4px;
  font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase;
}

.cp-badge-red  { background: var(--red); color: white; }
.cp-badge-ami  { background: var(--ami-light); color: var(--ami); border: 1px solid var(--ami-mid); }
.cp-badge-gray { background: var(--bg3); color: var(--muted); border: 1px solid var(--border); }
.cp-badge-green { background: var(--success-bg); color: var(--success); }

/* ── DIVIDER ── */
.cp-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--light); font-size: 0.78rem; margin: 20px 0;
}
.cp-divider::before, .cp-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ── PAGE SHELL ── */
.cp-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 48px 40px 80px;
}

.cp-page-wide {
  max-width: 1180px;
  margin: 0 auto;
  padding: 48px 40px 80px;
}

.cp-page-header { margin-bottom: 36px; }

.cp-page-eyebrow {
  font-size: 0.72rem; font-weight: 700;
  color: var(--red); letter-spacing: 0.09em;
  text-transform: uppercase; margin-bottom: 10px;
}

.cp-page-title {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: clamp(1.7rem, 2.5vw, 2.4rem);
  font-weight: 400; letter-spacing: -0.025em;
  line-height: 1.15; margin-bottom: 8px;
}

.cp-page-sub {
  font-size: 0.95rem; color: var(--muted); line-height: 1.7;
}

/* ── TOOL LAYOUT ── */
.cp-tool-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}

.cp-tool-main { min-width: 0; }

.cp-tool-sidebar {
  position: sticky;
  top: calc(var(--nav-h) + 24px);
}

/* ── SECTION LABELS ── */
.cp-section-label {
  font-size: 0.72rem; font-weight: 700;
  color: var(--muted); letter-spacing: 0.09em;
  text-transform: uppercase; margin-bottom: 12px;
}

/* ── TOGGLE ── */
.cp-toggle {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; user-select: none;
  font-size: 0.875rem; font-weight: 500;
}

.cp-toggle input { display: none; }

.cp-toggle-pill {
  width: 34px; height: 20px;
  background: var(--bg3); border-radius: 10px;
  position: relative; transition: background 0.2s;
  border: 1px solid var(--border2);
  flex-shrink: 0;
}

.cp-toggle-pill::after {
  content: '';
  position: absolute; top: 3px; left: 3px;
  width: 12px; height: 12px;
  background: var(--muted); border-radius: 50%;
  transition: all 0.2s;
}

.cp-toggle input:checked + .cp-toggle-pill {
  background: var(--red); border-color: var(--red);
}

.cp-toggle input:checked + .cp-toggle-pill::after {
  left: 17px; background: white;
}

/* ── SKELETON ── */
.cp-skeleton {
  background: linear-gradient(90deg, var(--bg3) 25%, var(--bg2) 50%, var(--bg3) 75%);
  background-size: 200% 100%;
  animation: skeleton 1.5s ease-in-out infinite;
  border-radius: var(--r-sm);
}

@keyframes skeleton {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── ANIMATIONS ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.anim-fade-up   { animation: fadeUp 0.4s ease forwards; }
.anim-fade-in   { animation: fadeIn 0.3s ease forwards; }
.anim-slide-in  { animation: slideIn 0.3s ease forwards; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border3); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .cp-nav { padding: 0 20px; }
  .cp-nav-links { display: none; }
  .cp-page, .cp-page-wide { padding: 32px 20px 60px; }
  .cp-tool-layout { grid-template-columns: 1fr; }
  .cp-tool-sidebar { position: static; }
}
