* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, Helvetica, sans-serif;
}

.logo {
    display: block;
    margin: 2px auto 2px auto;
    height: 2cm;   /* tamaño aproximado físico */
}

body {
    background: #f4f6f9;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: auto;
}

/* Título */
h1 {
    text-align: center;
    margin-bottom: 25px;
}

/* Panel de controles */
.controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    background: #ffffff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    margin-bottom: 25px;
}

.control-group {
    display: flex;
    flex-direction: column;
}

.control-group label {
    font-size: 14px;
    margin-bottom: 6px;
    font-weight: bold;
}

select,
input[type="file"],
button {
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #ddd;
    font-size: 14px;
}

button {
    cursor: pointer;
    background: #007bff;
    color: white;
    transition: 0.3s;
}

button:hover {
    background: #0056b3;
}

/* PREVISUALIZACIÓN */
.preview-section {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
}

/* Hoja visual */
.paper {
    position: relative;
    background: white;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    border: 1px solid #ddd;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Tamaño proporcional real */

/* Carta (8.5x11 proporción 0.77) */
.paper.carta {
    width: 600px;
    height: 780px;
}

/* Oficio (8.5x14 proporción 0.60) */
.paper.oficio {
    width: 600px;
    height: 988px;
}

/* Canvas */
#canvas {
    width: 100%;
    height: 100%;
}

/* Resumen */
.summary {
    background: #ffffff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.summary h2 {
    margin-bottom: 10px;
}

.summary p {
    margin-bottom: 5px;
    font-size: 16px;
}

/* Botón imprimir */
.action {
    text-align: center;
}

#printBtn {
    padding: 12px 30px;
    font-size: 16px;
    background: #28a745;
}

#printBtn:hover {
    background: #1e7e34;
}

/* Responsive */
@media (max-width: 768px) {

    .paper.carta,
    .paper.oficio {
        width: 95%;
        height: auto;
        aspect-ratio: 8.5 / 11;
    }

    .paper.oficio {
        aspect-ratio: 8.5 / 14;
    }

}

.viewer {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.viewer.hidden {
  display: none;
}

.viewer-content {
  position: relative;
  max-width: 95%;
  max-height: 95%;
}

.viewer-content img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 10px;
}

.close-btn {
  position: absolute;
  top: -40px;
  right: 0;
  color: white;
  font-size: 28px;
  cursor: pointer;
}

.delete-btn {
    position: absolute;
    bottom: 8px;
    left: 8px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: rgba(220, 53, 69, 0.95);
    color: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: transform 0.2s ease, background 0.2s ease;
    z-index: 10;
}

.delete-btn:hover {
    transform: scale(1.1);
    background: rgba(200, 35, 51, 1);
}

.delete-btn:active {
    transform: scale(0.95);
}

/* Contenedor de la galería principal de páginas */
.page-viewer {
    overflow-x: auto;
    display: flex;
    gap: 15px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    margin-top: 15px;
    padding-bottom: 10px;
}

/* Contenedor interno de cada hoja */
.page-container {
    display: flex;
    gap: 15px;
}

/* Cada hoja individual */
.page-item {
    flex: 0 0 auto;
    scroll-snap-align: center;
    position: relative;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    background: white;
}

/* Canvas dentro de la hoja */
.page-item canvas {
    display: block;
    border-radius: 10px;
}

/* Indicador de página */
.page-indicator {
    text-align: center;
    margin-top: 5px;
    font-weight: bold;
}

/* Contenedor de miniaturas */
#thumbnailContainer {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 5px;
    margin-top: 10px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

/* Cada thumbnail */
.thumbnail {
    flex: 0 0 auto;
    width: 25%;       /* 1/4 de la hoja principal */
    max-width: 80px;  /* límite superior */
    height: auto;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    scroll-snap-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    background: #fff;
    transition: transform 0.2s, border 0.2s;
}

.thumbnail.selected {
    border-color: #00aaff;
    transform: scale(1.1);
}

/* Escalar el canvas dentro de cada thumbnail */
.thumbnail canvas {
    width: 100% !important;
    height: auto !important;
    border-radius: 4px;
    display: block;
}

/* ================================
   PANEL SUPERIOR RESPONSIVO REAL
================================ */

.top-controls {
    background: #fff;
    padding: 8px;
    border-radius: 14px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    margin-bottom: 8px;
}

/* FORZAR MISMA LINEA */
.row-options {
    display: flex !important;
    flex-direction: row !important;
    gap: 6px;
}

.row-options > div {
    flex: 1 1 0;
    min-width: 0;
}

/* Select con texto */
.icon-select {
    display: flex;
    align-items: center;
    background: #f3f5f7;
    padding: 3px 6px;
    border-radius: 10px;
    gap: 6px;
}

.select-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.select-wrapper small {
    font-size: 10px;
    font-weight: 600;
    color: #555;
    margin-bottom: 2px;
}

.icon-select select {
    border: none;
    background: transparent;
    font-size: 13px;
    outline: none;
}

/* ================================
   COLOR MODE
================================ */

.color-mode-row {
    display: flex !important;
    flex-direction: row !important;
    gap: 6px;
    margin-top: 6px;
}

.color-mode-option {
    flex: 1;
    text-align: center;
    padding: 8px 4px;
    border-radius: 12px;
    background: #f3f5f7;
    cursor: pointer;
    transition: 0.2s;
    border: 2px solid transparent;
}

.color-mode-option span {
    font-size: 22px;
    display: block;
}

.color-mode-option small {
    font-size: 11px;
}

/* ACTIVO */
.color-mode-option.active {
    border-color: #007bff;
    background: #e7f1ff;
}

/* ICONOS CON ESTILO REAL */

.icon-bw {
    color: #444;
}



/* ================================
   BURBUJA FLOTANTE REAL
================================ */

.floating-upload {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: #007bff;
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
    cursor: pointer;
    z-index: 9999;
    transition: 0.3s;
}

/* Efecto flotante */
.floating-upload::after {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(0,123,255,0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.6; }
    70% { transform: scale(1.6); opacity: 0; }
    100% { opacity: 0; }
}

.floating-upload .material-icons {
    font-size: 28px;
    z-index: 2;
}

.floating-upload:hover {
    transform: scale(1.1);
}

/* ====================================
   PANEL FLOTANTE RESUMEN SUPERIOR
==================================== */

.floating-summary {
    position: fixed;
    top: 15px;
    right: 15px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    padding: 8px 12px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 120px;
}

/* Cada línea */
.summary-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Texto */
.summary-text small {
    font-size: 10px;
    color: #666;
    display: block;
}

.summary-text strong {
    font-size: 14px;
}

/* Iconos */
.icon-pages {
    font-size: 22px;
    color: #007bff;
}

.icon-money {
    font-size: 22px;
    color: #28a745; /* verde dinero */
}

/* Adaptación móvil */
@media (max-width: 480px) {
    .floating-summary {
        top: 7px;
        right: 7px;
        padding: 2px 10px;
    }

    .summary-text strong {
        font-size: 18px;
    }
}

/* Reducir tamaño del título */
h1 {
    font-size: 22px;      /* antes probablemente 18px o más */
    margin-bottom: 6px;   /* reduce el espacio debajo */
    line-height: 1.2;     /* menos interlineado */
}

/* Subir el panel de controles */
.top-controls {
    margin-top: 0px;
}

/* ====================================
   ICONO IMPRESIÓN A COLOR MULTICOLOR
==================================== */

/* ====================================
   ICONO COLOR ESTILO CANVA
==================================== */

.icon-color {
    background: linear-gradient(
        135deg,
        #ff6ec4,
        #7873f5,
        #4ade80,
        #facc15,
        #fb7185
    );
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 24px;
    animation: colorShift 6s ease infinite;
}

/* Animación suave tipo Canva */
@keyframes colorShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Cuando está activo */
.color-mode-option.active {
    background: linear-gradient(135deg, #eef2ff, #fdf2f8);
    border-color: #c7d2fe;
}

.spinner-overlay{
    position:fixed;
    top:0;
    left:0;
    width:100%;
    height:100%;
    background:rgba(255,255,255,0.9);
    display:none; /* oculto al inicio */
    justify-content:center;
    align-items:center;
    flex-direction:column;
    z-index:9999;
}

.spinner{
    width:60px;
    height:60px;
    border:6px solid #e5e5e5;
    border-top:6px solid #2ecc71;
    border-radius:50%;
    animation:spin 1s linear infinite;
}

.spinner-text{
    margin-top:15px;
    font-size:18px;
    font-family:Arial, sans-serif;
    color:#333;
}

@keyframes spin{
    from{transform:rotate(0deg);}
    to{transform:rotate(360deg);}
}

