/* ============================================================
   Catálogo de Capacidades — Estilos (paleta ScienceuP)
   ============================================================ */

/* --- Variables (ScienceuP palette) ------------------------ */
:root {
    --color-primary:       #002f6c;
    --color-primary-dark:  #001e46;
    --color-primary-light: #e6edf7;
    --color-secondary:     #f27900;
    --color-secondary-dark:#c96400;
    --color-accent:        #7a9abf;
    --color-accent-light:  #d6e4f0;
    --color-dark:          #0a1628;
    --color-text:          #1a2a40;
    --color-muted:         #5a7a9a;
    --color-border:        #cdd9e8;
    --color-bg:            #f5f8fc;
    --color-white:         #FFFFFF;

    --font-heading: 'Poppins', sans-serif;
    --font-body:    'Inter', sans-serif;

    --radius-sm:  0.375rem;
    --radius-md:  0.5rem;
    --radius-lg:  0.75rem;
    --radius-xl:  1rem;
    --radius-2xl: 1.5rem;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    --header-h: 68px;
}

/* --- Reset ------------------------------------------------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: inherit; }
img { max-width: 100%; display: block; }

/* --- Header (estilo ScienceuP) ----------------------------- */
.cyta-header {
    background: var(--color-primary);
    color: var(--color-white);
    height: var(--header-h);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.cyta-header-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 2rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cyta-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--color-white);
    flex-shrink: 0;
}
.cyta-logo-icon { font-size: 1.5rem; }
.cyta-logo-text span { color: var(--color-secondary); }

.cyta-header-nav { display: flex; align-items: center; gap: 0.25rem; }
.cyta-header-nav a {
    padding: 0.45rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(255,255,255,0.8);
    transition: all 0.2s;
}
.cyta-header-nav a:hover,
.cyta-header-nav a.active {
    background: rgba(255,255,255,0.12);
    color: var(--color-white);
}
.cyta-header-nav a.active { font-weight: 600; }

/* Hamburger */
.cyta-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 0.5rem;
    border-radius: var(--radius-md);
}
.cyta-menu-toggle span {
    width: 24px; height: 2px;
    background: var(--color-white);
    border-radius: 2px;
    transition: all 0.3s;
    display: block;
}

/* --- Hero -------------------------------------------------- */
.cyta-page { flex: 1; }

.cyta-hero {
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 60%, #1a4a8a 100%);
    color: var(--color-white);
    padding: 2.5rem 2rem 2rem;
    text-align: center;
}

.cyta-hero-badge {
    display: inline-block;
    background: rgba(255,255,255,0.15);
    color: var(--color-white);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35rem 1rem;
    border-radius: 99px;
    margin-bottom: 1rem;
    letter-spacing: 0.04em;
}

.cyta-hero h1 {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--color-secondary);
}

.cyta-hero p {
    font-size: 1rem;
    color: rgba(255,255,255,0.75);
    max-width: 640px;
    margin: 0 auto;
    line-height: 1.7;
}

/* --- Split layout ------------------------------------------ */
.cyta-split {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem 2rem 3rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

/* --- Cards ------------------------------------------------- */
.cyta-card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.cyta-card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.cyta-card-header h3 {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-dark);
}

.cyta-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.65rem;
    border-radius: 99px;
    background: #fef3c7;
    color: #92400e;
}

/* --- PDF card (izquierda) — visor PDF.js canvas ----------- */
.cyta-pdf-viewer {
    height: 460px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#cytaPdfPages {
    flex: 1;
    overflow: auto;
    background: #525659;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px;
}
#cytaPdfPages canvas {
    max-width: 100%;
    display: block;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.cyta-pdf-download {
    padding: 0.75rem 1.5rem;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: center;
}

.cyta-pdf-download a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-lg);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-primary);
    background: var(--color-primary-light);
    transition: all 0.2s;
    text-decoration: none;
}
.cyta-pdf-download a:hover {
    background: var(--color-primary);
    color: var(--color-white);
}
.cyta-pdf-download a .arrow {
    font-size: 1.1rem;
}

/* PDF overlay flotante para coincidencias */
.cyta-pdf-overlay {
    position: absolute;
    top: 3.2rem;
    left: 0; right: 0;
    margin: 0 auto;
    width: 90%;
    max-width: 420px;
    background: var(--color-dark);
    color: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: 50;
    overflow: hidden;
}
.cyta-pdf-overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 600;
    background: var(--color-primary);
}
.cyta-pdf-overlay-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
}
.cyta-overlay-close {
    background: none;
    border: none;
    color: var(--color-white);
    font-size: 1.3rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 0.25rem;
}
.cyta-overlay-arrow {
    background: rgba(255,255,255,0.15);
    border: none;
    color: var(--color-white);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.15s;
}
.cyta-overlay-arrow:hover {
    background: rgba(255,255,255,0.3);
}

/* PDF card — relative para overlay */
.cyta-pdf-card {
    position: relative;
}

/* ── Result cards ─────────────────────────────────────── */
.cyta-results-wrapper {
    padding: 0 1.5rem 1.5rem;
}

.cyta-results-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.cyta-results {
    background: transparent;
    border: none;
    padding: 0;
    min-height: 0;
    max-height: none;
    overflow-y: visible;
    white-space: normal;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.cyta-result-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 0.85rem 1rem;
    transition: box-shadow 0.15s;
}

.cyta-result-card:hover {
    box-shadow: var(--shadow-md);
}

.cyta-result-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.cyta-result-name {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-dark);
}

.cyta-result-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: 99px;
    white-space: nowrap;
    flex-shrink: 0;
}
.cyta-result-badge.high { background: #d1fae5; color: #065f46; }
.cyta-result-badge.mid  { background: #fef3c7; color: #92400e; }
.cyta-result-badge.low  { background: #fee2e2; color: #991b1b; }

.cyta-result-uni,
.cyta-result-lineas,
.cyta-result-lab {
    font-size: 0.8rem;
    color: var(--color-muted);
    margin-bottom: 0.15rem;
}

.cyta-result-actions {
    display: flex;
    gap: 0.35rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--color-border);
}

.cyta-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: var(--color-white);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.15s;
}
.cyta-action-btn:hover {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
}

.cyta-icon-lab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-md);
    background: var(--color-primary-light);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
}
.cyta-icon-lab:hover {
    background: #d4e2f5;
    border-color: var(--color-primary);
}

.cyta-loading,
.cyta-empty,
.cyta-error {
    text-align: center;
    padding: 1rem;
    font-size: 0.85rem;
    color: var(--color-muted);
}
.cyta-error { color: #991b1b; }

/* ── Contact modal overlay ─────────────────────────────── */
.cyta-contact-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 22, 40, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.cyta-contact-modal {
    width: min(92vw, 480px);
    background: var(--color-white);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.cyta-contact-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
}
.cyta-contact-header h3 {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-dark);
}

.cyta-contact-body {
    padding: 1.25rem 1.5rem;
    font-size: 0.85rem;
    color: var(--color-text);
    line-height: 1.6;
}

.cyta-contact-body textarea {
    width: 100%;
    margin-top: 0.75rem;
    padding: 0.7rem 0.9rem;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-lg);
    font-family: var(--font-body);
    font-size: 0.85rem;
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg);
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}
.cyta-contact-body textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 47, 108, 0.12);
}

.cyta-contact-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.65rem;
    padding: 0.85rem 1.5rem;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
}

.cyta-btn-cancel {
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    background: var(--color-white);
    color: var(--color-muted);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}
.cyta-btn-cancel:hover {
    background: var(--color-border);
}

.cyta-btn-send {
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-lg);
    border: none;
    background: var(--color-primary);
    color: var(--color-white);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.cyta-btn-send:hover {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
}

/* --- Search panel (derecha) -------------------------------- */
.cyta-search-row {
    padding: 1.25rem 1.5rem;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.cyta-search-row textarea {
    flex: 1;
    padding: 0.7rem 0.9rem;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-lg);
    font-family: var(--font-body);
    font-size: 0.875rem;
    resize: vertical;
    min-height: 78px;
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.cyta-search-row textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 47, 108, 0.12);
}
.cyta-search-row textarea::placeholder { color: var(--color-muted); }

.cyta-btn-search {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1.5rem;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 0.9rem;
    background: var(--color-secondary);
    color: var(--color-white);
    transition: all 0.2s;
    white-space: nowrap;
    align-self: stretch;
    min-width: 100px;
}
.cyta-btn-search:hover {
    background: var(--color-secondary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
.cyta-btn-search:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* --- Results ----------------------------------------------- */
.cyta-results-wrapper { padding: 0 1.5rem 1.5rem; }

.cyta-results-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.cyta-results {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    min-height: 180px;
    max-height: 420px;
    overflow-y: auto;
    white-space: pre-wrap;
    font-size: 0.85rem;
    line-height: 1.65;
    color: var(--color-text);
    font-family: var(--font-body);
}

/* --- Responsive -------------------------------------------- */
@media (max-width: 900px) {
    .cyta-split {
        display: flex;
        flex-direction: column;
    }
    /* En pantallas medianas, PDF arriba, búsqueda abajo (orden natural) */
    .cyta-left  { order: 1; }
    .cyta-right { order: 2; }
    .cyta-hero h1 { font-size: 1.5rem; }
}

@media (max-width: 768px) {
    /* En móviles: búsqueda primero, PDF después */
    .cyta-left  { order: 2; }
    .cyta-right { order: 1; }

    .cyta-header-nav {
        display: none;
        flex-direction: column;
        position: absolute;
        top: var(--header-h);
        left: 0; right: 0;
        background: var(--color-primary);
        padding: 1rem 1.5rem;
        gap: 0.25rem;
        box-shadow: var(--shadow-lg);
        z-index: 99;
    }
    .cyta-header-nav a { width: 100%; padding: 0.6rem 0.75rem; }
    .cyta-header.menu-open .cyta-header-nav { display: flex; }
    .cyta-menu-toggle { display: flex; }

    .cyta-search-row { flex-direction: column; }
    .cyta-search-row textarea { width: 100%; flex: auto; min-height: 80px; }
    .cyta-btn-search { align-self: stretch; width: 100%; min-width: unset; }
    .cyta-hero { padding: 2rem 1.25rem 1.5rem; }
    .cyta-split { padding: 1rem 1rem 2rem; }
    /* Cards ocupan todo el ancho en móvil */
    .cyta-card { width: 100%; }
    .cyta-search-row { padding: 1rem 1rem; }
}
