/* Reset y base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 16px;
  background-color: #fff;
  color: #333;
  min-height: 100vh;
}

/* Contenedor principal */
#contenido {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* Logo responsive */
.logo {
  text-align: center;
  margin-bottom: 16px;
  padding: 0 8px;
}

.logo img {
  max-width: min(200px, 90%);
  height: auto;
}

/* Header section responsive */
.header-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 12px;
  background: #000b59;
  border-radius: 10px;
  color: #fff;
  text-align: center;
  margin-bottom: 16px;
}

.header-section .title {
  margin: 0;
  line-height: 1.2;
}

.header-section .title-main {
  display: block;
  font-size: clamp(20px, 5vw, 24px);
  /* Responsive font size */
  font-weight: 700;
  color: #fff;
}

.header-section .title-sub {
  display: block;
  margin-top: 4px;
  font-size: clamp(14px, 4vw, 16px);
  font-weight: 600;
  color: #fff;
}

.header-section p {
  margin: 4px 0 0;
  font-size: clamp(12px, 3vw, 14px);
  color: #fff;
}

/* Highlight responsive */
.highlight {
  color: #F55400;
  font-weight: bold;
  font-size: clamp(24px, 6vw, 30px);
  text-align: center;
  margin: 8px 0 16px;
  padding: 0 8px;
}

/* Client info responsive */
.client-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
  padding: 0 8px;
}

.client-info-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 16px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: clamp(14px, 4vw, 16px);
  color: #000b59;
  line-height: 1.4;
  width: 100%;
}

.client-info-box p {
  margin: 4px 0;
}

/* Client evidence responsive */
.client-evidence {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border: 1px solid #ddd;
  border-radius: 10px;
  width: 100%;
}

.client-evidence img {
  max-width: 100%;
  max-height: 200px;
  height: auto;
  object-fit: cover;
  border-radius: 8px;
}

.client-evidence figcaption {
  margin-top: 8px;
  font-size: clamp(12px, 3vw, 14px);
  color: #555;
  text-align: center;
}

/* Provisional message responsive */
.provisional-message {
  margin: 16px 8px;
  font-size: clamp(14px, 4vw, 15px);
  color: #333;
  text-align: justify;
  padding: 16px;
  background-color: #FBE2D5;
  border: 1px solid #ddd;
  border-radius: 5px;
  margin-bottom: 16px;
}

.clausula-title {
  font-size: clamp(15px, 4vw, 16px);
  margin-bottom: 8px;
}

#clausula {
  white-space: pre-line;
  font-size: clamp(14px, 4vw, 15px);
  line-height: 1.4;
}

/* Section title responsive */
.section-title {
  font-size: clamp(15px, 4vw, 16px);
  color: #000b59;
  margin: 16px 8px 12px;
  text-align: center;
  font-weight: bold;
}

/* Tallas responsive */
.tallas {
  text-align: center;
  margin: 8px;
  font-size: clamp(13px, 4vw, 14px);
  color: #000b59;
  padding: 0 8px;
}

.tallas:empty {
  display: none;
}

/* Table responsive */
.items-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  background-color: #fff;
  border: 1px solid #ddd;
  table-layout: fixed;
}

.items-table th,
.items-table td {
  padding: clamp(8px, 2vw, 12px);
  border: 1px solid #ddd;
  text-align: center;
  word-break: break-word;
  font-size: clamp(12px, 3vw, 14px);
}

.items-table th {
  background-color: #F55400;
  color: #fff;
}

/* Column widths */
.items-table .col-elemento {
  width: 40%;
}

.items-table .col-cantidad {
  width: 15%;
}

.items-table .col-nota {
  width: 40%;
}

/* Signature section responsive */
.signature-section {
  display: flex;
  justify-content: center;
  margin: 24px 8px;
  padding: 0 8px;
}

.signature-box {
  text-align: center;
  width: min(420px, 100%);
  padding: 16px;
}

.signature-box img {
  max-width: 100%;
  max-height: 160px;
  height: auto;
  object-fit: contain;
}

.signature-caption {
  margin-top: 8px;
  font-size: clamp(12px, 3vw, 14px);
  color: #555;
}

/* Footer responsive */
.footer {
  margin: 20px 8px 0;
  padding: 16px;
  background-color: #FBE2D5;
  border-radius: 5px;
  text-align: center;
  font-size: clamp(11px, 3vw, 12px);
  color: #333;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer span {
  margin: 0;
}

.footer .separator {
  display: none;
  /* Ocultar en móvil */
}

/* Print button responsive */
.print-button {
  position: fixed;
  top: 16px;
  right: 16px;
  padding: 12px 16px;
  background-color: #000b59;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: clamp(12px, 3vw, 14px);
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.print-button:hover {
  background-color: #F55400;
}

/* Utility classes */
.bold {
  font-weight: bold;
}

.orange-text {
  color: #F55400;
}

.azul-text {
  color: #000b59;
}

/* ========== MEDIA QUERIES ========== */

/* Tablets (768px y superior) */
@media (min-width: 768px) {
  body {
    padding: 20px;
  }

  .client-info {
    flex-direction: row;
    align-items: stretch;
  }

  .client-info-box {
    width: 60%;
  }

  .client-evidence {
    width: 40%;
  }

  .footer {
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 16px;
  }

  .footer .separator {
    display: block;
    border-left: 1px solid #555;
    height: 20px;
  }

  .provisional-message {
    margin: 16px 0;
  }

  .section-title,
  .tallas {
    padding: 0;
  }
}

/* Desktop (1024px y superior) */
@media (min-width: 1024px) {
  body {
    padding: 24px;
  }

  .header-section {
    padding: 20px 16px;
  }

  .client-info-box {
    font-size: 16px;
  }

  .provisional-message {
    font-size: 15px;
    padding: 20px;
  }

  .items-table th,
  .items-table td {
    padding: 12px;
    font-size: 14px;
  }
}

/* Pantallas muy grandes (1200px y superior) */
@media (min-width: 1200px) {
  #contenido {
    padding: 0 20px;
  }
}

/* Pantallas muy pequeñas (480px y inferior) */
@media (max-width: 480px) {
  body {
    padding: 12px;
  }

  .header-section {
    padding: 12px 8px;
    gap: 6px;
  }

  .client-info-box,
  .client-evidence {
    padding: 12px;
  }

  .items-table th,
  .items-table td {
    padding: 6px 4px;
    font-size: 11px;
  }

  .print-button {
    top: 12px;
    right: 12px;
    padding: 10px 12px;
  }
}

/* Modo landscape en móviles */
@media (max-height: 500px) and (orientation: landscape) {
  body {
    padding: 8px;
  }

  .logo {
    margin-bottom: 8px;
  }

  .header-section {
    padding: 12px 8px;
    margin-bottom: 12px;
  }

  .highlight {
    margin: 4px 0 8px;
  }
}

/* Para tablas en móviles - scroll horizontal si es necesario */
@media (max-width: 767px) {
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -8px;
    padding: 0 8px;
  }

  .items-table {
    min-width: 500px;
    /* Fuerza scroll horizontal si es necesario */
  }
}

/* Impresión */
@media print {
  body {
    margin: 0;
    padding: 0;
    background: white;
  }

  .print-button {
    display: none;
  }

  #contenido {
    max-width: none;
    margin: 0;
  }

  .header-section {
    margin-bottom: 12px;
  }

  .logo img {
    max-width: 150px;
  }

  .footer {
    margin-top: 16px;
  }
}