/* ============================================================
   Vaccination Certificate — Premium Styles
   "Un Solo San Pedro"
   ============================================================ */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
    --brand-blue: #4169E1;
    --brand-green: #00C853;
    --brand-coral: #FF5252;
    --brand-dark: #1A1A1A;
    --brand-light: #F5F5F5;

    --blue-light: #EBF0FF;
    --green-light: #E8F9EE;
    --coral-light: #FFF0F0;
    --purple-light: #F3EEFF;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.10), 0 8px 20px rgba(0, 0, 0, 0.06);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

/* ── Global Reset ──────────────────────────────────────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: auto;
    background: linear-gradient(315deg, rgba(65, 105, 225, 1) 3%, rgba(0, 201, 183, 1) 38%, rgba(0, 200, 83, 1) 68%, rgba(255, 82, 82, 1) 98%);
    animation: gradient 15s ease infinite;
    background-size: 400% 400%;
    background-attachment: fixed;
    color: var(--brand-dark);
    min-height: 100vh;
    position: relative;
}

/* ── Animated Gradient ────────────────────────────────────── */
@keyframes gradient {
    0% {
        background-position: 0% 0%;
    }

    50% {
        background-position: 100% 100%;
    }

    100% {
        background-position: 0% 0%;
    }
}

/* ── Animated Wave Strips ─────────────────────────────────── */
.wave-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.wave-bg .wave {
    background: rgb(255 255 255 / 25%);
    border-radius: 1000% 1000% 0 0;
    position: fixed;
    width: 200%;
    height: 12em;
    animation: wave 10s -3s linear infinite;
    transform: translate3d(0, 0, 0);
    opacity: 0.8;
    bottom: 0;
    left: 0;
    z-index: 0;
}

.wave-bg .wave:nth-child(2) {
    bottom: -1.25em;
    animation: wave 18s linear reverse infinite;
    opacity: 0.8;
}

.wave-bg .wave:nth-child(3) {
    bottom: -2.5em;
    animation: wave 20s -1s reverse infinite;
    opacity: 0.9;
}

@keyframes wave {
    2% {
        transform: translateX(1);
    }

    25% {
        transform: translateX(-25%);
    }

    50% {
        transform: translateX(-50%);
    }

    75% {
        transform: translateX(-25%);
    }

    100% {
        transform: translateX(1);
    }
}

/* ── Utility ───────────────────────────────────────────────── */
.hidden {
    display: none !important;
}

.screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    position: relative;
    z-index: 1;
}

/* ── Loading State ─────────────────────────────────────────── */
.loading-container {
    text-align: center;
}

.loading-logo img {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    animation: pulse-logo 2s ease-in-out infinite;
}

@keyframes pulse-logo {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

.loading-spinner {
    width: 36px;
    height: 36px;
    margin: 24px auto 16px;
    border: 3px solid var(--blue-light);
    border-top-color: var(--brand-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-size: 14px;
    color: #64748b;
    font-weight: 500;
}

/* ── Error State ───────────────────────────────────────────── */
.error-container {
    text-align: center;
    background: white;
    border-radius: var(--radius-xl);
    padding: 48px 32px;
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    width: 100%;
}

.error-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.error-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--brand-dark);
    margin-bottom: 8px;
}

.error-message {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 24px;
    line-height: 1.5;
}

.error-link {
    display: inline-block;
    padding: 12px 24px;
    background: var(--brand-blue);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
}

.error-link:hover {
    background: #3558c8;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* ── Certificate ───────────────────────────────────────────── */
.certificate-wrapper {
    width: 100%;
    max-width: 520px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.certificate-wrapper.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Top decorative bar */
.cert-top-bar {
    height: 6px;
    border-radius: 20px 20px 0 0;
    overflow: hidden;
}

.cert-top-bar-inner {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-blue) 0%, #00C9B7 25%, var(--brand-green) 50%, #FFB547 75%, var(--brand-coral) 100%);
    background-size: 200% 100%;
    animation: gradient-flow 4s ease infinite;
}

@keyframes gradient-flow {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

/* Bottom decorative bar */
.cert-bottom-bar {
    height: 4px;
    border-radius: 0 0 20px 20px;
    overflow: hidden;
}

.cert-bottom-bar-inner {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-blue) 0%, var(--brand-green) 50%, var(--brand-coral) 100%);
}

/* Main card */
.certificate-card {
    background: white;
    padding: 32px 24px;
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
}

/* Subtle watermark pattern */
.certificate-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--blue-light) 0%, transparent 70%);
    opacity: 0.4;
    pointer-events: none;
}

.certificate-card::after {
    content: '';
    position: absolute;
    bottom: -40%;
    left: -20%;
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, var(--green-light) 0%, transparent 70%);
    opacity: 0.3;
    pointer-events: none;
}

/* ── Header ────────────────────────────────────────────────── */
.cert-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.cert-logo {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    flex-shrink: 0;
}

.cert-header-text {
    flex: 1;
}

.cert-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--brand-dark);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.cert-subtitle {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Folio badge */
.cert-folio {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--blue-light);
    border: 1px solid rgba(65, 105, 225, 0.15);
    padding: 6px 14px;
    border-radius: 100px;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.cert-folio-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--brand-blue);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.cert-folio-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--brand-blue);
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
}

/* ── Divider ───────────────────────────────────────────────── */
.cert-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, #e2e8f0 20%, #e2e8f0 80%, transparent 100%);
    margin: 20px 0;
    position: relative;
    z-index: 1;
}

/* ── Sections ──────────────────────────────────────────────── */
.cert-section {
    position: relative;
    z-index: 1;
}

.cert-section-title {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
}

/* Info cards */
.cert-info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.cert-info-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #fafbfc;
    border: 1px solid #f1f3f5;
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.cert-info-card:hover {
    background: white;
    border-color: #e2e8f0;
    box-shadow: var(--shadow-sm);
}

.cert-info-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cert-info-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.cert-info-label {
    font-size: 10px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.cert-info-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--brand-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Vaccines ──────────────────────────────────────────────── */
.cert-vaccines {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.cert-vaccine-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--green-light) 0%, #d4fce3 100%);
    border: 1px solid rgba(0, 200, 83, 0.2);
    border-radius: 100px;
    font-size: 13px;
    font-weight: 600;
    color: #15803d;
    transition: all 0.2s;
}

.cert-vaccine-badge::before {
    content: '💉';
    font-size: 12px;
}

.cert-vaccine-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 200, 83, 0.15);
}

.cert-campaign {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #fafbfc;
    border-radius: var(--radius-sm);
    border: 1px solid #f1f3f5;
}

.cert-campaign-label {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
}

.cert-campaign-value {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

/* ── QR Section ────────────────────────────────────────────── */
.cert-qr-section {
    text-align: center;
    padding: 8px 0;
    position: relative;
    z-index: 1;
}

.cert-qr-container {
    position: relative;
    display: inline-block;
    margin-bottom: 12px;
}

.cert-qr-img {
    width: 180px;
    height: 180px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 4px solid white;
    outline: 1px solid #e2e8f0;
    display: block;
}

.cert-qr-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: white;
    padding: 3px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.cert-qr-text {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 500;
    margin-bottom: 4px;
}

.cert-qr-url {
    font-size: 10px;
    color: #cbd5e1;
    font-family: 'SF Mono', 'Cascadia Code', monospace;
    word-break: break-all;
}

/* ── Footer ────────────────────────────────────────────────── */
.cert-footer {
    text-align: center;
    padding-top: 8px;
    position: relative;
    z-index: 1;
}

.cert-footer-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--green-light);
    border: 1px solid rgba(0, 200, 83, 0.15);
    border-radius: 100px;
    margin-bottom: 10px;
}

.cert-footer-badge span {
    font-size: 11px;
    font-weight: 600;
    color: #16a34a;
}

.cert-footer-org {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 4px;
}

.cert-footer-date {
    font-size: 11px;
    color: #94a3b8;
}

/* ── Landing Page ──────────────────────────────────────────── */
.landing {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    text-align: center;
}

.landing-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 48px 32px;
    box-shadow: var(--shadow-xl);
    max-width: 480px;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.landing-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, var(--brand-blue) 0%, var(--brand-green) 50%, var(--brand-coral) 100%);
}

.landing-logo {
    width: 96px;
    height: 96px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    margin-bottom: 24px;
}

.landing-title {
    font-size: 26px;
    font-weight: 800;
    color: var(--brand-dark);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.landing-subtitle {
    font-size: 15px;
    color: #64748b;
    line-height: 1.5;
    margin-bottom: 32px;
}

.landing-feature {
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    padding: 12px;
    border-radius: var(--radius-md);
    background: #fafbfc;
    border: 1px solid #f1f3f5;
    margin-bottom: 10px;
    transition: all 0.2s;
}

.landing-feature:hover {
    background: white;
    border-color: #e2e8f0;
    box-shadow: var(--shadow-sm);
}

.landing-feature-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.landing-feature-text {
    font-size: 14px;
    color: #475569;
    font-weight: 500;
}

.landing-footer {
    margin-top: 28px;
    font-size: 12px;
    color: #94a3b8;
    line-height: 1.6;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (min-width: 640px) {
    .certificate-card {
        padding: 40px 36px;
    }

    .cert-title {
        font-size: 24px;
    }

    .cert-info-grid {
        grid-template-columns: 1fr 1fr;
    }

    .cert-info-card:first-child {
        grid-column: span 2;
    }

    .cert-qr-img {
        width: 200px;
        height: 200px;
    }
}

/* ── Print Styles ──────────────────────────────────────────── */
@media print {
    body {
        background: white;
    }

    .certificate-wrapper {
        opacity: 1 !important;
        transform: none !important;
        box-shadow: none;
    }

    .cert-top-bar,
    .cert-bottom-bar {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}