/* ==========================================
   POSTULANDO - Estilos del Sistema de Cámara
   Versión Profesional - CORREGIDA Y OPTIMIZADA
   ========================================== */

:root {
    /* Colores principales */
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --success-color: #10b981;
    --success-hover: #059669;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --warning-color: #f59e0b;
    
    /* Colores neutrales */
    --bg-dark: #1f2937;
    --bg-medium: #374151;
    --bg-light: #f3f4f6;
    --text-light: #ffffff;
    --text-dark: #111827;
    --text-muted: #6b7280;
    
    /* Sombras */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    /* Transiciones */
    --transition-fast: 150ms ease-in-out;
    --transition-normal: 300ms ease-in-out;
}

/* ==========================================
   CONTENEDOR PRINCIPAL - CENTRADO Y REDUCIDO
   ========================================== */
.camera-container,
.camera-wrapper {
    width: 100%;
    max-width: 550px !important;
    margin: 0 auto !important;
    background: var(--bg-dark);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
}

/* ==========================================
   VISTA DE CÁMARA - REDUCIDA
   ========================================== */
.camera-view,
.camera-video-container {
    position: relative;
    width: 100%;
    max-height: 400px !important;
    background: #000;
    overflow: hidden;
    margin: 0 auto !important;
}

.camera-view video,
.camera-video {
    width: 100%;
    height: 100%;
    max-height: 400px !important;
    object-fit: contain !important;
    display: block;
}

.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.camera-frame,
.camera-overlay-guides {
    width: 85% !important;
    height: 80% !important;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    box-shadow: 
        0 0 0 9999px rgba(0, 0, 0, 0.4),
        inset 0 0 20px rgba(255, 255, 255, 0.1);
    position: relative;
}

/* Esquinas del marco */
.camera-frame::before,
.camera-frame::after {
    content: '';
    position: absolute;
    width: 35px;
    height: 35px;
    border: 3px solid var(--primary-color);
}

.camera-frame::before {
    top: -3px;
    left: -3px;
    border-right: none;
    border-bottom: none;
    border-radius: 12px 0 0 0;
}

.camera-frame::after {
    top: -3px;
    right: -3px;
    border-left: none;
    border-bottom: none;
    border-radius: 0 12px 0 0;
}

.camera-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-light);
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    backdrop-filter: blur(10px);
    white-space: nowrap;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ==========================================
   PREVIEW DE FOTO - REDUCIDA
   ========================================== */
.photo-preview,
.camera-preview-container {
    position: relative;
    width: 100%;
    max-width: 550px !important;
    max-height: 400px !important;
    background: #000;
    margin: 0 auto !important;
    overflow: hidden;
}

.photo-preview img,
.camera-preview-image {
    width: 100%;
    height: 100%;
    max-height: 400px !important;
    object-fit: contain !important;
    display: block;
}

.photo-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 16px;
    background: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, transparent 100%);
}

.photo-info {
    display: flex;
    gap: 16px;
    color: var(--text-light);
    font-size: 13px;
    font-weight: 600;
}

.photo-info span {
    background: rgba(0, 0, 0, 0.5);
    padding: 6px 12px;
    border-radius: 6px;
    backdrop-filter: blur(10px);
}

/* ==========================================
   CONTROLES - BOTONES ESTILIZADOS
   ========================================== */
.camera-controls {
    padding: 20px;
    background: var(--bg-medium);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.controls-video,
.controls-photo {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    width: 100%;
}

/* Botones base - ESTILIZADOS */
.btn-camera,
.camera-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px !important;
    border: none;
    border-radius: 10px;
    font-size: 0.9375rem !important;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-md);
    outline: none;
    position: relative;
    overflow: hidden;
    min-width: 140px !important;
    text-transform: none;
}

.btn-camera:active,
.camera-btn:active {
    transform: scale(0.97);
}

.btn-camera svg,
.camera-btn svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

/* Botón PRIMARIO - Capturar */
.btn-capture,
.camera-btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e40af 100%) !important;
    color: var(--text-light) !important;
    padding: 14px 28px !important;
    font-size: 1rem !important;
    min-width: 180px !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4) !important;
}

.btn-capture:hover,
.camera-btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, #1e3a8a 100%) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.5) !important;
}

/* Botón SECUNDARIO - Cambiar cámara */
.btn-switch,
.camera-btn-secondary {
    background: linear-gradient(135deg, #475569 0%, #334155 100%) !important;
    color: var(--text-light) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

.btn-switch:hover,
.camera-btn-secondary:hover {
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    transform: translateY(-1px);
}

/* Botón SUCCESS - Confirmar */
.btn-confirm,
.camera-btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%) !important;
    color: var(--text-light) !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4) !important;
}

.btn-confirm:hover,
.camera-btn-success:hover {
    background: linear-gradient(135deg, var(--success-hover) 0%, #047857 100%) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.5) !important;
}

/* Botón WARNING - Retomar */
.btn-retake {
    background: linear-gradient(135deg, var(--warning-color) 0%, #d97706 100%) !important;
    color: var(--text-dark) !important;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4) !important;
}

.btn-retake:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%) !important;
    transform: translateY(-2px);
}

.btn-camera:disabled,
.camera-btn:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

/* ==========================================
   ESTADO DE CARGA
   ========================================== */
.loading-state,
.camera-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 40px;
    min-height: 200px;
}

.spinner,
.camera-loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(37, 99, 235, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-state p,
.camera-loading p {
    color: var(--text-light);
    font-size: 14px;
    font-weight: 600;
}

/* ==========================================
   MENSAJES
   ========================================== */
.camera-info {
    padding: 12px 20px;
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(37, 99, 235, 0.3);
    border-radius: 8px;
    color: #60a5fa;
    font-size: 0.875rem;
    text-align: center;
    margin: 16px;
}

.camera-error {
    padding: 16px 20px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #ef4444;
    text-align: center;
    margin: 16px;
}

/* ==========================================
   RESPONSIVE - MÓVIL
   ========================================== */
@media (max-width: 768px) {
    .camera-container,
    .camera-wrapper {
        max-width: 100% !important;
        border-radius: 0;
    }
    
    .camera-view,
    .camera-video-container {
        max-height: 350px !important;
    }
    
    .camera-view video,
    .camera-video {
        max-height: 350px !important;
    }
    
    .photo-preview,
    .camera-preview-container {
        max-height: 350px !important;
    }
    
    .photo-preview img,
    .camera-preview-image {
        max-height: 350px !important;
    }
    
    .camera-controls {
        padding: 16px;
        flex-direction: column;
    }
    
    .controls-video,
    .controls-photo {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn-camera,
    .camera-btn {
        width: 100% !important;
        max-width: 300px !important;
    }
}

@media (max-width: 480px) {
    .camera-view,
    .camera-video-container {
        max-height: 280px !important;
    }
    
    .camera-view video,
    .camera-video {
        max-height: 280px !important;
    }
    
    .photo-preview,
    .camera-preview-container {
        max-height: 280px !important;
    }
    
    .photo-preview img,
    .camera-preview-image {
        max-height: 280px !important;
    }
}

/* ==========================================
   UTILIDADES
   ========================================== */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.btn-camera,
.camera-btn,
.camera-hint,
.photo-info {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}

/* ==========================================
   BOTONES MEJORADOS CON GRADIENTES
   ========================================== */

/* Botón PRIMARIO - Capturar */
.btn-capture,
.camera-btn-primary,
.btn-camera.btn-capture {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%) !important;
    color: white !important;
    padding: 14px 28px !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    border: none !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4) !important;
    transition: all 0.2s ease !important;
}

.btn-capture:hover,
.camera-btn-primary:hover,
.btn-camera.btn-capture:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e3a8a 100%) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.5) !important;
}

/* Botón SECUNDARIO - Cambiar cámara */
.btn-switch,
.camera-btn-secondary,
.btn-camera.btn-switch {
    background: linear-gradient(135deg, #475569 0%, #334155 100%) !important;
    color: white !important;
    padding: 12px 20px !important;
    font-weight: 600 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
    transition: all 0.2s ease !important;
}

.btn-switch:hover,
.camera-btn-secondary:hover,
.btn-camera.btn-switch:hover {
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

/* Botón SUCCESS - Confirmar */
.btn-confirm,
.camera-btn-success,
.btn-camera.btn-confirm {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: white !important;
    padding: 14px 28px !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4) !important;
    transition: all 0.2s ease !important;
}

.btn-confirm:hover,
.camera-btn-success:hover,
.btn-camera.btn-confirm:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.5) !important;
}

/* Botón RETOMAR */
.btn-retake,
.btn-camera.btn-retake {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    color: #1f2937 !important;
    padding: 12px 20px !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4) !important;
    transition: all 0.2s ease !important;
}

.btn-retake:hover,
.btn-camera.btn-retake:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%) !important;
    transform: translateY(-2px) !important;
}

/* Efectos hover generales */
.btn-camera:active,
.camera-btn:active {
    transform: scale(0.97) !important;
}

/* SVG icons dentro de botones */
.btn-camera svg,
.camera-btn svg {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}