* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0f172a;
  color: #e5e7eb;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem;
}

.site-header {
  background: radial-gradient(circle at top, #1e293b, #020617);
  border-bottom: 1px solid #1e293b;
}

.site-header h1 {
  margin: 0;
  font-size: 1.9rem;
}

.subtitle {
  margin-top: 0.5rem;
  color: #9ca3af;
  font-size: 0.95rem;
}

.tool-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.5rem 0;
}

.tool-button {
  border: 1px solid #1e293b;
  background: #020617;
  color: #e5e7eb;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.tool-button:hover {
  background: #0b1120;
  border-color: #334155;
  transform: translateY(-1px);
}

.tool-button.active {
  background: #2563eb;
  border-color: #3b82f6;
}

.tool-panel {
  background: #020617;
  border-radius: 1rem;
  padding: 1.5rem;
  border: 1px solid #1f2937;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.9);
}

.tool-panel h2 {
  margin-top: 0;
  font-size: 1.3rem;
}

.tool-panel p {
  margin-top: 0.4rem;
  color: #9ca3af;
  font-size: 0.9rem;
}

.upload-area {
  margin-top: 1.2rem;
  padding: 1.5rem;
  border-radius: 0.75rem;
  border: 1px dashed #374151;
  background: #020617;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.upload-area:hover {
  border-color: #4b5563;
  background: #020617;
}

.upload-area.dragover {
  border-color: #60a5fa;
  background: #020617;
}

.upload-text {
  margin: 0 0 0.75rem 0;
  font-size: 0.9rem;
  color: #9ca3af;
}

#browse-btn {
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  border: none;
  background: #2563eb;
  color: #e5e7eb;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

#browse-btn:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

#browse-btn:active {
  transform: translateY(0);
}

.options-panel {
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid #1f2937;
}

.option-group {
  margin-bottom: 0.8rem;
}

.option-group label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
  color: #e5e7eb;
}

#quality-range {
  width: 100%;
}

#quality-value {
  font-size: 0.8rem;
  color: #9ca3af;
}

#resize-options input[type="number"] {
  width: 100%;
  padding: 0.4rem 0.55rem;
  border-radius: 0.5rem;
  border: 1px solid #1f2937;
  background: #020617;
  color: #e5e7eb;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

#resize-options input[type="number"]:focus {
  outline: none;
  border-color: #2563eb;
}

.helper-text {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.25rem;
}

.preview-wrapper {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.preview-box {
  background: #020617;
  border-radius: 0.75rem;
  border: 1px solid #111827;
  padding: 0.9rem;
}

.preview-box h3 {
  margin: 0 0 0.5rem 0;
  font-size: 0.95rem;
}

.preview-image-wrapper {
  background: #020617;
  border-radius: 0.5rem;
  border: 1px solid #020617;
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.preview-image-wrapper img {
  max-width: 100%;
  max-height: 260px;
  display: block;
}

.image-info {
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: #6b7280;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
  align-items: center;
}

#convert-btn {
  padding: 0.6rem 1.3rem;
  border-radius: 999px;
  border: none;
  background: #22c55e;
  color: #052e16;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}

#convert-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#convert-btn:not(:disabled):hover {
  background: #16a34a;
  transform: translateY(-1px);
}

.download-btn {
  padding: 0.6rem 1.3rem;
  border-radius: 999px;
  border: 1px solid #1f2937;
  background: transparent;
  text-decoration: none;
  font-size: 0.85rem;
  color: #e5e7eb;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}

.download-btn:hover:not(.disabled) {
  background: #0b1120;
  border-color: #374151;
  transform: translateY(-1px);
}

.download-btn.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.seo-text {
  margin-top: 2rem;
  padding-bottom: 2rem;
}

.seo-text h2 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.seo-text p {
  font-size: 0.9rem;
  color: #9ca3af;
}

.site-footer {
  border-top: 1px solid #020617;
  background: #020617;
  padding: 1rem 0;
  font-size: 0.8rem;
  color: #6b7280;
}

.hidden {
  display: none;
}

@media (max-width: 720px) {
  .preview-wrapper {
    grid-template-columns: 1fr;
  }

  .tool-selector {
    flex-direction: column;
  }

  .tool-button {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
}
.main-nav {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.main-nav .nav-link {
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  border: 1px solid #1e293b;
  font-size: 0.8rem;
  text-decoration: none;
  color: #e5e7eb;
  background: #020617;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    transform 0.1s ease;
}

.main-nav .nav-link:hover {
  background: #0b1120;
  border-color: #374151;
  transform: translateY(-1px);
}

.main-nav .nav-link.active {
  background: #2563eb;
  border-color: #3b82f6;
  color: #e5e7eb;
}

@media (max-width: 720px) {
  .main-nav {
    flex-direction: column;
    align-items: flex-start;
  }

  .main-nav .nav-link {
    width: 100%;
    text-align: center;
  }
}
/* ==== Brand / Logo ==== */

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.9rem;
}

.logo-mark {
  width: 40px;
  height: 40px;
  border-radius: 1rem;
  background: radial-gradient(circle at 30% 30%, #38bdf8, #6366f1 40%, #0f172a 80%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.04em;
  color: #e5e7eb;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.brand-name {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.brand-tagline {
  font-size: 0.85rem;
  color: #9ca3af;
}

@media (max-width: 640px) {
  .brand-name {
    font-size: 1.2rem;
  }

  .logo-mark {
    width: 34px;
    height: 34px;
    border-radius: 0.9rem;
    font-size: 0.9rem;
  }
}
.status-message {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: #cbd5f5;
  opacity: 0.9;
}
/* LOADER OVERLAY */
.loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 20, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 99999;
}

.hidden {
  display: none !important;
}

/* SPINNER */
.loader {
  border: 5px solid #3a3a55;
  border-top: 5px solid #6fb7ff;
  border-radius: 50%;
  width: 55px;
  height: 55px;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loader-text {
  color: #d5e1ff;
  font-size: 1rem;
  font-weight: 500;
  text-align: center;
}
.loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 20, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 99999;
}

.hidden {
  display: none !important;
}

.loader {
  border: 5px solid #3a3a55;
  border-top: 5px solid #6fb7ff;
  border-radius: 50%;
  width: 55px;
  height: 55px;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loader-text {
  color: #d5e1ff;
  font-size: 1rem;
  font-weight: 500;
  text-align: center;
}
/* =========================================================
   LOADER OVERLAY (CORREGIDO Y CON Z-INDEX MÁXIMO)
   ========================================================= */

.loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 20, 0.85);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  z-index: 999999999; /* 🔥 AHORA SÍ ESTÁ ENCIMA DE TODO */
}

.hidden {
  display: none !important;
}

.loader {
  border: 6px solid #3a3a55;
  border-top: 6px solid #6fb7ff;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 0.9s linear infinite;
  margin-bottom: 18px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loader-text {
  color: #dbe7ff;
  font-size: 1.05rem;
  font-weight: 500;
  text-align: center;
}


