/* ============================================================
   FONTE CUSTOMIZADA
   ============================================================ */
@font-face {
  font-family: "Bebas";
  src: url("../fonts/Coolvetica Rg.otf") format("opentype");
  font-weight: normal;
  font-style: normal;
}

/* ============================================================
   RESET GLOBAL
   ============================================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body, input, button, select, textarea, label, span, p, h1, h2, h3, h4, h5, h6,
div, section, article, aside, header, footer, nav, main, form, li, a, td, th {
  font-family: Arial, Helvetica, sans-serif;
}

.fa, .fas, .far, .fab, .fal, .fad, .fa-solid, .fa-regular,
.fa-brands, [class*="fa-"] {
  font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands", "FontAwesome" !important;
}

/* ============================================================
   BODY
   ============================================================ */
body {
  min-height: 100vh;
  background: #0aa39a url("../img/pattern.png") repeat;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 0;
}

/* ============================================================
   TELA WRAPPER
   ============================================================ */
.tela {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 20px 60px;
  min-height: 100vh;
  box-sizing: border-box;
}

/* ============================================================
   PAGE CONTAINER
   ============================================================ */
.page-container {
  width: 95%;
  max-width: 1000px;
  background: #fff;
  border-radius: 35px;
  padding: 25px 30px 60px;
  position: relative;
  overflow: visible;
}

/* ============================================================
   TOPO / HEADER
   ============================================================ */
.topo {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 30px;
}

.topo-left {
  position: relative;
  width: 400px;
  height: 70px;
}

.topo-left-blue {
  position: absolute;
  top: 0; left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  padding-right: 40px;
  font-family: "Bebas", sans-serif;
  font-size: 36px;
  width: 400px;
  height: 70px;
  background: #00353E;
  border-radius: 12px 0 0 0;
  z-index: 2;
  clip-path: polygon(0 0, 100% 0, calc(100% - 40.39px) 100%, 0 100%);
}

.topo-left-green {
  position: absolute;
  top: 20px; left: 350px;
  width: 60px; height: 50px;
  background: #76B82A;
  z-index: 1;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.topo-right {
  width: 340px; height: 70px;
  background: #00353E;
  border-radius: 0 0 12px 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  clip-path: polygon(40.39px 100%, 100% 100%, 100% 0, 0 0);
}
.topo-right img { height: 90px; }

/* ============================================================
   TABS BAR (Oculta na nova versão)
   ============================================================ */
.tabs-bar {
  display: none;
}

/* ============================================================
   HOME VIEW (Grade de Ferramentas)
   ============================================================ */
.home-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  padding: 20px 0;
  animation: fadeIn 0.4s ease;
}

.home-card {
  background: #fff;
  border: 2px solid #eef7f7;
  border-radius: 24px;
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.home-card:hover {
  transform: translateY(-5px);
  border-color: #0aa39a;
  box-shadow: 0 12px 24px rgba(10,163,154,0.12);
}

.home-card-icon {
  width: 70px;
  height: 70px;
  background: #e8f9f7;
  color: #0aa39a;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  transition: all 0.3s ease;
}

.home-card:hover .home-card-icon {
  background: #0aa39a;
  color: #fff;
}

.home-card h3 {
  font-size: 18px;
  color: #00353E;
  font-weight: 800;
  margin: 0;
}

.home-card p {
  font-size: 13px;
  color: #888;
  line-height: 1.4;
  margin: 0;
}

/* ============================================================
   NAV / CABEÇALHO DA FERRAMENTA
   ============================================================ */
.tool-nav {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 25px;
}

.btn-back {
  background: #f0fdf9;
  color: #0aa39a;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.2s ease;
}

.btn-back:hover {
  background: #0aa39a;
  color: #fff;
}

/* ============================================================
   ESTILOS PARA NOVAS FERRAMENTAS
   ============================================================ */

/* Lista de Imagens (JPG para PDF) */
#jpg_file_list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 15px;
  list-style: none;
  margin-bottom: 20px;
}

.jpg-item {
  background: #fff;
  border: 1.5px solid #d6f0ee;
  border-radius: 14px;
  padding: 8px;
  position: relative;
  text-align: center;
}

.jpg-thumb {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 8px;
}

.jpg-name {
  font-size: 11px;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.btn-remove-jpg {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #e74c3c;
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Girar PDF */
.rotate-options {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin: 20px 0;
}

.rotate-card {
  flex: 1;
  background: #fff;
  border: 2px solid #eef7f7;
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.rotate-card:hover {
  border-color: #0aa39a;
  background: #f0fdf9;
}

.rotate-card.active {
  border-color: #0aa39a;
  background: #f0fdf9;
  box-shadow: 0 0 0 2px #0aa39a;
}

.rotate-card i {
  font-size: 24px;
  color: #0aa39a;
  margin-bottom: 10px;
}

.rotate-card span {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #00353E;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  padding: 24px 30px;
}

/* ============================================================
   TAB CONTENT / TOOL VIEW
   ============================================================ */
.tab-content, .tool-view { display: none; }
.tab-content-ativa, .tool-view-active { display: block; animation: fadeIn 0.3s ease; }

/* ============================================================
   TOOL CARD
   ============================================================ */
.tool-card {
  border: 2px solid #d6f0ee;
  border-radius: 20px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  background: #fff;
}

.tool-icon-header {
  display: flex;
  align-items: center;
  gap: 18px;
}

.tool-icon {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, #e8f9f7, #b2eadf);
  color: #0aa39a;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(10,163,154,.2);
}

.tool-icon-header h2 {
  font-size: 20px;
  font-weight: 800;
  color: #00353E;
  margin-bottom: 4px;
}
.tool-icon-header p {
  font-size: 13px;
  color: #888;
  margin: 0;
}

/* ============================================================
   DROP ZONE
   ============================================================ */
.drop-zone {
  border: 2.5px dashed #b2e4e1;
  border-radius: 18px;
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #fafefe;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  text-align: center;
}
.drop-zone:hover,
.drop-zone.drag-over {
  border-color: #0aa39a;
  background: #f0fdf9;
}

.drop-icon {
  font-size: 48px;
  color: #0aa39a;
  opacity: .7;
}

.drop-text {
  font-size: 15px;
  font-weight: 600;
  color: #00353E;
}
.drop-sub {
  font-size: 12px;
  color: #aaa;
}

/* ============================================================
   LISTA DE ARQUIVOS MERGE — com thumbnail
   ============================================================ */
.lista-header {
  display: none;
}

.lista-grid-merge {
  display: none;
}

#merge_file_list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 20px;
  margin-bottom: 15px;
  padding: 10px;
}

/* ── ITEM: thumbnail largo + info + ordem + remover ── */
.merge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 15px 10px;
  gap: 10px;
  border: 1.5px solid #d6f0ee;
  border-radius: 16px;
  background: #fff;
  cursor: grab;
  position: relative;
  transition: background .2s, box-shadow .15s, transform .15s;
}
.merge-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(10,163,154,.14);
  background: #f9fdfd;
}
.merge-item.dragging {
  opacity: .45;
  cursor: grabbing;
  box-shadow: 0 10px 28px rgba(10,163,154,.2);
}

/* ── THUMBNAIL ── */
.merge-thumb {
  width: 90px;
  height: 120px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: #f0fdf9;
  border: 1px solid #c8ece9;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(0,53,62,.10);
  position: relative;
}

.merge-thumb::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, #0aa39a, #76B82A);
  border-radius: 8px 0 0 8px;
}

.merge-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.merge-thumb-placeholder {
  font-size: 28px;
  color: #b2e4e1;
}

/* ── INFO DO ARQUIVO ── */
.merge-item-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  align-items: center;
}

.merge-item-nome {
  font-size: 11px;
  font-weight: 700;
  color: #053f3a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  text-align: center;
  display: block;
}

.merge-item-size {
  font-size: 11px;
  color: #aaa;
}

/* ── BADGE DE ORDEM ── */
.merge-item-order {
  position: absolute;
  top: -10px;
  left: -10px;
  z-index: 2;
}
.order-badge {
  background: #0aa39a;
  color: white;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* ── BOTÃO REMOVER ── */
.btn-remover-merge {
  position: absolute;
  top: -10px;
  right: -10px;
  background: #e74c3c;
  color: white;
  border: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  transition: all 0.2s;
  z-index: 2;
}
.btn-remover-merge:hover {
  background: #c0392b;
  transform: scale(1.1);
}

/* ── CONTROLES DE MOVER ── */
.merge-controls {
  display: flex;
  gap: 8px;
  margin-top: 5px;
}
.btn-move {
  background: #f0fdf9;
  color: #0aa39a;
  border: 1px solid #b2e4e1;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-move:hover:not(:disabled) {
  background: #0aa39a;
  color: white;
}
.btn-move:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: #f9f9f9;
  color: #ccc;
  border-color: #ddd;
}

.drag-hint {
  font-size: 13px;
  color: #888;
  text-align: center;
  font-style: italic;
  margin-top: 10px;
}

/* ============================================================
   FILE INFO BAR (extract)
   ============================================================ */
.file-info-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f0fdf9;
  border: 1.5px solid #b2e4e1;
  border-radius: 14px;
  padding: 14px 18px;
}
.file-info-bar span {
  font-size: 14px;
  font-weight: 600;
  color: #053f3a;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.badge-pages {
  background: #0aa39a !important;
  color: white !important;
  border-radius: 20px;
  font-size: 12px !important;
  font-weight: 700 !important;
  padding: 3px 12px;
  flex: unset !important;
  white-space: nowrap;
}

/* ============================================================
   PRÉVIA DA CAPA DO PDF (aba Extrair)
   ============================================================ */
.capa-preview-wrapper {
  display: flex;
  justify-content: flex-start;
  animation: fadeInUp .3s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.capa-preview-inner {
  background: #f7fdfd;
  border: 1.5px solid #b2e4e1;
  border-radius: 16px;
  padding: 14px 18px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.capa-label {
  font-size: 11px;
  font-weight: 700;
  color: #0aa39a;
  text-transform: uppercase;
  letter-spacing: .6px;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  white-space: nowrap;
}

.capa-preview-inner > div {
  display: flex;
  flex-direction: column;
}

.capa-img-frame {
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 18px rgba(0,53,62,.13);
  border: 1.5px solid #d6f0ee;
  background: #fff;
  display: inline-flex;
}

.capa-img {
  display: block;
  width: 400px;
  height: auto;
  object-fit: contain;
}

/* ============================================================
   CAMPOS / INPUTS
   ============================================================ */
.campo-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.campo-label {
  font-size: 12px;
  font-weight: 700;
  color: #666;
  text-transform: uppercase;
  letter-spacing: .6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.campo-label i { color: #0aa39a; }

.campo-input {
  padding: 12px 16px;
  border-radius: 12px;
  border: 1.5px solid #c8d8d6;
  font-size: 14px;
  color: #1a1a1a;
  outline: none;
  background: #fff;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.campo-input:focus {
  border-color: #0aa39a;
  box-shadow: 0 0 0 3px rgba(10,163,154,.12);
}
.campo-input::placeholder { color: #b8c4c2; }

.campo-hint {
  font-size: 12px;
  color: #aaa;
}

/* ============================================================
   MODE CARDS (extract)
   ============================================================ */
.mode-cards {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.mode-card {
  flex: 1;
  min-width: 180px;
  border: 2px solid #e0eeed;
  border-radius: 16px;
  padding: 18px 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  transition: border-color .15s, background .15s, box-shadow .15s;
  background: white;
}
.mode-card i {
  font-size: 22px;
  color: #aaa;
  transition: color .15s;
}
.mode-card strong {
  font-size: 14px;
  color: #00353E;
}
.mode-card span {
  font-size: 12px;
  color: #aaa;
  line-height: 1.5;
}
.mode-card:hover {
  border-color: #0aa39a;
}
.mode-card.mode-card-ativa {
  border-color: #0aa39a;
  background: #f0fdf9;
  box-shadow: 0 3px 12px rgba(10,163,154,.15);
}
.mode-card.mode-card-ativa i { color: #0aa39a; }

/* ============================================================
   COMPRESS PREVIEW
   ============================================================ */
.compress-preview-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.preview-box {
  flex: 1;
  min-width: 180px;
  border: 1.5px solid #e0eeed;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  background: #fafafa;
}
.preview-label {
  font-size: 11px;
  font-weight: 700;
  color: #888;
  text-transform: uppercase;
  letter-spacing: .6px;
  padding: 10px 14px 6px;
}
.preview-box img {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  display: block;
}
.size-badge {
  display: block;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: #0aa39a;
  padding: 8px;
  background: #f0fdf9;
  border-top: 1px solid #e0eeed;
}

.preview-arrow {
  font-size: 24px;
  color: #0aa39a;
  flex-shrink: 0;
}

/* SLIDER */
.slider-qualidade {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, #0aa39a, #b2e4e1);
  outline: none;
  cursor: pointer;
}
.slider-qualidade::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #0aa39a;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(10,163,154,.4);
  border: 3px solid white;
}
.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #aaa;
  margin-top: 4px;
}

/* ============================================================
   TOOL ACTIONS
   ============================================================ */
.tool-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1.5px solid #f3f3f3;
}

/* ============================================================
   STATUS BAR
   ============================================================ */
.status-bar {
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}
.status-processando {
  background: #f0fdf9;
  color: #0aa39a;
  border: 1.5px solid #b2e4e1;
}
.status-sucesso {
  background: #f0fdf4;
  color: #1a7a4a;
  border: 1.5px solid #bbf0d0;
}
.status-erro {
  background: #fff0f0;
  color: #c0392b;
  border: 1.5px solid #f5c6cb;
}

/* ============================================================
   BOTÕES — SISTEMA UNIFICADO
   ============================================================ */
button {
  cursor: pointer;
  border: none;
  transition: background .2s, color .2s, transform .15s, box-shadow .15s;
}

.btn-primary {
  background: #0aa39a;
  color: white;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  padding: 10px 22px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-primary:hover {
  background: #088f87;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(10,163,154,.25);
}

.btn-outline {
  background: white;
  color: #0aa39a;
  border: 2px solid #0aa39a;
  border-radius: 12px;
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-outline:hover {
  background: #f0faf9;
  transform: translateY(-1px);
}

.btn-select {
  margin-top: 10px;
}

.btn-acao-icon {
  background: none;
  border: none;
  padding: 7px 9px;
  font-size: 17px;
  color: #0aa39a;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-acao-icon:hover {
  color: #00353E;
  background: #eef7f7;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast-notif {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 14px 26px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  opacity: 0;
  transition: opacity .3s, transform .3s;
  z-index: 99999;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast-notif.toast-visivel { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-sucesso { background: #f0fdf4; color: #1a7a4a; border: 1.5px solid #bbf0d0; }
.toast-erro    { background: #fff0f0; color: #c0392b; border: 1.5px solid #f5c6cb; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 700px) {
  .topo-left { width: 260px; }
  .topo-left-blue { width: 260px; font-size: 26px; }
  .topo-right { width: 200px; }
  .tabs-bar { padding: 12px 16px 0; }
  .tab-btn { padding: 8px 14px; font-size: 13px; }
  .main-content { padding: 16px; }
  .tool-card { padding: 20px 16px; }
  .compress-preview-row { flex-direction: column; }
  .preview-arrow { transform: rotate(90deg); }
  .lista-grid-merge { grid-template-columns: 1fr 60px 40px; }
  .merge-item {
    grid-template-columns: 60px 1fr 60px 40px; /* ✅ responsivo ajustado */
  }
  .merge-thumb {
    width: 60px;
    height: 80px;
  }
  .capa-img { width: 100px; }
}

@media print {
  .tabs-bar { display: none !important; }
}