/* Estilos gerais das ferramentas */
.tool-content {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.controls-section {
    background-color: var(--secondary-color);
    padding: 20px;
    border-radius: 8px;
}

.options-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    margin-top: 10px;
}

.action-button {
    width: 100%;
    margin-top: 15px;
}

.image-preview-container {
    width: 100%;
    max-height: 500px;
    border: 2px dashed var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

.output-container {
    border: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    background-color: #fff;
    margin-top: 15px;
    padding: 10px;
    display: flex;
    justify-content: center;
}

/* Estilos da biblioteca Cropper.js */
.cropper-view-box,
.cropper-face {
    border-radius: 0 !important;
}

.preview-canvas {
    max-width: 100%; /* Limita a largura ao container */
    height: 500px;
}

/* Estilos para a ferramenta Polaroid - Ajuste para Corte Único */
#pagesContainer {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.a4-page {
    width: 29.7cm;
    height: 21.0cm;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 0; /* Remove o espaço entre as polaroids */
    padding: 1cm; /* Margem de segurança da impressora */
    margin: 20px 0;
    background-color: #FFFFFF;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    box-sizing: border-box;
}

.polaroid {
    width: 100%;
    height: 100%;
    background-color: #FFFFFF;
    border: 1px dashed #d3d3d3; /* Borda pontilhada leve para guiar o corte */
    box-shadow: none;
    position: relative;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    box-sizing: border-box;
}

.image-container {
    width: 100%;
    aspect-ratio: 1 / 1.1; /* Ajuste de proporção para o novo formato */
    overflow: hidden;
    position: relative;
    border: 1px solid #adadad;
}

.image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: grab;
}

/* Estilos para a legenda da Polaroid */
.polaroid-caption {
    width: 95%;
    margin-top: 0;
    border: none;
    text-align: center;
    font-family: 'Arial', sans-serif;
    padding: 5px 0;
    resize: none;
    overflow: hidden;
    height: auto;
    min-height: 40px;
    white-space: pre-wrap;
}

/* Estilos para a ferramenta Mosaico */
.mosaico-layout {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.mosaico-layout .controls-column {
    flex-basis: 350px;
    flex-shrink: 0;
}

.mosaico-layout .preview-column {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.mosaico-layout .controls-card {
    margin-bottom: 20px;
}

.image-upload-area {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.image-upload-area:hover {
    background-color: #f8f9fa;
    border-color: #007bff;
}

.image-upload-area .remove-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    background-color: #dc3545;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.preview-grid-container {
    width: 100%;
    min-height: 400px;
    border: 2px dashed var(--border-color);
    margin: 20px auto;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f0f0f0;
    position: relative;
    overflow: hidden;
}

.preview-grid-container canvas {
    max-width: 100%;
    height: auto;
    display: block;
}

.cut-line {
    position: absolute;
    background-color: rgba(255, 0, 0, 0.7);
    z-index: 10;
}

.cut-line.horizontal {
    width: 100%;
    height: 1px;
}

.cut-line.vertical {
    width: 1px;
    height: 100%;
}

/* Estilos do Modal (compartilhado) */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.7);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 700px;
    border-radius: 8px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.close-button {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.image-crop-container {
    width: 100%;
    max-height: 500px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    width: 100%;
    justify-content: center;
}

.modal-buttons .action-button {
    width: auto;
    flex-grow: 1;
}

.remove-button {
    background-color: var(--danger-color);
}

/* Estilos para a ferramenta Replicador */
.replicador-layout {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.controls-column {
    flex-basis: 300px;
    flex-shrink: 0;
    position: sticky;
    top: 20px;
    align-self: flex-start;
}

.cards-column {
    flex-grow: 1;
}

.preview-column {
    flex-basis: 350px;
    flex-shrink: 0;
    position: sticky;
    top: 20px;
    align-self: flex-start;
}

.options-paper-card {
    margin-bottom: 20px;
}

select#paper-size {
    padding: 10px;
    font-size: 1em;
    border-radius: 8px;
    border: 1px solid #ccc;
    background-color: #f9f9f9;
    min-width: 180px;
}

.cards-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: flex-start;
}

.image-card {
    background-color: #fff;
    border: 1px solid #000;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 250px;
    flex-shrink: 0;
    position: relative;
}

.image-card h3 {
    margin: 0;
    font-size: 1.2em;
    color: #0056b3;
}

.remove-button {
    background-color: #dc3545;
    border: 1px solid #dc3545;
    color: #fff;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    margin-top: 10px;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
}

.remove-button:hover {
    background-color: #c82333;
    border-color: #c82333;
}

.image-preview {
    width: 100%;
    height: 150px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    margin-bottom: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.image-preview:hover {
    background-color: #f0f0f0;
}

.image-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.action-button.card-button {
    width: 100%;
    margin-top: 10px;
}

.image-card > div:not(.image-preview) {
    display: flex;
    align-items: center;
    gap: 10px;
}

.image-card > div > label {
    flex-basis: 90px;
    text-align: right;
    font-weight: 500;
}

.image-card > div > input[type="number"] {
    flex-grow: 1;
    max-width: 120px;
}

.image-card > div > input[type="checkbox"] {
    margin-right: 5px;
}

.preview-canvas-container {
    border: 1px solid #ccc;
    background-color: #fff;
    box-shadow: 0 4px 8px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    margin-top: 15px;
}

#print-canvas {
    max-width: 100%;
    height: auto;
    border: 1px solid #000;
}

#pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    width: 100%;
}

.small-button {
    width: auto;
    padding: 8px 12px;
    font-size: 0.9em;
}

.image-card.add-card {
    border: 2px dashed var(--primary-color);
    background-color: #f0f4ff;
    color: var(--primary-color);
    text-align: center;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.image-card.add-card p {
    margin: 0;
}

.image-preview-container-card {
    width: 100%;
    height: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    margin-bottom: 5px;
    cursor: pointer;
    border: 2px dashed #ccc;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.image-preview-container-card:hover {
    background-color: #f0f0f0;
}

.remove-card-btn {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--danger-color);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
