/* Reset e configurações básicas */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

header h1 {
    text-align: center;
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 2.5em;
}

nav {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.nav-link {
    padding: 12px 24px;
    text-decoration: none;
    color: #4a5568;
    border-radius: 25px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateY(-2px);
}

/* Main content */
main {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

/* Camera section */
.capture-section {
    text-align: center;
}

.camera-container {
    position: relative;
    display: inline-block;
    margin-bottom: 30px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

#video {
    width: 100%;
    max-width: 640px;
    height: auto;
    display: block;
    transform: scaleX(-1); /* Espelhar para funcionar como espelho natural */
}

.face-guide {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.oval-guide {
    width: 200px;
    height: 250px;
    border: 4px solid #00ff88;
    border-radius: 50%;
    background: rgba(0, 255, 136, 0.15);
    animation: pulse 2s infinite;
    box-shadow: 
        0 0 20px rgba(0, 255, 136, 0.5),
        inset 0 0 20px rgba(0, 255, 136, 0.2);
    transition: all 0.3s ease;
}

.oval-guide.valid {
    border-color: #2ed573;
    background: rgba(46, 213, 115, 0.2);
    box-shadow: 
        0 0 30px rgba(46, 213, 115, 0.8),
        inset 0 0 30px rgba(46, 213, 115, 0.3);
    animation: validPulse 1s infinite;
}

.oval-guide.invalid {
    border-color: #ff4757;
    background: rgba(255, 71, 87, 0.15);
    box-shadow: 
        0 0 20px rgba(255, 71, 87, 0.5),
        inset 0 0 20px rgba(255, 71, 87, 0.2);
}

@keyframes pulse {
    0% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.02); }
    100% { opacity: 0.6; transform: scale(1); }
}

@keyframes validPulse {
    0% { opacity: 0.8; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
    100% { opacity: 0.8; transform: scale(1); }
}

.guide-text {
    color: #00ff88;
    font-weight: bold;
    margin-top: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.distance-indicator {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 25px;
    color: white;
}

.distance-bar {
    width: 200px;
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    margin-bottom: 5px;
    overflow: hidden;
}

.distance-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff4757, #ffa502, #2ed573);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

/* Controls */
.controls {
    margin: 20px 0;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    margin: 0 10px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #2ed573 0%, #17a2b8 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #ff4757 0%, #ff3742 100%);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #ffa502 0%, #ff6348 100%);
    color: white;
}

/* Preview section */
.preview-section {
    margin-top: 30px;
    padding: 20px;
    border: 2px dashed #ddd;
    border-radius: 15px;
    background: rgba(248, 249, 250, 0.8);
}

.preview-section h3 {
    margin-bottom: 20px;
    color: #4a5568;
}

#capturedImage {
    max-width: 300px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.preview-controls {
    margin-top: 20px;
}

/* Status message */
.status-message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    font-weight: 500;
    display: none;
}

.status-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    .nav-link {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 14px;
        margin: 5px;
    }
    
    .oval-guide {
        width: 150px;
        height: 200px;
    }
    
    .distance-bar {
        width: 150px;
    }
}