/* Variáveis */
:root {
    --a4-ratio: 1.4142; /* √2 */
    --primary-color: #2196F3;
    --success-color: #4CAF50;
    --danger-color: #F44336;
}

/* Estilos gerais */
body {
    background-color: #f8f9fa;
    padding-bottom: 2rem;
    transition: background-color 0.3s;
}

/* Container da câmera */
#camera-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

#camera-preview {
    width: 100%;
    aspect-ratio: calc(1 / var(--a4-ratio));
    object-fit: cover;
    background: #000;
}

/* Controles da câmera */
.camera-controls {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 20px;
    z-index: 10;
}

/* Botão esquerdo (alternar câmera) */
#switch-camera {
    width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    justify-self: start;
}

/* Botão central (captura) */
#capture-btn {
    width: 64px;
    height: 64px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    grid-column: 2;
}

#capture-btn i {
    font-size: 24px;
}

/* Botão direito (finalizar) */
#finish-capture-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    justify-self: end;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

#finish-capture-btn i {
    font-size: 20px;
}

/* Lista de páginas */
.page-item {
    position: relative;
    width: 100%;
    aspect-ratio: 1; /* Moldura quadrada */
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-item img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Mantém a proporção A4 dentro da moldura quadrada */
    transition: transform 0.3s ease;
}

.page-item.rotated img {
    transform: rotate(90deg);
}

.page-controls {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 20;
}

.page-item:hover .page-controls {
    opacity: 1;
}

.page-controls .btn {
    padding: 4px 8px;
    backdrop-filter: blur(4px);
    background-color: rgba(255,255,255,0.8);
}

/* Botões de ação */
.action-buttons {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #f8f9fa;
    padding: 1rem;
    z-index: 1000; /* Valor muito alto para garantir que fique acima de tudo */
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

/* Modo escuro */
body.modo-escuro {
    background-color: #212529;
    color: #fff;
}

body.modo-escuro .page-item {
    background: #343a40;
}

/* Loading */
#loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background: rgba(255,255,255,0.9);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

body.modo-escuro #loading {
    background: rgba(33,37,41,0.9);
}

/* Responsividade */
@media (max-width: 768px) {
    .page-controls {
        opacity: 1; /* Sempre visível em telas móveis */
        background-color: rgba(0, 0, 0, 0.5);
        border-radius: 5px;
        padding: 5px;
    }
    
    .camera-controls {
        padding: 0 10px;
        bottom: 15px;
    }
    
    #finish-capture-btn {
        width: 40px;
        height: 40px;
    }
    
    #capture-btn {
        width: 56px;
        height: 56px;
    }
    
    #switch-camera {
        width: 40px;
        height: 40px;
    }
    
    .action-buttons {
        padding: 0.8rem;
    }
    
    #pages-container {
        margin-bottom: 140px; /* Maior espaço em telas menores */
    }
}

/* Modo escuro (opcional) */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #212529;
        color: #f8f9fa;
    }
    
    .action-buttons {
        background-color: #212529;
    }
}

/* Feedback de captura */
.capture-feedback {
    font-size: 18px;
    font-weight: bold;
    animation: pulse 0.5s;
}

@keyframes pulse {
    0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* Lista de páginas */
#pages-container {
    margin-bottom: 120px; /* Espaço para os botões fixos */
    padding-bottom: 20px;
    position: relative;
    z-index: 10;
} 
