/* ── Reset & Variables ── */
:root {
  --primary-glow: rgba(139, 92, 246, 0.4);
  --clr-primary: #8b5cf6;
  --clr-primary-hover: #7c3aed;
  --clr-success: #10b981;
  --clr-danger: #ef4444;
  --clr-warning: #f59e0b;
}

[data-theme="dark"] {
  --pico-background-color: #0b0d14;
  --pico-form-element-background-color: rgba(255, 255, 255, 0.03);
  --pico-form-element-border-color: rgba(255, 255, 255, 0.1);
  --pico-primary: var(--clr-primary);
  --pico-primary-hover: var(--clr-primary-hover);
  --pico-card-background-color: rgba(255, 255, 255, 0.02);
  --pico-muted-color: #94a3b8;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at top right, rgba(139, 92, 246, 0.12), transparent 40%),
              radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.08), transparent 40%),
              var(--pico-background-color);
  background-attachment: fixed;
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.title-gradient {
  background: linear-gradient(135deg, #fff 0%, #8b5cf6 50%, #d946ef 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block;
}

main.container {
  max-width: 680px;
  width: 100%;
  margin: 3rem auto;
  animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

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

article, .card {
  background: rgba(255, 255, 255, 0.02) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  margin-bottom: 1.5rem;
  padding: 2rem !important;
}

.tab-bar {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 0.35rem;
  margin-bottom: 2rem;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--pico-muted-color);
  padding: 0.75rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.95rem;
}

.tab-btn:hover { color: #fff; }
.tab-btn.active {
  background: var(--clr-primary);
  color: #fff;
  box-shadow: 0 4px 15px var(--primary-glow);
}
.tab-hidden, [hidden] { display: none !important; }

.drop-zone {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 3rem 1.5rem;
  text-align: center;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.2);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--clr-primary);
  background: rgba(139, 92, 246, 0.05);
}
.drop-zone svg { color: var(--clr-primary); margin-bottom: 1rem; transition: transform 0.3s; }
.drop-zone:hover svg { transform: scale(1.15) translateY(-5px); filter: drop-shadow(0 4px 6px rgba(139, 92, 246, 0.4)); }

.options-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 2rem; width: 100%; }
.option-card { cursor: pointer; display: block; margin: 0; width: 100% !important; }
.option-card input[type="radio"] { display: none; }
.option-card__inner {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.5rem;
  padding: 1.25rem 0.5rem; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 12px;
  background: rgba(255, 255, 255, 0.02); transition: all 0.3s; height: 100%; width: 100%;
}
.option-card__inner svg { color: var(--pico-muted-color); transition: color 0.3s; }
.option-card__inner:hover { background: rgba(255, 255, 255, 0.05); transform: translateY(-2px); border-color: rgba(255, 255, 255, 0.15); }
.option-card input:checked + .option-card__inner { border-color: var(--clr-primary); background: rgba(139, 92, 246, 0.08); box-shadow: 0 0 20px var(--primary-glow); }
.option-card input:checked + .option-card__inner svg { color: var(--clr-primary); }

.stat, .history-item, .bulk-file-item {
  display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem;
  background: rgba(255,255,255,0.02); border-radius: 12px; border: 1px solid rgba(255,255,255,0.05);
  margin-bottom: 0.75rem; transition: all 0.2s ease;
}
.stat { flex-direction: column; padding: 1rem; margin-bottom: 0px;}
.stat__label { font-size: 0.75rem; text-transform: uppercase; color: var(--pico-muted-color); font-weight: 600; margin-bottom: 0.25rem; }
.stat__value { font-size: 1.3rem; font-weight: 700; color: #fff;}
.stat__value--success { color: var(--clr-success); text-shadow: 0 0 10px rgba(16, 185, 129, 0.3); }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.5rem; }

.history-item:hover, .bulk-file-item:hover { background: rgba(255, 255, 255, 0.04); border-color: rgba(255, 255, 255, 0.1); transform: translateX(2px); }
.history-item__name, .bulk-file-item__name { font-weight: 600; color: #fff; margin-bottom: 0.25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.history-item__meta, .bulk-file-item__size { font-size: 0.8rem; color: var(--pico-muted-color); }
.history-item__badge { padding: 0.15rem 0.6rem; border-radius: 12px; font-size: 0.7rem; font-weight: bold; text-transform: uppercase; }
.history-item__badge--success { background: rgba(16, 185, 129, 0.15); color: var(--clr-success); }
.history-item__badge--error { background: rgba(239, 68, 68, 0.15); color: var(--clr-danger); }
.history-item__badge--processing { background: rgba(139, 92, 246, 0.15); color: var(--clr-primary); animation: pulse 1.5s infinite; }
.history-item__download { background: rgba(139, 92, 246, 0.15); color: var(--clr-primary); text-decoration: none; font-weight: 600; padding: 0.5rem 1rem; border-radius: 8px; font-size: 0.85rem; transition: all 0.2s; }
.history-item__download:hover { background: var(--clr-primary); color: #fff; box-shadow: 0 2px 8px var(--primary-glow); text-decoration: none;}
.bulk-file-item__remove { background: rgba(239, 68, 68, 0.1); color: var(--clr-danger); border: none; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; transition: all 0.2s; }
.bulk-file-item__remove:hover { background: var(--clr-danger); color: #fff; transform: scale(1.1); }

.progress-bar-track { width: 100%; height: 10px; background: rgba(0, 0, 0, 0.3); border-radius: 99px; overflow: hidden; margin-bottom: 1rem; border: 1px solid rgba(255, 255, 255, 0.05); }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, #8b5cf6, #d946ef); border-radius: 99px; transition: width 0.3s; box-shadow: 0 0 10px rgba(217, 70, 239, 0.5); }
.scale-control { display: none; margin-bottom: 1.5rem; }
.scale-control.visible { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.scale-labels { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--pico-muted-color); margin-top: -0.25rem; margin-bottom: 2rem; }
input[type="range"] { accent-color: var(--clr-primary); }

.loader-overlay { position: fixed; inset: 0; background: rgba(11, 13, 20, 0.85); backdrop-filter: blur(8px); display: flex; flex-direction: column; justify-content: center; align-items: center; z-index: 9999; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.error { color: var(--clr-danger); text-shadow: 0 0 10px rgba(239, 68, 68, 0.2); }

button, .btn { font-weight: 600; letter-spacing: 0.02em; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); border-radius: 10px; }
button:hover:not(:disabled), .btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 16px var(--primary-glow); filter: brightness(1.1); }
#bulk-download-btn, #download-btn { background-color: var(--clr-success); border-color: var(--clr-success); color: white;}
#bulk-download-btn:hover, #download-btn:hover { box-shadow: 0 8px 16px rgba(16, 185, 129, 0.3); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

.ad-slot { width: 100%; min-height: 90px; background: rgba(255, 255, 255, 0.02); border: 1px dashed rgba(255, 255, 255, 0.1); border-radius: 12px; display: flex; align-items: center; justify-content: center; color: var(--pico-muted-color); font-size: 0.8rem; letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 2rem; }
.ad-slot--bottom { margin-top: 1rem; margin-bottom: 0; }

.bulk-warning { display: flex; align-items: flex-start; gap: 0.5rem; margin-top: 1.5rem; padding: 1rem; background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.2); border-radius: 10px; font-size: 0.85rem; color: #fbd38d; }
.bulk-file-summary {font-weight: 600; color: #fff;}
.bulk-validation-msg {font-size: 0.82rem; min-height: 1.2em;}
.history-empty { text-align: center; color: var(--pico-muted-color); font-size: 0.85rem; padding: 1rem 0; }
.bulk-file-list { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.75rem; max-height: 240px; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.2) transparent; }

@media (max-width: 640px) {
  main.container { margin-top: 1rem; margin-bottom: 1rem; padding: 0 0.8rem !important; }
  header { margin-bottom: 1.5rem !important; }
  h1.title-gradient { font-size: 2rem !important; line-height: 1.2; }
  header p { font-size: 0.95rem !important; }
  article, .card { padding: 1.25rem !important; margin-bottom: 1rem; }
  
  .tab-bar { padding: 0.35rem; margin-bottom: 1.5rem; flex-direction: row; }
  .tab-btn { padding: 0.6rem 0.25rem; font-size: 0.9rem; }

  .options-grid { display: flex; flex-direction: column; align-items: stretch; gap: 0.4rem; margin-bottom: 1.5rem; width: 100%; }
  .option-card__inner { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; text-align: left; gap: 0.2rem 1rem; padding: 1rem; align-items: center; }
  .option-card__inner svg { grid-row: 1 / 3; width: 24px; height: 24px; margin: 0; }
  .option-card__inner strong { align-self: end; font-size: 0.95rem; }
  .option-card__inner span { align-self: start; font-size: 0.75rem; }

  .result-stats { grid-template-columns: 1fr; gap: 0.5rem; }
  .stat { flex-direction: row; justify-content: space-between; padding: 0.75rem 1rem; margin-bottom: 0; }
  
  .history-item { flex-direction: column; align-items: stretch; gap: 0.85rem; padding: 1rem; }
  .history-item > div { width: 100%; display: flex; flex-direction: column; }
  .history-item__name { max-width: 100%; white-space: normal; overflow: visible; }
  .history-item__meta { line-height: 1.4; display: flex; flex-wrap: wrap; gap: 0.25rem; align-items: center;}
  .history-item__download { text-align: center; width: 100%; padding: 0.75rem; display: block; box-sizing: border-box; }
  
  .bulk-file-item { padding: 0.4rem 0.6rem; flex-wrap: nowrap; }
  .bulk-file-item__name { max-width: calc(100vw - 120px); }

  .drop-zone { padding: 2rem 1rem; }
  .drop-zone h4 { font-size: 1.1rem !important; }
  
  .scale-labels { margin-bottom: 1rem; }
}

/* Footer Styles */
.site-footer {
  margin-top: 3rem;
  text-align: center;
  border-top: 1px solid var(--pico-muted-border-color);
  padding-top: 2rem;
  padding-bottom: 2rem;
  width: 100%;
}

.site-footer__notice {
  font-size: 0.9rem;
  color: var(--pico-muted-color);
  margin-bottom: 1rem;
}

.site-footer__nav-list {
  display: inline-flex;
  list-style: none;
  gap: 1.5rem;
  padding: 0;
  margin-bottom: 1rem;
}

.site-footer__link {
  font-size: 0.85rem;
  color: var(--pico-muted-color);
  text-decoration: none;
  transition: color 0.2s;
}

.site-footer__link:hover {
  color: var(--clr-primary);
  text-decoration: underline;
}

.site-footer__copyright {
  font-size: 0.8rem;
  color: var(--pico-muted-color);
  margin-top: 0.5rem;
}

@media (max-width: 640px) {
  .site-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
  }
  .site-footer__nav-list {
    gap: 1rem;
  }
}
