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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 100%;
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2em;
    margin-bottom: 10px;
}

header p {
    opacity: 0.9;
    font-size: 1.1em;
}

main {
    padding: 30px;
}

/* Sección de cámara */
.camera-section {
    text-align: center;
}

.camera-frame {
    position: relative;
}

#video {
    width: 100%;
    max-width: 100%;
    border-radius: 12px;
    background: #000;
    display: block;
    margin-bottom: 20px;
}

.face-guide {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.face-guide-oval {
    width: min(72%, 360px);
    aspect-ratio: 3 / 4;
    border: 3px dashed rgba(255, 255, 255, 0.9);
    border-radius: 50% / 42%;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.22);
}

.face-guide-text {
    margin-top: 14px;
    color: #fff;
    font-weight: 600;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}

.gender-selection {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.gender-selection label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #333;
    font-weight: 500;
}

/* Controles */
.controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 20px;
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 150px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #56CCF2 0%, #2F80ED 100%);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #A8B3C5 0%, #8895A7 100%);
    color: white;
}

/* Sección de previsualización */
.preview-section,
.result-section {
    text-align: center;
}

.preview-section h2,
.result-section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5em;
}

#capturedImage,
#resultImage {
    width: 100%;
    max-width: 100%;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

/* Sección de carga */
.loading-section {
    text-align: center;
    padding: 40px 0;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #4A90E2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.loading-section p {
    color: #666;
    font-size: 1.2em;
}

/* Sección de error */
.error-section {
    text-align: center;
    padding: 20px 0;
}

.error-message {
    background: #fee;
    border: 2px solid #fcc;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.error-icon {
    font-size: 3em;
    display: block;
    margin-bottom: 10px;
}

.error-message p {
    color: #c33;
    font-size: 1.1em;
}

/* Footer */
footer {
    background: #f5f5f5;
    padding: 20px;
    text-align: center;
    color: #666;
}

/* Responsive */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 1.5em;
    }

    header p {
        font-size: 1em;
    }

    main {
        padding: 20px;
    }

    .btn {
        min-width: 100%;
        margin-bottom: 10px;
    }

    .controls {
        flex-direction: column;
    }
}

/* PWA Install prompt */
.install-prompt {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 15px 25px;
    border-radius: 30px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    display: none;
    align-items: center;
    gap: 15px;
    z-index: 1000;
}

.install-prompt.show {
    display: flex;
}

.install-prompt button {
    background: #4A90E2;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
}
