/**
 * Camera Scanner Styles - Fullscreen Design
 * Escáner de documentos con pantalla completa nativa
 */

/* Contenedor principal - Pantalla completa directa */
.cfn-camera-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 99999;
    display: none;
    padding: 0 !important;
    margin: 0 !important;
    align-items: stretch !important;
    justify-content: stretch !important;
}

.cfn-camera-modal.show {
    display: block;
}

/* Botón cerrar flotante (X en esquina superior derecha) */
.cfn-camera-close-floating {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100001;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #fff;
    color: #fff;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.cfn-camera-close-floating:hover {
    background: rgba(255, 0, 0, 0.8);
    transform: rotate(90deg);
}

.cfn-camera-close-floating:active {
    transform: rotate(90deg) scale(0.95);
}

/* Vista de cámara en pantalla completa */
.cfn-camera-fullscreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
}

#cfn-camera-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.cfn-camera-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #fff;
    font-size: 18px;
    z-index: 100002;
}

.cfn-camera-loading span {
    display: block;
    padding: 20px 30px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 8px;
}

/* Controles flotantes de cámara (botones circulares) */
.cfn-camera-controls-floating {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 30px;
    align-items: center;
    z-index: 100002;
}

.cfn-camera-btn-round {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cfn-camera-btn-round:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.cfn-camera-btn-round:active {
    transform: scale(0.95);
}

/* Botón de captura (círculo grande) */
.cfn-camera-btn-capture {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.9);
    border: 4px solid rgba(255, 255, 255, 0.5);
}

.cfn-camera-btn-capture:hover {
    background: #fff;
    transform: scale(1.05);
}

.cfn-camera-btn-capture:active {
    transform: scale(0.95);
}

.cfn-camera-btn-small {
    width: 50px;
    height: 50px;
    font-size: 20px;
}

/* Editor en pantalla completa */
.cfn-editor-fullscreen-container {
    width: 100%;
    height: calc(100% - 120px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: auto; /* Permitir scroll si la imagen es grande */
}

#cfn-perspective-canvas {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
    touch-action: none;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.cfn-editor-hint {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(33, 150, 243, 0.9);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    max-width: 90%;
    z-index: 100002;
}

/* Controles flotantes del editor (botones inferior) */
.cfn-editor-controls-floating {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    z-index: 100002;
}

.cfn-editor-btn-floating {
    padding: 14px 28px;
    border-radius: 30px;
    border: 2px solid;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(10px);
}

.cfn-editor-btn-floating:active {
    transform: translateY(2px);
}

.cfn-editor-btn-floating.cfn-btn-primary {
    background: rgba(102, 126, 234, 0.9);
    color: #fff;
    border-color: rgba(102, 126, 234, 1);
}

.cfn-editor-btn-floating.cfn-btn-primary:hover {
    background: rgba(102, 126, 234, 1);
    transform: translateY(-2px);
}

.cfn-editor-btn-floating.cfn-btn-secondary {
    background: rgba(108, 117, 125, 0.9);
    color: #fff;
    border-color: rgba(108, 117, 125, 1);
}

.cfn-editor-btn-floating.cfn-btn-secondary:hover {
    background: rgba(108, 117, 125, 1);
    transform: translateY(-2px);
}

.cfn-camera-icon {
    font-size: 20px;
    line-height: 1;
}

/* Botón Escanear en el formulario principal */
#cfn-scan-image-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid;
    margin-top: 10px;
}

#cfn-scan-image-btn .cfn-scan-icon {
    font-size: 20px;
    line-height: 1;
}

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */
@media (max-width: 768px) {
    .cfn-camera-close-floating {
        top: 10px;
        right: 10px;
        width: 44px;
        height: 44px;
        font-size: 26px;
    }
    
    .cfn-camera-controls-floating {
        bottom: 30px;
        gap: 20px;
    }
    
    .cfn-camera-btn-capture {
        width: 70px;
        height: 70px;
    }
    
    .cfn-camera-btn-small {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    
    .cfn-editor-hint {
        bottom: 100px;
        font-size: 13px;
        padding: 10px 18px;
        max-width: 85%;
    }
    
    .cfn-editor-controls-floating {
        bottom: 20px;
        gap: 12px;
        width: calc(100% - 40px);
        max-width: 500px;
    }
    
    .cfn-editor-btn-floating {
        padding: 12px 20px;
        font-size: 14px;
        flex: 1;
    }
    
    .cfn-editor-fullscreen-container {
        height: calc(100% - 100px);
        padding: 10px;
    }
    
    #cfn-perspective-canvas {
        max-width: calc(100% - 20px);
        max-height: calc(100% - 20px);
    }
}

@media (max-width: 480px) {
    .cfn-camera-close-floating {
        top: 8px;
        right: 8px;
        width: 40px;
        height: 40px;
        font-size: 24px;
    }
    
    .cfn-camera-controls-floating {
        bottom: 25px;
        gap: 15px;
    }
    
    .cfn-camera-btn-capture {
        width: 65px;
        height: 65px;
        border-width: 3px;
    }
    
    .cfn-camera-btn-small {
        width: 42px;
        height: 42px;
        font-size: 16px;
    }
    
    .cfn-editor-hint {
        bottom: 90px;
        font-size: 12px;
        padding: 8px 15px;
    }
    
    .cfn-editor-controls-floating {
        bottom: 15px;
        gap: 10px;
        width: calc(100% - 30px);
    }
    
    .cfn-editor-btn-floating {
        padding: 10px 16px;
        font-size: 13px;
    }
}

/* Canvas oculto para captura */
#cfn-camera-canvas {
    display: none;
}
