/* ============ VARIABLES & THEME ============ */
:root {
  --primary: #FFD60A;
  --primary-hover: #E5C009;
  --bg: #FFFFFF;
  --bg-alt: #F8F9FA;
  --text: #0A0A0A;
  --text-muted: #6B7280;
  --border: #E5E7EB;
  --success: #10B981;
  --danger: #EF4444;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow: 0 4px 20px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.1);
  --transition: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

[data-theme="dark"] {
  --primary: #FFD60A;
  --primary-hover: #FFE566;
  --bg: #0A0A0A;
  --bg-alt: #141414;
  --text: #FAFAFA;
  --text-muted: #9CA3AF;
  --border: #27272A;
  --shadow: 0 4px 20px rgba(0,0,0,0.4);
}

/* ============ BASE ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em; }
a { color: var(--text); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary); }
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.container.narrow { max-width: 800px; }

/* ============ HEADER ============ */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
[data-theme="dark"] .site-header { background: rgba(10,10,10,0.8); }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.5rem; }
.logo { display: flex; align-items: center; gap: 0.6rem; font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; color: var(--text); }
.logo:hover { color: var(--text); text-decoration: none; }
.nav { display: flex; align-items: center; gap: 1.5rem; }
.nav a { color: var(--text-muted); font-weight: 500; font-size: 0.95rem; }
.nav a:hover { color: var(--text); text-decoration: none; }
.theme-toggle {
  background: var(--bg-alt); border: 1px solid var(--border);
  width: 40px; height: 40px; border-radius: 10px;
  cursor: pointer; color: var(--text);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.75rem 1.5rem; border-radius: 10px;
  font-weight: 600; font-size: 0.95rem; cursor: pointer;
  border: 1px solid transparent; transition: all var(--transition);
  font-family: var(--font-body);
}
.btn-primary { background: var(--primary); color: #0A0A0A; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: var(--shadow); text-decoration: none; color: #0A0A0A; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--text); background: var(--bg-alt); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }
.btn-lg { padding: 0.9rem 2rem; font-size: 1rem; }

/* ============ TOOL PAGE LAYOUT ============ */
.tool-page { padding: 3rem 0 5rem; flex: 1; }
.tool-header { margin-bottom: 2.5rem; text-align: center; }
.tool-header .back { 
  color: var(--text-muted); font-size: 0.9rem; font-weight: 500; 
  display: inline-flex; align-items: center; gap: 0.4rem; margin-bottom: 1rem; 
}
.tool-header .back:hover { color: var(--primary); text-decoration: none; }
.tool-header h1 { font-size: clamp(2rem, 5vw, 2.75rem); margin-bottom: 0.75rem; }
.tool-header p { color: var(--text-muted); font-size: 1.1rem; max-width: 600px; margin: 0 auto; }

/* ============ DROPZONE ============ */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 3.5rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-alt);
  position: relative;
  overflow: hidden;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: rgba(255, 214, 10, 0.05);
}
[data-theme="dark"] .dropzone:hover, [data-theme="dark"] .dropzone.dragover {
  background: rgba(255, 214, 10, 0.08);
}
.dropzone-icon { font-size: 3rem; margin-bottom: 1rem; display: block; }
.dropzone-text { font-weight: 700; font-size: 1.1rem; margin-bottom: 0.5rem; font-family: var(--font-display); }
.dropzone-sub { color: var(--text-muted); font-size: 0.9rem; }
.dropzone input[type="file"] { display: none; }

/* ============ FILE LIST & PREVIEW ============ */
.file-list, .preview-grid { margin-top: 1.5rem; display: flex; flex-direction: column; gap: 0.75rem; }
.preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1rem; }
.file-item, .preview-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
}
.file-item:hover { border-color: var(--primary); }
.preview-item { flex-direction: column; padding: 0.5rem; aspect-ratio: 1; position: relative; }
.preview-item img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.file-icon { font-size: 1.5rem; }
.file-info { flex: 1; min-width: 0; }
.file-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.95rem; }
.file-size { color: var(--text-muted); font-size: 0.85rem; font-family: var(--font-mono); }
.file-actions { display: flex; gap: 0.4rem; }
.icon-btn {
  background: transparent; border: 1px solid var(--border);
  width: 32px; height: 32px; border-radius: 8px;
  cursor: pointer; font-size: 1rem; color: var(--text-muted);
  transition: all var(--transition); display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--danger); color: white; border-color: var(--danger); }
.preview-remove {
  position: absolute; top: 6px; right: 6px;
  background: rgba(0,0,0,0.7); color: white;
  border: none; width: 26px; height: 26px;
  border-radius: 50%; cursor: pointer; font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.preview-remove:hover { background: var(--danger); }

/* ============ CONTROLS ============ */
.controls {
  margin-top: 2rem;
  display: flex; flex-wrap: wrap; gap: 1.25rem;
  padding: 1.5rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.control-group { display: flex; flex-direction: column; gap: 0.4rem; min-width: 160px; flex: 1; }
.control-group label { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); font-family: var(--font-display); }
.control-group input, .control-group select, .control-group textarea {
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
  font-family: var(--font-body);
  transition: all var(--transition);
}
.control-group input:focus, .control-group select:focus, .control-group textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 214, 10, 0.2);
}
.control-group textarea { min-height: 180px; resize: vertical; font-family: var(--font-mono); font-size: 0.9rem; }
.control-group input[type="range"] { padding: 0; border: none; accent-color: var(--primary); }

.action-bar { margin-top: 2rem; display: flex; gap: 0.75rem; flex-wrap: wrap; justify-content: center; }

/* ============ PROGRESS & STATUS ============ */
.progress {
  height: 8px; background: var(--border); border-radius: 999px;
  overflow: hidden; margin-top: 1.5rem; display: none;
}
.progress.active { display: block; }
.progress-bar {
  height: 100%; background: var(--primary);
  width: 0%; transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.status {
  margin-top: 1rem; padding: 0.85rem 1.25rem;
  border-radius: var(--radius); font-size: 0.95rem; font-weight: 500;
  display: none; text-align: center;
}
.status.active { display: block; animation: fadeIn 0.3s ease; }
.status.success { background: rgba(16,185,129,0.1); color: var(--success); border: 1px solid rgba(16,185,129,0.2); }
.status.error { background: rgba(239,68,68,0.1); color: var(--danger); border: 1px solid rgba(239,68,68,0.2); }
.status.info { background: rgba(255,214,10,0.1); color: #B49600; border: 1px solid rgba(255,214,10,0.3); }
[data-theme="dark"] .status.info { color: var(--primary); }

@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* ============ FOOTER ============ */
.site-footer {
  margin-top: auto;
  padding: 3rem 0 2rem;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
}
.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 3rem; margin-bottom: 3rem;
}
.footer-brand .logo { margin-bottom: 1rem; }
.footer-tagline { color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; margin-bottom: 1.25rem; max-width: 320px; }
.footer-social { display: flex; gap: 0.5rem; }
.footer-social a {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); transition: all var(--transition);
}
.footer-social a:hover { color: var(--primary); border-color: var(--primary); transform: translateY(-2px); text-decoration: none; }
.footer-col h4 { font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text); margin-bottom: 1rem; font-family: var(--font-display); }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 0.6rem; }
.footer-col a { color: var(--text-muted); font-size: 0.9rem; }
.footer-col a:hover { color: var(--primary); text-decoration: none; }
.footer-bottom {
  padding-top: 2rem; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 1rem; font-size: 0.85rem; color: var(--text-muted);
}
.footer-love {
  font-family: var(--font-mono); font-size: 0.8rem;
  padding: 0.3rem 0.75rem; background: rgba(255,214,10,0.1);
  color: #B49600; border: 1px solid rgba(255,214,10,0.3); border-radius: 999px;
}
[data-theme="dark"] .footer-love { color: var(--primary); }

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  .nav a:not(.theme-toggle) { display: none; }
  .tool-header { text-align: left; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 2rem; }
  .controls { flex-direction: column; }
  .control-group { min-width: 100%; }
}
@media (max-width: 560px) {
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; text-align: center; }
}

/* ============ INFO BANNER ============ */
.info-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: rgba(255, 214, 10, 0.08);
  border: 1px solid rgba(255, 214, 10, 0.3);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.5;
}
.info-banner svg {
  flex-shrink: 0;
  stroke: var(--primary);
  margin-top: 2px;
}
.info-banner strong { color: var(--primary); }

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  font: inherit;
  font-weight: 600;
}
.link-btn:hover { color: var(--primary-hover); }

/* ============ PILL BUTTONS ============ */
.format-pills, .preset-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.pill {
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-body);
  text-align: center;
  min-width: 80px;
}
.pill small {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 2px;
}
.pill:hover {
  border-color: var(--primary);
  background: var(--bg-alt);
}
.pill.active {
  background: var(--primary);
  color: #0A0A0A;
  border-color: var(--primary);
}
.pill.active small { color: rgba(10, 10, 10, 0.7); }

/* ============ MONO VALUE ============ */
.mono-val {
  color: var(--primary);
  font-family: var(--font-mono);
  font-weight: 600;
}

/* ============ SIZE BADGES ============ */
.size-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  margin-left: 0.4rem;
  font-family: var(--font-mono);
}
.size-badge.savings {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.size-badge.larger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ============ SUMMARY CARD ============ */
.summary-card {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, rgba(255, 214, 10, 0.08), rgba(255, 214, 10, 0.02));
  border: 1px solid rgba(255, 214, 10, 0.25);
  border-radius: var(--radius-lg);
}
.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 1rem;
  flex-wrap: wrap;
}
.summary-item { text-align: center; flex: 1; min-width: 100px; }
.summary-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.35rem;
  font-family: var(--font-display);
}
.summary-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}
.summary-value.savings { color: var(--success); }
.summary-divider {
  width: 1px;
  height: 40px;
  background: var(--border);
}

/* ============ DOWNLOAD BUTTON ============ */
.download-btn {
  background: transparent !important;
  color: var(--primary) !important;
  border-color: var(--primary) !important;
}
.download-btn:hover {
  background: var(--primary) !important;
  color: #0A0A0A !important;
}

@media (max-width: 640px) {
  .summary-divider { display: none; }
  .summary-row { flex-direction: column; gap: 1rem; }
  .pill { flex: 1; min-width: 70px; padding: 0.5rem 0.6rem; font-size: 0.8rem; }
}

/* ============ PASSWORD DISPLAY ============ */
.password-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-top: 1.5rem;
}
.password-text {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
  flex: 1;
  margin-right: 1rem;
}
.password-actions {
  display: flex;
  gap: 0.5rem;
}

/* ============ STRENGTH METER ============ */
.strength-meter {
  margin-top: 1rem;
}
.strength-bar {
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}
.strength-fill {
  height: 100%;
  transition: all 0.3s ease;
  border-radius: 999px;
}
.strength-text {
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-display);
}