/* ============================================
   KOMPRESS — style.css
   ============================================ */

:root {
  --bg:        #0a0a0f;
  --bg2:       #13131a;
  --bg3:       #1c1c26;
  --border:    #2a2a38;
  --accent:    #f0e040;
  --accent2:   #ff6b35;
  --text:      #e8e8f0;
  --text2:     #8888a8;
  --text3:     #55556a;
  --success:   #3ddc84;
  --danger:    #ff4f4f;
  --radius:    14px;
  --radius-sm: 8px;
  --font-ui:   'Syne', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --transition:0.22s cubic-bezier(.4,0,.2,1);
}

body.light {
  --bg:     #f0f0f5;
  --bg2:    #ffffff;
  --bg3:    #e4e4ec;
  --border: #d0d0df;
  --text:   #0f0f1a;
  --text2:  #5a5a78;
  --text3:  #aaaacc;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0; padding: 0;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

html, body {
  height: 100%;
  overflow-x: hidden;
  overscroll-behavior: none;
  touch-action: pan-y;
  max-width: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  transition: background var(--transition), color var(--transition);
  -webkit-user-select: none;
  user-select: none;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

#app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  overflow-x: hidden;
}

/* ── Header ── */
#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 100;
  transition: background var(--transition);
  width: 100%;
}

.logo-text {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  text-transform: uppercase;
  color: var(--text);
  text-align: left;
}
.logo-accent { color: var(--accent); }

.btn-theme {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 4px 0 4px 12px;
  border-radius: 8px;
  transition: transform 0.2s;
  -webkit-user-select: none;
  user-select: none;
  flex-shrink: 0;
}
.btn-theme:active { transform: scale(0.85); }

/* ── Main ── */
#main {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

/* ── Cards ── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: background var(--transition), border-color var(--transition);
  width: 100%;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text2);
  margin-bottom: 16px;
}
.card-icon { font-size: 16px; flex-shrink: 0; }

/* ── Drop zone ── */
.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 28px 16px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  text-align: center;
  width: 100%;
}
.drop-zone:active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.drop-icon { font-size: 36px; margin-bottom: 4px; }
.drop-text { font-size: 16px; font-weight: 700; color: var(--text); }
.drop-sub  { font-size: 12px; color: var(--text2); font-family: var(--font-mono); word-break: break-word; }

/* ── File list ── */
.file-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
  overflow-x: hidden;
}
.file-item {
  display: flex;
  align-items: center;
  padding: 8px 10px 8px 12px;
  background: var(--bg3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  animation: slideIn 0.18s ease;
  min-width: 0;
  gap: 6px;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.file-name {
  font-family: var(--font-mono);
  font-size: 12px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1; min-width: 0;
}
.file-size {
  font-family: var(--font-mono);
  font-size: 11px; color: var(--text2);
  white-space: nowrap; flex-shrink: 0;
}
.file-remove {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 13px;
  line-height: 1;
  padding: 2px 4px;
  cursor: pointer;
  border-radius: 4px;
  flex-shrink: 0;
  transition: color var(--transition), background var(--transition);
  -webkit-user-select: none;
}
.file-remove:active {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}

/* ── File actions ── */
.file-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  gap: 10px;
}
.file-count {
  font-family: var(--font-mono);
  font-size: 12px; color: var(--accent); flex: 1;
}
.btn-clear {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-family: var(--font-ui);
  font-size: 12px; font-weight: 700;
  cursor: pointer; white-space: nowrap;
  transition: background var(--transition);
  flex-shrink: 0;
}
.btn-clear:active { background: color-mix(in srgb, var(--danger) 12%, transparent); }

/* ── Options ── */
.option-group { margin-bottom: 18px; }
.option-group:last-child { margin-bottom: 0; }

.option-label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 600;
  color: var(--text2); text-transform: uppercase; letter-spacing: 0.8px;
  margin-bottom: 10px;
}
.option-value {
  font-family: var(--font-mono); font-size: 15px;
  font-weight: 500; color: var(--accent); flex-shrink: 0;
}
.option-hint {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text3); text-transform: none; letter-spacing: 0;
}

/* ── Segmented control ── */
.seg-control {
  display: flex;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px; gap: 3px; width: 100%;
}
.seg-btn {
  flex: 1; padding: 9px 4px;
  border: none; background: transparent; border-radius: 6px;
  font-family: var(--font-ui); font-size: 12px; font-weight: 600;
  color: var(--text2); cursor: pointer;
  transition: background var(--transition), color var(--transition);
  -webkit-user-select: none; white-space: nowrap; min-width: 0;
}
.seg-btn.active { background: var(--accent); color: #0a0a0f; }

/* ── Backup info ── */
.backup-info {
  margin-top: -8px;
  margin-bottom: 16px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text2);
  font-family: var(--font-mono);
  display: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.backup-info.visible { display: block; }
.backup-info strong { color: var(--accent); }

.backup-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.backup-info-row span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* ── Toggle switch ── */
.backup-toggle {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.toggle-track {
  display: block;
  width: 38px;
  height: 22px;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: 11px;
  position: relative;
  transition: background var(--transition), border-color var(--transition);
}
.toggle-thumb {
  display: block;
  width: 16px;
  height: 16px;
  background: var(--text3);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 2px;
  transform: translateY(-50%);
  transition: left var(--transition), background var(--transition);
}
.backup-toggle.active .toggle-track {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  border-color: var(--accent);
}
.backup-toggle.active .toggle-thumb {
  left: 18px;
  background: var(--accent);
}
.backup-toggle:active .toggle-track { opacity: 0.8; }

/* ── Management buttons ── */
.mgmt-row {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}
.btn-mgmt {
  flex: 1;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 12px; font-weight: 700;
  cursor: pointer;
  transition: background var(--transition), opacity var(--transition);
  white-space: nowrap;
  border: 1px solid transparent;
}
.btn-mgmt-danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}
.btn-mgmt-danger:active { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.btn-mgmt-neutral {
  background: transparent;
  border-color: var(--border);
  color: var(--text2);
}
.btn-mgmt-neutral:active { background: var(--bg3); }

/* ── Range ── */
.dsk-range {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px;
  background: var(--bg3); border-radius: 4px;
  outline: none; cursor: pointer; display: block;
}
.dsk-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); cursor: pointer;
  border: 3px solid var(--bg2);
  box-shadow: 0 0 0 1px var(--accent);
  transition: transform 0.1s;
}
.dsk-range:active::-webkit-slider-thumb { transform: scale(1.2); }
/* ── Slider accordion ── */
.slider-hidden {
  display: none !important;
}
.slider-collapsed {
  margin-bottom: 10px !important;
}
.slider-collapsed .option-label {
  margin-bottom: 0;
}
.slider-indicator {
  font-size: 18px;
  font-weight: 400;
  color: var(--text3);
  margin-left: 6px;
  flex-shrink: 0;
  transition: color var(--transition);
  line-height: 1;
}
.option-label:hover .slider-indicator,
.option-label:active .slider-indicator {
  color: var(--accent);
}
/* La label completa es clickable — feedback táctil */
.option-label {
  -webkit-user-select: none;
  user-select: none;
  border-radius: 4px;
  padding: 2px 0;
  transition: opacity var(--transition);
}
.option-label:active { opacity: 0.7; }

.range-hints {
  display: flex; justify-content: space-between;
  margin-top: 6px;
  font-family: var(--font-mono); font-size: 10px; color: var(--text3);
}

/* ── Text input ── */
.dsk-input {
  width: 100%; padding: 10px 14px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: var(--font-mono); font-size: 14px; outline: none;
  transition: border-color var(--transition);
  -webkit-user-select: text; user-select: text;
}
.dsk-input:focus { border-color: var(--accent); }
.dsk-input::placeholder { color: var(--text3); }

/* ── Action row (compress + estimate) ── */
#sectionAction {
  padding: 0 0 4px;
  width: 100%;
}
.action-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
  width: 100%;
}

/* Botón comprimir ocupa todo el espacio disponible */
.btn-compress {
  flex: 1;
  padding: 18px;
  background: var(--accent); color: #0a0a0f;
  border: none; border-radius: var(--radius);
  font-family: var(--font-ui); font-size: 17px; font-weight: 800;
  letter-spacing: 1px; text-transform: uppercase;
  cursor: pointer; display: flex; align-items: center;
  justify-content: center; gap: 10px;
  transition: opacity var(--transition), transform 0.1s;
  position: relative; overflow: hidden;
}
.btn-compress::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 60%);
  pointer-events: none;
}
.btn-compress:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-compress:not(:disabled):active { transform: scale(0.98); opacity: 0.9; }
.btn-icon { font-size: 20px; flex-shrink: 0; }

/* Botón estimar — mismo alto que comprimir, ancho fijo */
.btn-estimate {
  flex-shrink: 0;
  width: 64px;
  background: var(--bg2);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--accent);
  font-family: var(--font-ui);
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), transform 0.1s;
  position: relative;
  overflow: hidden;
}
.btn-estimate::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, transparent) 0%, transparent 60%);
  pointer-events: none;
}
.btn-estimate:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-estimate:not(:disabled):active {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  transform: scale(0.97);
}

/* ── Progress ── */
.progress-filename {
  font-family: var(--font-mono); font-size: 12px; color: var(--text2);
  margin-bottom: 12px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; width: 100%;
}
.progress-track {
  width: 100%; height: 6px;
  background: var(--bg3); border-radius: 6px;
  overflow: hidden; margin-bottom: 10px;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 6px; transition: width 0.3s ease;
}
.progress-stats {
  font-family: var(--font-mono); font-size: 13px;
  color: var(--text2); text-align: right; margin-bottom: 14px;
}
.btn-cancel {
  width: 100%; padding: 12px;
  background: transparent; border: 1px solid var(--danger);
  border-radius: var(--radius-sm); color: var(--danger);
  font-family: var(--font-ui); font-size: 14px; font-weight: 700;
  cursor: pointer; transition: background var(--transition);
}
.btn-cancel:active { background: color-mix(in srgb, var(--danger) 12%, transparent); }

/* ── Result ── */
.result-grid { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.result-stat {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; background: var(--bg3);
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  min-width: 0;
}
.result-stat-label {
  font-size: 12px; color: var(--text2); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.6px; flex: 1; min-width: 0;
}
.result-stat-value {
  font-family: var(--font-mono); font-size: 14px;
  font-weight: 500; color: var(--success);
  flex-shrink: 0; margin-left: 8px;
}
.result-cancelled .result-stat-value { color: var(--danger); }
.btn-new {
  width: 100%; padding: 14px;
  background: transparent; border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: var(--font-ui); font-size: 15px; font-weight: 700;
  cursor: pointer; transition: border-color var(--transition), background var(--transition);
}
.btn-new:active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

/* ── Footer ── */
#footer {
  padding: 16px; text-align: center;
  font-size: 12px; color: var(--text3);
  border-top: 1px solid var(--border);
  font-family: var(--font-mono); width: 100%;
}
#footer a { color: var(--accent2); }

/* ── Dialog ── */
.dialog-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 999; padding: 24px;
  backdrop-filter: blur(4px);
}
.dialog {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%; max-width: 340px;
  animation: dialogIn 0.18s ease;
}
@keyframes dialogIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}
.dialog-title {
  font-size: 16px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 10px; color: var(--text);
}
.dialog-msg {
  font-size: 13px; color: var(--text2);
  font-family: var(--font-mono);
  margin-bottom: 20px; line-height: 1.6;
  white-space: pre-wrap;
}
.dialog-actions { display: flex; gap: 10px; }
.dialog-btn {
  flex: 1; padding: 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui); font-size: 14px; font-weight: 700;
  cursor: pointer; border: 1px solid transparent;
  transition: background var(--transition);
}
.dialog-cancel {
  background: transparent; border-color: var(--border); color: var(--text2);
}
.dialog-cancel:active { background: var(--bg3); }
.dialog-confirm {
  background: var(--danger); color: #fff; border-color: var(--danger);
}
.dialog-confirm:active { opacity: 0.85; }

.hidden { display: none !important; }

::-webkit-scrollbar { width: 4px; height: 0; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
