:root {
    --rojo: #E73747;
    --sandia: #FC6A6D;
    --rosa-claro: #FED2D2;
    --casi-blanco: #FFFAFA;
    --blanco: #FFFFFF;
    --gris-oscuro: #353535;
    --azul: #2A439E;
    --celeste: #6095E2;
    --amarillo: #FFCF00;
    --azul-marino: #061C4F;
    --rojo-hover: #FC6A6D;
    --rojo-oscuro: #b22230;
    --rojo-claro: #FED2D2;
    --amarillo-hover: #FFCF00;
    --amarillo-claro: #FFE04A;
    --gris-claro: #FFFAFA;
    --gris-medio: #e2e5ea;
    --verde: #22c55e;
    --verde-claro: #dcfce7;
    --rojo-fondo: #FED2D2;
    --sombra-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --sombra-md: 0 4px 20px rgba(0, 0, 0, 0.12);
    --sombra-lg: 0 12px 48px rgba(0, 0, 0, 0.18);
    --sombra-xl: 0 20px 60px rgba(0, 0, 0, 0.22);
    --radio-sm: 8px;
    --radio-md: 12px;
    --radio-lg: 20px;
    --radio-xl: 24px;
    --transicion: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Avenir', 'Avenir Next', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--rojo);
    color: var(--gris-oscuro);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem 1rem;
    position: relative;
    overflow-x: hidden;
}

.brand-header,
.container,
.footer {
    position: relative;
    z-index: 1;
}

/* ====== BRAND HEADER ====== */
.brand-header {
    text-align: center;
    margin-bottom: 1rem;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: slideDown 0.6s ease-out;
    position: relative;
    width: 100%;
    max-width: 980px;
}

.brand-logo {
    max-width: 140px;
    height: auto;
    margin-bottom: 0.5rem;
    filter: brightness(0) invert(1);
    transition: opacity var(--transicion);
}

.brand-logo-fallback {
    display: none;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.brand-logo-fallback .logo-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radio-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: -0.5px;
}

.brand-logo-fallback .logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.brand-header h1 {
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    opacity: 0.9;
}

.admin-link {
    position: absolute;
    top: 0;
    right: 0;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    transition: all var(--transicion);
}

.admin-link:hover {
    background: rgba(255, 255, 255, 0.26);
    border-color: rgba(255, 255, 255, 0.55);
    transform: translateY(-1px);
}

.admin-link svg {
    width: 18px;
    height: 18px;
}

/* ====== CARD ====== */
.card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: var(--radio-xl);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.12),
        0 2px 8px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    width: 96%;
    max-width: 620px;
    padding: 2rem 2.25rem 1.75rem;
    text-align: center;
    position: relative;
    animation: slideUp 0.5s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.card-icon {
    width: 56px;
    height: 56px;
    background: transparent;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.5rem;
    box-shadow: none;
}

.card-icon svg {
    width: 100%;
    height: 100%;
    color: var(--rojo);
    /* Optional: drop-shadow for depth if needed, but going for clean look first */
    filter: drop-shadow(0 4px 6px rgba(231, 55, 71, 0.2));
}

.card-title {
    color: var(--gris-oscuro);
    font-size: 1.5em;
    font-weight: 700;
    margin-bottom: 0.25em;
    letter-spacing: -0.3px;
}

.card-subtitle {
    color: #6b7280;
    font-size: 1em;
    font-weight: 400;
    margin-bottom: 1em;
    line-height: 1.4;
}

/* ====== FORM ====== */
.form-group {
    margin-bottom: 0.75rem;
    text-align: left;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    transition: color var(--transicion);
    pointer-events: none;
}

.input-icon svg {
    width: 18px;
    height: 18px;
}

.form-control {
    width: 100%;
    padding: 0.75em 2.5em 0.75em 2.5em;
    border: 2px solid var(--gris-medio);
    border-radius: var(--radio-md);
    font-family: inherit;
    font-size: 1em;
    font-weight: 500;
    color: var(--gris-oscuro);
    background: var(--gris-claro);
    transition: all var(--transicion);
}

.form-control::placeholder {
    color: #b0b7c3;
    font-weight: 400;
    letter-spacing: 0;
}

.form-control:hover {
    border-color: #c5cad3;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--rojo);
    background: white;
    box-shadow: 0 0 0 4px rgba(231, 55, 71, 0.1);
}

.form-control:focus+.input-icon,
.form-control:not(:placeholder-shown)+.input-icon {
    color: var(--rojo);
}

/* Clear button */
.btn-clear {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: none;
    background: #e5e7eb;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all var(--transicion);
    color: #6b7280;
}

.btn-clear:hover {
    background: #d1d5db;
    color: #374151;
}

.btn-clear svg {
    width: 14px;
    height: 14px;
}

.btn-clear.visible {
    display: flex;
}

/* Input order fix: icon after input for CSS sibling selector */
.input-wrapper {
    display: flex;
    flex-direction: row;
    align-items: stretch;
}

.input-wrapper .form-control {
    order: 1;
}

.input-wrapper .input-icon {
    order: 0;
}

/* ====== BUTTON ====== */
.btn-primary {
    background: linear-gradient(135deg, var(--amarillo) 0%, var(--amarillo-claro) 100%);
    color: var(--gris-oscuro);
    border: none;
    padding: 0.75em 1.5em;
    border-radius: var(--radio-md);
    font-family: inherit;
    font-size: 1em;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    transition: all var(--transicion);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    box-shadow: 0 2px 8px rgba(255, 207, 0, 0.35);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--amarillo-claro) 0%, var(--amarillo) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(255, 207, 0, 0.5);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(255, 207, 0, 0.35);
}

.btn-primary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.btn-primary svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Spinner */
.spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(53, 53, 53, 0.2);
    border-top-color: var(--gris-oscuro);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ====== RESULT SECTION ====== */
#resultado {
    display: none;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gris-medio);
    text-align: left;
}

.resultado-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
    justify-content: center;
}

.resultado-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.resultado-icon svg {
    width: 18px;
    height: 18px;
}

.resultado.valido .resultado-icon,
.resultado.vigente .resultado-icon {
    background: var(--verde-claro);
    color: var(--verde);
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.2);
}

.resultado.suspendido .resultado-icon {
    background: #fef3c7;
    color: #d97706;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.2);
}

.resultado.revocado .resultado-icon {
    background: #f3f4f6;
    color: #6b7280;
    box-shadow: 0 2px 8px rgba(107, 114, 128, 0.15);
}

.resultado.invalido .resultado-icon {
    background: var(--rojo-fondo);
    color: var(--rojo-oscuro);
    box-shadow: 0 2px 8px rgba(231, 55, 71, 0.15);
}

.resultado-title {
    font-weight: 700;
    font-size: 1.125em;
    letter-spacing: -0.2px;
}

.resultado.valido .resultado-title,
.resultado.vigente .resultado-title {
    color: #15803d;
}

.resultado.suspendido .resultado-title {
    color: #b45309;
}

.resultado.revocado .resultado-title {
    color: #4b5563;
}

.resultado.invalido .resultado-title {
    color: var(--rojo-oscuro);
}

.resultado-data {
    display: flex;
    flex-direction: column;
    gap: 0.25em;
}

/* Data rows */
.dato {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.5em 0.75em;
    border-bottom: 1px solid #f0f0f0;
    border-radius: 4px;
    margin: 0 -0.75em;
}

.dato:nth-child(even) {
    background: #f3f4f6;
}

.dato:last-child {
    border-bottom: none;
}

.dato-label {
    font-size: 0.875em;
    color: #6b7280;
    font-weight: 500;
}

.dato-valor {
    font-size: 1em;
    font-weight: 600;
    color: var(--gris-oscuro);
}

/* Badges */
.badge {
    padding: 0.2em 0.6em;
    border-radius: 1em;
    font-size: 0.875em;
    font-weight: 600;
}

.badge-vigente {
    background: var(--verde-claro);
    color: #15803d;
}

.badge-vencido {
    background: #fef2f2;
    color: #991b1b;
}

.badge-revocado {
    background: #f3f4f6;
    color: #4b5563;
}

.badge-suspendido {
    background: #fef3c7;
    color: #92400e;
}

/* Error/not found message */
.resultado-message {
    text-align: center;
    color: #4b5563;
    font-size: 0.9em;
    line-height: 1.6;
    margin-top: 0.5em;
}

.resultado-message a {
    color: var(--rojo-oscuro);
    font-weight: 500;
    text-decoration: none;
    transition: color var(--transicion);
}

.resultado-message a:hover {
    color: var(--azul-marino);
    text-decoration: underline;
}

/* Watermark */
.watermark-notice {
    margin-top: 0.75em;
    font-size: 0.75em;
    color: #9ca3af;
    border-top: 1px solid var(--gris-medio);
    padding-top: 0.5em;
    text-align: center;
}

.watermark-notice strong {
    color: #6b7280;
}

/* ====== FOOTER ====== */
.footer {
    margin-top: 1rem;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.8rem;
    text-align: center;
    line-height: 1.5;
}

.footer a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transicion);
}

.footer a:hover {
    color: white;
    text-decoration: underline;
}

.footer-admin {
    margin-top: 0.75rem;
    font-size: 0.78rem;
    opacity: 0.5;
    transition: opacity var(--transicion);
}

.footer-admin:hover {
    opacity: 0.8;
}

/* ====== ANIMATIONS ====== */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.resultado-animate {
    animation: fadeSlideIn 0.4s ease-out;
}

/* Staggered animation for data rows */
.dato {
    opacity: 0;
    animation: fadeSlideIn 0.3s ease-out forwards;
}

.dato:nth-child(1) {
    animation-delay: 0.05s;
}

.dato:nth-child(2) {
    animation-delay: 0.1s;
}

.dato:nth-child(3) {
    animation-delay: 0.15s;
}

.dato:nth-child(4) {
    animation-delay: 0.2s;
}

.dato:nth-child(5) {
    animation-delay: 0.25s;
}

.dato:nth-child(6) {
    animation-delay: 0.3s;
}

/* ====== RESPONSIVE ====== */
@media (max-width: 600px) {
    body {
        padding: 1rem 0.5rem 0.5rem;
        justify-content: center;
        gap: 0.5rem;
        min-height: 100vh;
        min-height: 100dvh;
    }

    .brand-header {
        margin-bottom: 0;
    }

    .brand-header h1 {
        font-size: 0.9rem;
    }

    .brand-logo {
        max-width: 130px;
        margin-bottom: 0.25rem;
    }

    .card {
        padding: 1.25rem;
        width: calc(100% - 0.5rem);
        border-radius: var(--radio-lg);
    }

    .card-icon {
        width: 40px;
        height: 40px;
        margin-bottom: 0.25rem;
    }

    .card-title {
        font-size: 1.35em;
    }

    .card-subtitle {
        font-size: 1em;
        margin-bottom: 0.75em;
    }

    .form-group {
        margin-bottom: 0.5rem;
    }

    .form-control {
        padding: 0.75em 2.5em;
        font-size: 1em;
    }

    .btn-primary {
        padding: 0.75em 1.25em;
        font-size: 1em;
    }

    #resultado {
        margin-top: 0.5rem;
        padding-top: 0.5rem;
    }

    .resultado-header {
        margin-bottom: 0.4rem;
    }

    .resultado-icon {
        width: 28px;
        height: 28px;
    }

    .resultado-icon svg {
        width: 14px;
        height: 14px;
    }

    .resultado-title {
        font-size: 1em;
    }

    .dato {
        padding: 0.35em 0.5em;
    }

    .dato-label {
        font-size: 0.8em;
    }

    .dato-valor {
        font-size: 0.9em;
    }

    /* FOOTER: secundario, puede ser pequeño */
    .footer {
        margin-top: 0;
        font-size: 0.65rem;
    }
}

/* Pantallas muy pequeñas (iPhone SE, etc) */
@media (max-width: 380px) {
    body {
        padding: 1rem 0.5rem 0.75rem;
        gap: 0.75rem;
    }

    .brand-logo {
        max-width: 100px;
    }

    .card {
        padding: 1rem 0.875rem;
    }

    .card-title {
        font-size: 1.1em;
    }
}
