:root {
  --primary: #3182ce;
  --primary-hover: #2c5282;
  --bg-gradient: linear-gradient(135deg, #f0f2f5 0%, #c3cfe2 100%);
  --card-bg: #ffffff;
  --card-bg-20: #ffffff20;
  --text-main: #2d3748;
  --text-muted: #718096;
}

* {
  box-sizing: border-box;
}

p {
  margin: 0;
}

body {
  font-family: "Segoe UI", sans-serif;
  margin: 0;
  min-height: 100vh;
  background: var(--bg-gradient);
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-main);
  padding: 15px; /* Respiro lateral para mobile */
}

header h1 {
  font-size: clamp(2rem, 8vw, 3rem); /* Fonte diminui conforme a tela */
  margin: 0;
}

header h1 span {
  color: var(--primary);
}
header p {
  font-size: clamp(0.85rem, 3.2vw, 1.2rem);
  color: var(--text-muted);
  margin-bottom: 40px;

  white-space: nowrap;
  display: block;
}

.page-container {
  text-align: center;
  max-width: 900px;
  width: 100%; /* Ocupa o espaço disponível */
  padding: 20px 0;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.tool-card {
  background: var(--card-bg);
  padding: 30px;
  border-radius: 20px;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.tool-card:not(.disabled):hover {
  transform: translateY(-8px);
  border-color: var(--primary);
}

.tool-card .icon {
  font-size: 3rem;
  margin-bottom: 15px;
}

.btn-access {
  margin-top: 20px;
  padding: 10px 25px;
  background: var(--primary);
  color: white;
  border-radius: 50px;
  font-weight: bold;
}

.container {
  background: var(--card-bg);
  padding: clamp(15px, 5vw, 30px);
  border-radius: 15px;
  border: 2px dashed #cbd5e0;
  text-align: center;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  width: 100%;
}

.container.dragover {
  border-color: var(--primary);
  background: #ebf8ff;
}

.selector {
  border: dashed 1px #cbd5e0;
  padding: 20px;
  border-radius: 5px;
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.loader-content {
  width: 90%;
  max-width: 400px;
}

.progress-wrapper {
  width: 100%;
  height: 20px;
  background: #edf2f7;
  border-radius: 5px;
  overflow: hidden;
  margin: 15px 0;
}
.progress-bar {
  width: 0%;
  height: 100%;
  background: var(--primary);
  transition: width 0.2s ease;
}

.filter-container {
  display: flex;
  gap: 8px;
  margin: 15px 0;
}

#filterInput {
  flex: 1;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  outline: none;
  font-size: 16px; /* Impede zoom automático no iOS */
}

#fileList {
  margin: 15px 0;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #edf2f7;
  border-radius: 8px;
}

.file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid #edf2f7;
  background: #fff;
}

.file-item span {
  flex: 1;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 15px;
  text-align: left;
}

.btn-remove {
  flex: 0 0 35px;
  width: 35px;
  height: 35px; /* Maior para facilitar o toque no mobile */
  background: #feb2b2;
  color: #9b2c2c;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.actions {
  display: flex;
  gap: 10px;
}

button {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
}

#mergeBtn {
  background: var(--primary);
  color: white;
}
#mergeBtn:disabled {
  background: #cbd5e0;
  cursor: not-allowed;
}
.btn-clear {
  background: #e5e7eb;
  color: #4a5568;
}
#clearFilterBtn {
  background: #edf2f7;
  flex: 0 0 45px;
}

footer p {
  border: solid 1px var(--primary);
  background-color: var(--card-bg-20);
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 40px;
  border-radius: 5px;
  padding: 15px;
  line-height: 1.5;
}

/* Ajustes Específicos para Mobile */
@media (max-width: 600px) {
  .actions {
    flex-direction: column;
  } /* Botões um em cima do outro */
  .tool-card {
    padding: 20px;
  }
  .selector {
    padding: 15px;
    font-size: 14px;
  }
}
