:root {
  --bg-color: #0f0f0f;
  --card-bg: #1a1a1a;
  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;
  --accent-primary: #00bcd4;
  --accent-secondary: #4caf50;
  --border-color: #333;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 20px;
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 40px;
  font-weight: 400;
}

#drop-zone {
  width: 800px;
  max-width: 100%;
  height: 250px;
  border: 2px dashed var(--border-color);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 30px;
  transition: var(--transition);
  background: var(--card-bg);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

#drop-zone::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(0, 188, 212, 0.05) 0%,
    transparent 100%
  );
  pointer-events: none;
}

#drop-zone.dragover {
  background: rgba(0, 188, 212, 0.1);
  border-color: var(--accent-primary);
  transform: scale(1.02);
  box-shadow: 0 0 30px rgba(0, 188, 212, 0.1);
}

#drop-zone:hover {
  border-color: var(--accent-primary);
  background: #222;
}

.drop-text {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.drop-hint {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.controls-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-bottom: 40px;
  width: 100%;
  max-width: 800px;
}

.controls-main {
  width: 100%;
}

.controls-libs {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: fit-content;
  background: var(--card-bg);
  padding: 20px;
  border-radius: 16px;
  border: 1px solid var(--border-color);
}

.controls-lib {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.lib-label {
  font-weight: 600;
  min-width: 90px;
  color: var(--text-primary);
}

.controls {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.controls-main .controls {
  justify-content: center;
}

button {
  padding: 14px 28px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  border-radius: 12px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}

.config-btn {
  padding: 10px 14px;
  font-size: 1.2rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}
.config-btn:hover:not(:disabled) {
  background: #333;
  transform: translateY(-2px);
}

#compress-btn {
  background: var(--accent-primary);
  color: #000;
  box-shadow: 0 4px 14px rgba(0, 188, 212, 0.3);
}

#compress-btn:hover:not(:disabled) {
  background: #00acc1;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 188, 212, 0.4);
}

#download-btn {
  background: var(--accent-secondary);
  color: #000;
  box-shadow: 0 4px 14px rgba(76, 175, 80, 0.3);
}

#download-btn:hover:not(:disabled) {
  background: #43a047;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  filter: grayscale(1);
}

#status {
  margin: 10px 0 20px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  min-height: 24px;
  transition: var(--transition);
}

.status-success {
  color: var(--accent-secondary) !important;
}
.status-error {
  color: #ff5252 !important;
}
.status-info {
  color: var(--accent-primary) !important;
}
.status-warning {
  color: #ffd740 !important;
}
.status-default {
  color: var(--text-secondary) !important;
}

#stats {
  background: var(--card-bg);
  padding: 20px 30px;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  margin-bottom: 30px;
  font-size: 0.95rem;
  line-height: 1.8;
  width: 800px;
  max-width: 100%;
}

#stats:empty {
  display: none;
}

#stats b {
  color: var(--accent-primary);
}

#image-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 100%;
  max-width: 800px;
  margin-top: 20px;
}

.image-item {
  display: flex;
  align-items: center;
  background: var(--card-bg);
  padding: 15px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  gap: 15px;
  animation: fadeIn 0.3s ease-out;
}

.image-item img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
}

.image-info {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.unsupported-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 82, 82, 0.05);
  padding: 10px 15px;
  border-radius: 8px;
  border: 1px dashed rgba(255, 82, 82, 0.2);
  gap: 15px;
  animation: fadeIn 0.3s ease-out;
}

.unsupported-item .image-info {
  color: #ff5252;
  font-weight: 500;
  font-size: 0.9rem;
}

.unsupported-item .delete-btn {
  padding: 6px 10px;
  font-size: 0.8rem;
  background: transparent;
  border: 1px solid rgba(255, 82, 82, 0.4);
}

.unsupported-item .delete-btn:hover {
  background: rgba(255, 82, 82, 0.1);
  color: #ff5252;
  box-shadow: none;
}

.image-name {
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.image-stats {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.image-stats .stats-primary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 2px;
}

.image-stats b {
  color: var(--accent-primary);
}

.delete-btn {
  background: rgba(255, 82, 82, 0.1);
  color: #ff5252;
  padding: 8px 12px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid rgba(255, 82, 82, 0.3);
  cursor: pointer;
  transition: var(--transition);
}

.delete-btn:hover {
  background: #ff5252;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 82, 82, 0.3);
}

.list-actions {
  display: none;
  width: 100%;
  max-width: 800px;
  justify-content: flex-end;
  margin-top: 10px;
}

/* Modal styles */
.modal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  transition:
    visibility 0s linear 0.35s,
    opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.modal.show {
  visibility: visible;
  opacity: 1;
  transition-delay: 0s;
}

.modal-content {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  max-width: 500px;
  width: 90%;
  padding: 30px;
  transform: scale(0.92) translateY(-15px);
  opacity: 0;
  transition:
    transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6);
  position: relative;
  z-index: 1001;
}

.modal.show .modal-content {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Evitar que elementos internos tengan transiciones propias al cerrar */
.modal-content h2,
.modal-body,
.form-group,
.modal-footer {
  transition: none;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

.modal.show .modal-footer {
  opacity: 1;
  transition-delay: 0.1s;
}

.modal-content h2 {
  margin-bottom: 20px;
  color: var(--accent-primary);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 30px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.form-group input[type="checkbox"] {
  margin-right: 8px;
  transform: scale(1.2);
  accent-color: var(--accent-primary);
}

.form-group select {
  background: var(--bg-color);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 10px;
  border-radius: 8px;
  font-size: 0.95rem;
}

.slider {
  width: 100%;
  accent-color: var(--accent-primary);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.modal-btn {
  padding: 12px 24px;
  border-radius: 8px;
  background: var(--accent-primary);
  color: #000;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    background-color 0.2s ease;
}

.modal-btn:hover {
  transform: translateY(-2px);
}

.modal-btn.cancel {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.modal-btn.cancel:hover {
  background: #333;
}

.help-icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-secondary);
  color: var(--bg-color);
  text-align: center;
  line-height: 18px;
  font-size: 12px;
  font-weight: bold;
  margin-left: 6px;
  cursor: help;
  transition: background 0.2s;
}

.help-icon:hover {
  background: var(--accent-primary);
}

/* Accordion */
.accordion-section {
  border-top: 1px solid var(--border-color);
  padding-top: 4px;
}

.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 6px;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--text-primary);
  transition: background 0.2s ease;
  text-align: left;
}

.accordion-header:hover {
  background: rgba(255, 255, 255, 0.04);
}

.accordion-header:active {
  transform: none;
}

.accordion-arrow {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--text-secondary);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.accordion-header[aria-expanded="true"] .accordion-arrow {
  transform: rotate(180deg);
}

.accordion-body {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 0 6px;
}

.accordion-body .form-group:first-child {
  margin-top: 8px;
}

.accordion-body .form-group:last-child {
  margin-bottom: 8px;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

body > * {
  animation: fadeIn 0.6s ease-out forwards;
}
