* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    background: #000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: #fff;
    -webkit-tap-highlight-color: transparent;
}

body {
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
    position: relative;
    background: #000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.header {
    display: none; /* Ocultar header en modo cámara */
}

.camera-section {
    position: relative;
    width: 100%;
    flex: 1;
    background: #000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Mirror effect */
    position: absolute;
    top: 0;
    left: 0;
}

.preview-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    padding: 0;
}

#preview {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform: scaleX(-1); /* Mirror effect */
    background: #000;
}

.controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.4) 50%, transparent 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    z-index: 20;
}

.btn {
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    transform: scale(0.9);
}

.btn-capture {
    width: 70px;
    height: 70px;
    background: #fff;
    border: 4px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
    position: relative;
}

.btn-capture::after {
    content: '';
    position: absolute;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #000;
}

.btn-capture:active::after {
    transform: scale(0.85);
}

.capture-icon {
    display: none; /* Ocultar icono, usar solo el círculo */
}

.btn-primary {
    background: #10b981;
    color: white;
    width: 50px;
    height: 50px;
    font-size: 24px;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.4);
}

.btn-primary:active {
    background: #059669;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    width: 50px;
    height: 50px;
    font-size: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:active {
    background: rgba(255, 255, 255, 0.3);
}

.preview-container .btn {
    position: absolute;
    bottom: 30px;
}

.preview-container .btn-secondary {
    left: 30px;
}

.preview-container .btn-primary {
    right: 30px;
}

.status {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    text-align: center;
    font-size: 14px;
    min-height: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    z-index: 30;
    pointer-events: none;
}

.status.success {
    color: #10b981;
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.5);
}

.status.error {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.5);
}

.status.info {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.5);
}

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #fff;
    z-index: 40;
    background: rgba(0, 0, 0, 0.8);
    padding: 30px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.preview-container {
    animation: fadeIn 0.3s ease;
}

.controls {
    animation: slideUp 0.3s ease;
}

/* Flash effect cuando se captura */
@keyframes flash {
    0%, 100% {
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
}

.flash-effect {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    z-index: 50;
    pointer-events: none;
    animation: flash 0.3s ease;
}

/* Safe area para iPhone con notch */
@supports (padding: max(0px)) {
    .controls {
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}

/* Mensaje final después de enviar */
.final-message {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.5s ease;
}

.message-content {
    text-align: center;
    padding: 40px;
    color: #fff;
}

.message-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: scaleIn 0.5s ease;
}

.message-content h2 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #10b981;
}

.message-content p {
    font-size: 18px;
    line-height: 1.6;
    opacity: 0.9;
    max-width: 300px;
    margin: 0 auto;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Deshabilitar controles */
.controls.disabled {
    pointer-events: none;
    opacity: 0.3;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

