:root {
    --verde-uajs: #006633;
    --verde-oscuro: #004d26;
    --rojo-uajs: #B22222;
    --gris-oscuro: #1a1a1a;
    --gris-medio: #666;
    --gris-claro: #f5f5f5;
    --sombra-suave: 0 10px 40px rgba(0, 102, 51, 0.15);
    --sombra-elevada: 0 20px 60px rgba(0, 0, 0, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8f4 50%, #e0f2f1 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

.background-pattern {
    position: fixed;
    inset: 0;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(0, 102, 51, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(178, 34, 34, 0.02) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(0, 102, 51, 0.02) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 450px;
}

/* HEADER */
.page-header {
    text-align: center;
    margin-bottom: 32px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

.header-content h1 {
    font-size: 28px;
    font-weight: 800;
    color: var(--verde-uajs);
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.header-content .subtitle {
    font-size: 15px;
    color: var(--gris-medio);
    font-weight: 500;
}

.header-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: white;
    border-radius: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    font-size: 13px;
    font-weight: 600;
    color: var(--verde-uajs);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #4caf50;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.1); }
}

/* CARD 3D */
.scene {
    perspective: 1500px;
    width: 100%;
    max-width: 380px;
    margin: 0 auto;
}

.card {
    width: 100%;
    aspect-ratio: 3/4;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    outline: none;
}

.card:hover {
    transform: translateY(-8px) rotateY(5deg);
}

.card.is-flipped {
    transform: rotateY(180deg);
}

.card.is-flipped:hover {
    transform: rotateY(180deg) translateY(-8px) rotateY(-5deg);
}

.card-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: 20px;
    overflow: hidden;
    background: white;
    box-shadow: var(--sombra-elevada);
    display: flex;
    flex-direction: column;
}

.card-shine {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        transparent 0%,
        rgba(255, 255, 255, 0.1) 45%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0.1) 55%,
        transparent 100%
    );
    opacity: 0;
    transition: opacity 0.6s;
    pointer-events: none;
    z-index: 10;
}

.card:hover .card-shine {
    opacity: 1;
    animation: shine 1.5s ease-in-out;
}

@keyframes shine {
    0% { transform: translateX(-100%) translateY(-100%); }
    100% { transform: translateX(100%) translateY(100%); }
}

/* FRENTE */
.card-front {
    border: 3px solid rgba(0, 102, 51, 0.1);
}

.card-header {
    background: linear-gradient(135deg, var(--verde-uajs) 0%, var(--verde-oscuro) 100%);
    padding: 20px;
    display: flex;
    gap: 16px;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.card-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.logo-container {
    flex-shrink: 0;
}

.logo-placeholder {
    width: 70px;
    height: 70px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
    padding: 10px;
}

.logo-placeholder img,
#logoInstitucional {
    width: 40%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.institution-info {
    flex: 1;
    color: white;
}

.institution-info h2 {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 2px;
}

.institution-info p {
    font-size: 14px;
    font-weight: 600;
    opacity: 0.95;
    margin-bottom: 4px;
}

.institution-info .location {
    font-size: 12px;
    opacity: 0.8;
    font-weight: 400;
}

.card-body {
    padding: 24px 20px;
    flex: 1;
    display: flex;
    gap: 20px;
}

.photo-section {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.photo-frame {
    width: 110px;
    height: 140px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f5f5f5, #e8e8e8);
    border: 3px solid rgba(0, 102, 51, 0.1);
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
}

#fotoEstudiante {
    width: 120%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
}

.photo-badge {
    font-size: 11px;
    font-weight: 700;
    color: var(--verde-uajs);
    background: rgba(0, 102, 51, 0.08);
    padding: 4px 12px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.student-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.student-name {
    font-size: 20px;
    font-weight: 800;
    color: var(--rojo-uajs);
    letter-spacing: -0.3px;
    line-height: 1.2;
    margin-bottom: 4px;
}

.info-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--gris-medio);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--gris-oscuro);
}

.info-value.email {
    font-size: 12px;
    word-break: break-all;
}

.card-footer {
    padding: 16px 20px;
    border-top: 2px solid rgba(0, 102, 51, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 102, 51, 0.02);
}

.footer-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--gris-medio);
    font-weight: 500;
}

.footer-info svg {
    color: var(--verde-uajs);
}

.platform-badge {
    font-size: 11px;
    font-weight: 800;
    color: var(--verde-uajs);
    background: rgba(0, 102, 51, 0.08);
    padding: 6px 12px;
    border-radius: 8px;
    letter-spacing: 1px;
}

/* REVERSO */
.card-back {
    transform: rotateY(180deg);
    background: linear-gradient(135deg, #ffffff 0%, #f8fdf9 100%);
    border: 3px solid rgba(0, 102, 51, 0.1);
    padding: 30px 24px;
    justify-content: space-between;
}

.back-header {
    text-align: center;
    margin-bottom: 24px;
}

.back-header h3 {
    font-size: 18px;
    font-weight: 800;
    color: var(--verde-uajs);
    margin-bottom: 6px;
}

.back-header p {
    font-size: 13px;
    color: var(--gris-medio);
    font-weight: 500;
}

.qr-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.qr-wrapper {
    background: white;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 102, 51, 0.12);
    border: 3px solid rgba(0, 102, 51, 0.1);
}

.qr-code {
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-code canvas {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.qr-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--gris-medio);
    font-weight: 500;
}

.qr-info svg {
    color: var(--verde-uajs);
    flex-shrink: 0;
}

.back-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 2px solid rgba(0, 102, 51, 0.06);
}

.security-features {
    display: flex;
    gap: 16px;
}

.feature {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--gris-medio);
    font-weight: 600;
}

.feature svg {
    color: var(--verde-uajs);
}

.back-cc {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--gris-medio);
}

.back-cc span {
    font-weight: 600;
}

.back-cc strong {
    font-weight: 700;
    color: var(--gris-oscuro);
    font-family: 'Courier New', monospace;
}

/* RESPONSIVE */
@media (max-width: 480px) {
    .container {
        max-width: 100%;
    }

    .scene {
        max-width: 100%;
    }

    .header-content h1 {
        font-size: 24px;
    }

    .card-body {
        flex-direction: column;
        padding: 20px 16px;
    }

    .photo-section {
        flex-direction: row;
        justify-content: center;
    }

    .info-row {
        grid-template-columns: 1fr;
    }

    .student-name {
        font-size: 18px;
    }
}

/* ACCESIBILIDAD */
.card:focus-visible {
    outline: 3px solid var(--verde-uajs);
    outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
    .card,
    .card-shine,
    .status-dot {
        animation: none !important;
        transition: none !important;
    }
}