:root {
    --primary-color: #0E4973;
    /* UNSJ Blue theme */
    --secondary-color: #268C63;
    /* Dynamic Green */
    --bg-gradient-start: #f4f7f6;
    --bg-gradient-end: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.4);
    --card-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --br-base: 16px;
    --br-sm: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
    position: relative;
}

/* Background animated decorative blobs */
body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    z-index: -1;
    filter: blur(80px);
    opacity: 0.5;
}

body::before {
    background: #a5ecce;
    width: 40vw;
    height: 40vw;
    top: -10vw;
    left: -10vw;
    animation: drift 20s infinite alternate;
}

body::after {
    background: #b1d4ef;
    width: 35vw;
    height: 35vw;
    bottom: -10vw;
    right: -10vw;
    animation: drift 25s infinite alternate-reverse;
}

@keyframes drift {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(50px, 30px) scale(1.1);
    }
}

.app-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 1.4rem 1rem;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 2rem;
}

/* Ajuste general del contenedor del header */
/* --- SECCIÓN DE LOGO LIMPIA --- */

.logo-container {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: center;
    gap: 1.2rem;
    animation: slideDown 0.6s ease-out;
}

.logo-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transform: translateY(6px);
}

.logo-link {
    text-decoration: none;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-dgcc {
    min-height: 152px;
    max-width: 240px;
    padding: 0.7rem 0.95rem;
    border-left: 1px solid rgba(100, 116, 139, 0.35);
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: left;
}

.logo-dgcc-acronym {
    font-size: 1.28rem;
    font-weight: 700;
    letter-spacing: -0.35px;
    color: #1e293b;
    margin: 0 0 0.2rem;
}

.logo-dgcc-name {
    font-size: 0.78rem;
    line-height: 1.25;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin: 0;
}

/* Contenedor invisible para el logo */
.logo-shield.no-circle {
    width: 152px;
    height: 152px;
    background: transparent;
    border: none;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Efecto Negro para la imagen */
.black-logo {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    opacity: 0.9;
    /* Opcional: para que no sea un negro tan pesado */
}

/* Textos en negro/gris oscuro para combinar */
.logo-text h1 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1e293b !important;
    letter-spacing: -0.5px;
    margin-top: 0.5rem;
}

.logo-text p {
    color: #64748b !important;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Actualización para el contenedor del escudo */
/* Contenedor circular */
.logo-shield {
    width: 120px;
    /* Un poco más grande para que luzca el sello */
    height: 120px;
    background: white;
    /* Fondo blanco para contraste */
    border-radius: 50%;
    box-shadow: var(--card-shadow);
    border: 2px solid #000;
    /* Borde negro para definir el círculo */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

/* Imagen con filtro para volverla negra */
.black-logo {
    max-width: 85%;
    max-height: 85%;
    object-fit: contain;
    /* Este filtro convierte cualquier color en negro puro */
}

/* Ajuste opcional: Si quieres que todo el texto sea negro para combinar */
.logo-text h1 {
    color: #000 !important;
}

/* Estilo para la imagen dentro del escudo */
.logo-shield img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    /* Mantiene la proporción del logo sin estirarlo */
}

.logo-text h1 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: -0.5px;
}

.logo-text p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Base Glass Card */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border-radius: var(--br-base);
    border: 1px solid var(--glass-border);
    box-shadow: var(--card-shadow);
    padding: 1.8rem;
    position: relative;
    overflow: hidden;
}


/* Form Styles */
.search-section {
    animation: slideUp 0.6s ease-out 0.2s both;
}

.search-card {
    background: #ffffff !important;
    /* Solid white background */
    backdrop-filter: none !important;
    /* No blur */
    border: 1px solid #e2e8f0;
}

.search-section h2 {
    font-size: 1.22rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    white-space: nowrap;
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: 1.3rem;
    font-size: 0.92rem;
}

.help-box {
    background: #f0f9ff;
    border-left: 4px solid var(--primary-color);
    padding: 1.1rem 1.4rem;
    border-radius: 0 var(--br-sm) var(--br-sm) 0;
    margin-bottom: 1.5rem;
    text-align: left;
    color: #334155;
    animation: fadeIn 0.4s ease-out;
}

.help-box {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    background: #f0f9ff;
    border-left: 4px solid var(--primary-color);
    padding: 1rem 1.25rem;
    border-radius: 0 var(--br-sm) var(--br-sm) 0;
    margin-bottom: 1.5rem;
    text-align: left;
    color: #334155;
    animation: fadeIn 0.4s ease-out;
}

.help-icon {
    color: var(--primary-color);
    flex-shrink: 0;
    margin-top: 0.15rem;
}

.help-text p {
    font-size: 0.88rem;
    line-height: 1.55;
    margin-bottom: 0.6rem;
}

.help-text p:last-child {
    margin-bottom: 0;
}


.search-form {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.cf-turnstile-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 0.25rem;
    padding: 0.75rem 1rem;
    border-radius: var(--br-sm);
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--border, #e2e8f0);
}

.turnstile-hint {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0 0 0.65rem;
    text-align: center;
}

.form-row {
    display: flex;
    gap: 1.5rem;
}

.flex-2 {
    flex: 2;
}

.flex-1 {
    flex: 1;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

input,
select {
    padding: 0.8rem 1rem;
    border-radius: var(--br-sm);
    border: 2.5px solid #cbd5e1;
    /* Slightly less thick but still defined */
    background: #ffffff;
    font-size: 1rem;
    color: var(--text-primary);
    transition: var(--transition);
    outline: none;
}

input:focus,
select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(14, 73, 115, 0.1);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.85rem;
    border-radius: var(--br-sm);
    font-size: 0.98rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.7rem;
}

.btn-primary:hover {
    background: #0a3556;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(14, 73, 115, 0.3);
}

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

/* Form Inline Styles */
.radio-group {
    display: flex;
    gap: 2rem;
    margin-bottom: 0;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
}

.radio-option input[type="radio"] {
    accent-color: var(--primary-color);
    width: 18px;
    height: 18px;
}

.inline-inputs-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: nowrap;
    background: #f8fafc;
    /* Solid light gray instead of transparent */
    padding: 0.95rem;
    border-radius: var(--br-sm);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.numero-main-row {
    display: flex;
    align-items: center;
    gap: 0.72rem;
}

.numero-anio-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
}

.inline-label {
    font-weight: 600;
    font-size: 0.96rem;
    color: var(--text-primary);
}

.input-mini {
    width: 62px;
    padding: 0.58rem;
}

.input-small {
    width: 94px;
    padding: 0.58rem;
}

.placeholder-center {
    text-align: center;
}

#unidad,
#nro,
#anio {
    text-align: right;
}

.uppercase {
    text-transform: uppercase;
}

.separator {
    font-weight: bold;
    color: var(--text-secondary);
}

/* Results Section */
.result-section {
    margin-top: 1.4rem;
}

.result-card {
    border-top: 2px solid var(--primary-color);
    animation: slideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 1.25rem;
    max-width: 660px;
    margin-left: auto;
    margin-right: auto;
    background: #ffffff !important;
    backdrop-filter: none !important;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.incorporado-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.2rem;
}

#resNro {
    margin: 0;
    line-height: 1.15;
    text-align: right;
    font-size: 0.92rem;
    font-weight: 700;
}

.status-badge {
    background: #e0f2fe;
    /* light blue */
    color: var(--primary-color);
    padding: 0.4rem 1rem;
    border-radius: 50px;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-left: -6px;
}

.document-title {
    font-size: 1.25rem;
    color: var(--text-primary);
    line-height: 1.5;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.result-detail-list {
    border: 1px solid #dbe1e8;
    border-radius: var(--br-sm);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.result-name {
    font-size: 1.05rem;
    color: #334155;
    margin: -0.45rem 0 0.7rem;
    font-weight: 700;
    line-height: 1.35;
    word-break: break-word;
}

.result-detail-row {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #dbe1e8;
    background: #f8fafc;
}

.result-incorporado-row {
    display: flex;
    gap: 0.9rem;
    align-items: stretch;
}

.incorporado-col {
    flex: 1;
}

.incorporado-col+.incorporado-col {
    border-left: 1px solid #dbe1e8;
    padding-left: 0.9rem;
}

.btn-link-incorporado {
    margin-top: 0.45rem;
    padding: 0.15rem 0;
    border: none;
    background: none;
    color: var(--primary-color);
    font-size: 0.83rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
}

.incorporado-chevron {
    font-size: 0.9rem;
    line-height: 1;
}

.incorporado-extra {
    margin-top: 0.45rem;
    padding-top: 0.45rem;
    border-top: 1px dashed #cbd5e1;
}

.incorporado-extra .result-label {
    margin-top: 0.35rem;
}

.incorporado-extra .result-label:first-child {
    margin-top: 0;
}

.incorporado-extra .result-value {
    text-transform: none;
}

.result-detail-row:last-child {
    border-bottom: none;
}

.result-label {
    font-size: 0.98rem;
    line-height: 1.2;
    color: #475569;
    margin-bottom: 0.15rem;
}

.result-value {
    font-size: 0.93rem;
    line-height: 1.25;
    font-weight: 600;
    color: #1e293b;
    text-transform: uppercase;
    word-break: break-word;
}

.result-subvalue {
    margin-top: 0.2rem;
    font-size: 0.84rem;
    line-height: 1.2;
    font-weight: 500;
    color: #94a3b8;
    text-transform: none;
    word-break: break-word;
}

#resOficinaDesde,
#resOficinaIncorporadoDesde,
#resIncorporadoAreaDesde {
    color: #1e293b;
    font-weight: 600;
}

.destruido-msg {
    color: #000;
    font-weight: 700;
    font-size: 0.88rem;
    text-transform: none;
    font-style: italic;
}

.destruido-msg,
.hist-note {
    color: #000;
    font-weight: 700;
    font-size: 0.88rem;
    text-transform: none;
    font-style: italic;
}

/* Timeline */
.timeline {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.timeline-step {
    display: flex;
    gap: 1.2rem;
    align-items: flex-start;
}

.step-icon {
    width: 44px;
    /* Un poquito más grande */
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    /* Aumentamos el tamaño del emoji */
    background: #f1f5f9;
    z-index: 2;
    transition: var(--transition);
}

/* Colores de fondo más suaves y profesionales */
.step-icon.origin {
    background: #e0f2fe;
    /* Azul suave */
}

.step-icon.destination {
    background: #dcfce7;
    /* Verde suave */
}

.timeline-divider {
    position: absolute;
    left: 19px;
    top: 40px;
    bottom: 40px;
    width: 2px;
    background: #e2e8f0;
    z-index: 1;
}

.step-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.step-info small {
    color: #334155;
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.step-info strong {
    color: var(--text-primary);
    font-size: 1.15rem;
    font-weight: 700;
}

.step-info .date,
#resDate {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--secondary-color) !important;
    margin-top: 2px;
}

/* Info/Warning Boxes */
.info-box {
    background: #fff9e6;
    border: 1px solid #ffecb3;
    color: #856404;
    padding: 1.25rem;
    border-radius: var(--br-sm);
    margin-bottom: 1.5rem;
    text-align: center;
    font-weight: 500;
    animation: fadeIn 0.4s ease-out;
}

.info-box a {
    color: #664d03;
    font-weight: 700;
    text-decoration: underline;
}

.info-box a:hover {
    text-decoration: none;
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 2px solid #e2e8f0;
    padding: 0.65rem 1.15rem;
    border-radius: var(--br-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.action-footer {
    display: flex;
    justify-content: flex-end;
}

.btn-secondary:hover {
    border-color: var(--text-secondary);
    background: #f8fafc;
}

/* Error Card */
.error-card {
    border-top: 4px solid #ef4444;
    text-align: center;
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hidden {
    display: none !important;
}

/* Loader */
.loader {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

/* Keyframes */
@keyframes slideDown {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }

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

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

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.98);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

@media (max-width: 600px) {
    .app-container {
        padding: 1rem 0.75rem;
    }

    .logo-container {
        flex-direction: row;
        align-items: stretch;
        gap: 0.55rem;
    }

    .logo-main {
        transform: translateY(2px);
    }

    .logo-shield.no-circle {
        width: 118px;
        height: 118px;
    }

    .logo-dgcc {
        max-width: 150px;
        min-height: 118px;
        border-left: 1px solid rgba(100, 116, 139, 0.35);
        border-top: none;
        padding: 0.45rem 0 0.45rem 0.55rem;
        text-align: left;
    }

    .logo-dgcc-acronym {
        font-size: 1.04rem;
    }

    .logo-dgcc-name {
        font-size: 0.66rem;
        letter-spacing: 1px;
    }

    .search-section h2 {
        font-size: 1.04rem;
    }

    .inline-inputs-row {
        gap: 0.45rem;
        overflow-x: visible;
        flex-wrap: wrap;
    }

    .numero-main-row {
        gap: 0.45rem;
    }

    .inline-label {
        font-size: 0.8rem;
        white-space: nowrap;
    }

    .input-mini {
        width: 50px;
    }

    .input-small {
        width: 74px;
    }

    .form-row {
        flex-direction: column;
        gap: 1.5rem;
    }

    .result-incorporado-row {
        flex-direction: column;
        gap: 0.55rem;
    }

    .incorporado-col+.incorporado-col {
        border-left: none;
        border-top: 1px solid #dbe1e8;
        padding-left: 0;
        padding-top: 0.55rem;
    }
}

@page {
    size: A4;
    margin: 10mm;
}

.print-fecha {
    display: none;
}

@media print {

    html,
    body {
        width: 210mm;
        height: 297mm;
        background: #fff !important;
        color: #000 !important;
        overflow: hidden !important;
        font-size: 9.5pt;
    }

    body::before,
    body::after,
    .header,
    .search-section,
    .error-section,
    .action-footer,
    #recuperacionMsg {
        display: none !important;
    }

    .no-print {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
    }

    .app-container {
        max-width: 100%;
        margin: 0;
        padding: 0;
    }

    .main-content {
        margin: 0;
        padding: 0;
    }

    .result-section {
        margin: 0;
    }

    #resultSection.hidden {
        display: block !important;
    }

    .glass-card,
    .result-card {
        background: #ffffff !important;
        box-shadow: 0 3mm 8mm rgba(15, 23, 42, 0.08) !important;
        border: 1px solid #dbe1e8 !important;
        border-top: 3px solid var(--primary-color) !important;
        border-radius: 10px !important;
        padding: 5mm !important;
        animation: none !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .result-header {
        margin-bottom: 3mm;
        gap: 1.5mm;
    }

    .status-badge {
        background: #e0f2fe !important;
        color: var(--primary-color) !important;
        border: 1px solid #bfdbfe;
        margin: 0;
        padding: 1.2mm 2.7mm;
        font-size: 8.5pt;
    }

    .result-name {
        margin: 0 0 2mm;
        font-size: 9.5pt;
        line-height: 1.2;
        max-height: 7mm;
        overflow: hidden;
    }

    .result-detail-list {
        margin-bottom: 2mm;
    }

    .result-detail-row {
        padding: 1.7mm 2.5mm;
        background: #fff;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .result-label {
        font-size: 8.5pt;
        margin-bottom: 0.6mm;
    }

    .result-value {
        font-size: 8.7pt;
        line-height: 1.15;
    }

    .result-subvalue {
        font-size: 8.3pt;
        line-height: 1.1;
    }

    .print-fecha {
        display: block !important;
        margin-top: 3mm;
        font-size: 8.5pt;
        font-weight: 600;
        color: #000 !important;
        text-align: right;
    }

    #resExtracto,
    #resOficina {
        max-height: 12mm;
        overflow: hidden;
    }
}