/* ===== VARIABLES Y RESET ===== */
:root {
    --primary-blue: #1e3c72;
    --secondary-blue: #2a5298;
    --gold: #D4AF37;
    --gold-light: #FFD700;
    --gold-dark: #B8860B;
    --white: #ffffff;
    --gray-light: #f8f9fa;
    --gray: #6c757d;
    --gray-dark: #343a40;
    --success: #28a745;
    --error: #dc3545;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.15);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.2);
    --shadow-gold: 0 0 30px rgba(212, 175, 55, 0.3);
    --transition-fast: 0.3s ease;
    --transition-medium: 0.5s ease;
    --transition-slow: 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== PÁGINAS Y TRANSICIONES ===== */
.page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-slow);
    transform: translateX(100px) scale(0.95);
    overflow-y: auto;
    padding: 20px 0;
}

.page.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0) scale(1);
}

.page.exit {
    opacity: 0;
    transform: translateX(-100px) scale(0.95);
}

/* ===== LOGO SECTION ===== */
.logo-section {
    text-align: center;
    margin-bottom: 30px;
    animation: fadeInDown 1s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo-pi {
    width: auto;
    height: 100px;
    margin: 40px auto 20px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pi-logo-img {
    height: 100%;
    width: auto;
    max-width: 250px;
    filter: drop-shadow(0 4px 15px rgba(30, 60, 114, 0.3));
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Logo SVG reemplaza el texto PI */

.tagline {
    color: var(--gold);
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-top: 5px;
}

/* ===== LOGIN CONTAINER ===== */
.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-box {
    background: var(--white);
    border-radius: 20px;
    padding: 35px;
    box-shadow: var(--shadow-lg), var(--shadow-gold);
    animation: fadeInUp 0.8s ease 0.3s both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-box h2 {
    color: var(--primary-blue);
    font-family: 'Roboto Slab', serif;
    font-size: 1.6rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 30px;
    letter-spacing: -0.5px;
}

/* ===== INPUT GROUPS ===== */
.input-group {
    margin-bottom: 10px;
}

.input-group label {
    display: block;
    color: var(--gray-dark);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.input-wrapper {
    position: relative;
}

.input-wrapper input {
    width: 100%;
    padding: 15px 45px 15px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    transition: all var(--transition-fast);
    background: var(--gray-light);
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--gold);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.1);
}

.input-wrapper i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
    cursor: pointer;
    transition: color var(--transition-fast);
}

.input-wrapper i:hover {
    color: var(--gold-dark);
}

.forgot-link {
    text-align: right;
    margin-bottom: 20px;
}

.forgot-link a {
    color: var(--secondary-blue);
    font-size: 0.85rem;
    text-decoration: none;
    transition: color var(--transition-fast);
}

.forgot-link a:hover {
    color: var(--gold-dark);
}

/* ===== BOTÓN LOGIN ===== */
.btn-login {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #FFE5B4 0%, #FFD700 50%, #D4AF37 100%);
    border: none;
    border-radius: 12px;
    color: var(--primary-blue);
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-login::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s ease;
}

.btn-login:hover::before {
    left: 100%;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

.btn-login:active {
    transform: translateY(0);
}

/* ===== EXTRA OPTIONS ===== */
.extra-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 25px;
}

.option-card {
    background: var(--gray-light);
    border-radius: 12px;
    padding: 20px 15px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 2px solid transparent;
}

.option-card:hover {
    border-color: var(--gold);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.option-card i {
    font-size: 1.5rem;
    color: var(--primary-blue);
    margin-bottom: 10px;
}

.option-card p {
    font-size: 0.8rem;
    color: var(--gray-dark);
    line-height: 1.4;
}

.option-card span {
    color: var(--secondary-blue);
    font-weight: 500;
}

/* ===== FACE VERIFICATION PAGE ===== */
#face-page {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
}

.face-container {
    width: 100%;
    max-width: 450px;
    padding: 20px;
}

.face-header {
    text-align: center;
    margin-bottom: 30px;
    animation: fadeInDown 0.8s ease;
}

.mini-logo {
    display: inline-block;
    margin-bottom: 15px;
}

.pi-mini {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 2px;
    border: 2px solid var(--gold);
    padding: 5px 15px;
    border-radius: 8px;
}

.face-header h2 {
    color: var(--white);
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.face-header p {
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
}

/* ===== CAMERA SECTION ===== */
.camera-section {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 25px;
    border: 1px solid rgba(255,255,255,0.2);
    animation: fadeInUp 0.8s ease 0.2s both;
}

.camera-frame {
    position: relative;
    width: 100%;
    max-width: 300px;
    aspect-ratio: 3/4;
    margin: 0 auto 20px;
    border-radius: 20px;
    overflow: hidden;
    background: #000;
}

.camera-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

.corner {
    position: absolute;
    width: 40px;
    height: 40px;
    border-color: var(--gold);
    border-style: solid;
}

.corner.top-left {
    top: 15px;
    left: 15px;
    border-width: 4px 0 0 4px;
    border-top-left-radius: 15px;
}

.corner.top-right {
    top: 15px;
    right: 15px;
    border-width: 4px 4px 0 0;
    border-top-right-radius: 15px;
}

.corner.bottom-left {
    bottom: 15px;
    left: 15px;
    border-width: 0 0 4px 4px;
    border-bottom-left-radius: 15px;
}

.corner.bottom-right {
    bottom: 15px;
    right: 15px;
    border-width: 0 4px 4px 0;
    border-bottom-right-radius: 15px;
}

#camera-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

.face-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.face-oval {
    width: 180px;
    height: 220px;
    border: 2px dashed rgba(255,255,255,0.5);
    border-radius: 50%;
    animation: pulse-oval 2s ease-in-out infinite;
}

@keyframes pulse-oval {
    0%, 100% { 
        transform: scale(1);
        border-color: rgba(255,255,255,0.5);
    }
    50% { 
        transform: scale(1.02);
        border-color: var(--gold);
    }
}

.face-instruction {
    color: rgba(255,255,255,0.9);
    font-size: 0.85rem;
    margin-top: 15px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    box-shadow: 0 0 10px var(--gold);
    animation: scan 2s ease-in-out infinite;
    z-index: 8;
}

@keyframes scan {
    0% { top: 0; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

/* ===== FACE STATUS ===== */
.face-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.status-dot {
    width: 10px;
    height: 10px;
    background: var(--gold);
    border-radius: 50%;
    animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

#face-status-text {
    color: rgba(255,255,255,0.9);
    font-size: 0.9rem;
}

/* ===== BOTÓN CAPTURE ===== */
.btn-capture {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
    border: none;
    border-radius: 12px;
    color: var(--primary-blue);
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.btn-capture:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-capture:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.security-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    color: rgba(255,255,255,0.6);
    font-size: 0.8rem;
}

.security-note i {
    color: var(--gold);
}

/* ===== PROCESSING PAGE ===== */
#processing-page {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
}

.processing-container {
    text-align: center;
    color: var(--white);
}

.spinner-ring {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 30px;
}

.ring {
    position: absolute;
    border-radius: 50%;
    border-style: solid;
    border-color: transparent;
    animation: rotate 2s linear infinite;
}

.ring:nth-child(1) {
    width: 100%;
    height: 100%;
    border-width: 4px;
    border-top-color: var(--gold);
    animation-duration: 2s;
}

.ring:nth-child(2) {
    width: 75%;
    height: 75%;
    top: 12.5%;
    left: 12.5%;
    border-width: 3px;
    border-right-color: rgba(255,255,255,0.5);
    animation-duration: 1.5s;
    animation-direction: reverse;
}

.ring:nth-child(3) {
    width: 50%;
    height: 50%;
    top: 25%;
    left: 25%;
    border-width: 2px;
    border-bottom-color: var(--gold-light);
    animation-duration: 1s;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.processing-container h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 10px;
    animation: fadeIn 1s ease;
}

.processing-container p {
    color: rgba(255,255,255,0.7);
    font-size: 0.95rem;
    animation: fadeIn 1s ease 0.3s both;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===== GOODBYE PAGE ===== */
#goodbye-page {
    background: linear-gradient(135deg, #1a472a 0%, #2d5a3d 100%);
}

.goodbye-container {
    text-align: center;
    color: var(--white);
    padding: 20px;
}

.success-animation {
    margin-bottom: 30px;
}

.checkmark-circle {
    width: 100px;
    height: 100px;
    background: var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: 0 0 30px rgba(40, 167, 69, 0.5);
    animation: scaleIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scaleIn {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

.checkmark {
    width: 45px;
    height: 25px;
    border: solid white;
    border-width: 0 0 5px 5px;
    transform: rotate(-45deg) translate(3px, -3px);
    animation: checkmark-draw 0.5s ease 0.3s both;
}

@keyframes checkmark-draw {
    from {
        width: 0;
        height: 0;
    }
    to {
        width: 45px;
        height: 25px;
    }
}

.goodbye-container h2 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 10px;
    animation: fadeInUp 0.6s ease 0.5s both;
}

.goodbye-container p {
    color: rgba(255,255,255,0.8);
    font-size: 1rem;
    animation: fadeInUp 0.6s ease 0.6s both;
}

.goodbye-message {
    margin-top: 20px;
    font-size: 1.1rem;
    color: var(--gold-light) !important;
    animation: fadeInUp 0.6s ease 0.7s both;
}

.session-closing {
    margin-top: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: rgba(255,255,255,0.6);
    font-size: 0.9rem;
    animation: fadeIn 0.6s ease 0.9s both;
}

.session-closing i {
    animation: lock-pulse 1s ease-in-out infinite;
}

@keyframes lock-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ===== TOAST NOTIFICATION ===== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--gray-dark);
    color: var(--white);
    padding: 15px 25px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: all var(--transition-fast);
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast i {
    color: var(--gold);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
    body {
        transform: scale(0.92);
        transform-origin: center top;
        width: 108.7%; /* Compensar el scale para evitar espacios laterales */
        min-height: 108.7vh;
    }
    
    .page {
        align-items: flex-start;
        padding: 10px 0;
    }
    
    .login-container {
        padding: 10px;
    }
    
    .login-box {
        padding: 20px 15px;
    }
    
    .login-box h2 {
        font-size: 1.3rem;
        margin-bottom: 20px;
    }
    
    .extra-options {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-top: 15px;
    }
    
    .option-card {
        padding: 12px 10px;
    }
    
    .logo-pi {
        width: auto;
        height: 70px;
        margin: 10px auto 15px;
    }
    
    .pi-logo-img {
        max-width: 180px;
    }
    
    .logo-text {
        font-size: 2rem;
    }
    
    .camera-frame {
        max-width: 250px;
    }
    
    .face-oval {
        width: 150px;
        height: 180px;
    }
    
    .input-wrapper input {
        padding: 12px 40px 12px 12px;
    }
    
    .btn-login {
        padding: 14px;
    }
}

/* ===== EFECTOS VIP ADICIONALES ===== */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(212, 175, 55, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(30, 60, 114, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* Shimmer effect for gold elements */
.shimmer {
    position: relative;
    overflow: hidden;
}

.shimmer::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 40%,
        rgba(255,255,255,0.3) 50%,
        transparent 60%
    );
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    from { transform: translateX(-100%) rotate(45deg); }
    to { transform: translateX(100%) rotate(45deg); }
}
