/* ── Convocatorias de Compras – Frontend (colores INCAF) ──────────────────── */
:root {
    --cc-primary:     #0E3178;   /* Azul INCAF */
    --cc-primary-lt:  #1a4aa8;   /* Azul INCAF aclarado hover */
    --cc-accent:      #F37021;   /* Anaranjado INCAF */
    --cc-accent-dk:   #d45e10;   /* Anaranjado oscuro hover */
    --cc-bg:          #303844;
    --cc-white:       #ffffff;
    --cc-border:      #4a5568;
    --cc-text:        #ffffff;
    --cc-text-muted:  #c8cdd6;
    --cc-radius:      6px;
    --cc-shadow:      0 2px 8px rgba(14,49,120,.10);
    --cc-transition:  .22s ease;
}

.cc-container {
    max-width: 820px;
    margin: 0 auto;
    font-family: inherit;
}

/* ── Sin datos ────────────────────────────────────────────────────────────── */
.cc-no-data {
    text-align: center;
    color: var(--cc-text-muted);
    padding: 2rem;
}

/* ── Años ─────────────────────────────────────────────────────────────────── */
.cc-years {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cc-year-block {
    border: 1px solid var(--cc-border);
    border-radius: var(--cc-radius);
    background: var(--cc-white);
    box-shadow: var(--cc-shadow);
    overflow: hidden;
}

.cc-year-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: #303844;
    color: var(--cc-white);
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: .04em;
    transition: background var(--cc-transition);
}

.cc-year-btn:hover,
.cc-year-btn[aria-expanded="true"] {
    background: #3d4a5c;
}

.cc-year-btn .cc-chevron {
    font-size: .75rem;
    transition: transform var(--cc-transition);
    display: inline-block;
}

.cc-year-btn[aria-expanded="true"] .cc-chevron {
    transform: rotate(180deg);
}

/* ── Meses ────────────────────────────────────────────────────────────────── */
.cc-months {
    padding: 12px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cc-months-loading {
    color: var(--cc-text-muted);
    font-style: italic;
    font-size: .9rem;
    padding: 6px 4px;
}

.cc-month-block {
    border: 1px solid var(--cc-border);
    border-radius: var(--cc-radius);
    overflow: hidden;
}

.cc-month-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--cc-bg);
    color: var(--cc-text);
    border: none;
    cursor: pointer;
    font-size: .95rem;
    font-weight: 600;
    transition: background var(--cc-transition), color var(--cc-transition);
}

.cc-month-btn:hover,
.cc-month-btn[aria-expanded="true"] {
    background: var(--cc-accent);
    color: var(--cc-white);
}

.cc-month-btn[aria-expanded="true"] .cc-chevron {
    transform: rotate(180deg);
}

/* ── Convocatorias ────────────────────────────────────────────────────────── */
.cc-convocatorias {
    padding: 10px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--cc-white);
}

.cc-convocatorias-loading {
    color: var(--cc-text-muted);
    font-style: italic;
    font-size: .88rem;
}

/* Tarjeta clickeable */
.cc-conv-item {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    border: 1px solid var(--cc-border);
    border-left: 4px solid var(--cc-primary);
    border-radius: var(--cc-radius);
    padding: 12px;
    background: var(--cc-bg);
    transition: box-shadow var(--cc-transition), border-color var(--cc-transition), transform var(--cc-transition);
    cursor: pointer;
}

.cc-conv-item:hover {
    box-shadow: 0 4px 16px rgba(14,49,120,.15);
    border-left-color: var(--cc-accent);
    transform: translateY(-1px);
}

.cc-conv-item:hover .cc-conv-etiqueta {
    color: var(--cc-accent);
}

.cc-conv-click-hint {
    font-size: .75rem;
    color: var(--cc-accent);
    margin: 4px 0 0;
    font-style: italic;
}

/* Imagen miniatura */
.cc-conv-img-wrap {
    flex-shrink: 0;
    width: 110px;
    height: 80px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--cc-border);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--cc-border);
}

.cc-conv-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.cc-conv-img.loaded { display: block; }

.cc-conv-no-img {
    font-size: 2rem;
    color: var(--cc-text-muted);
}

.cc-conv-body { flex: 1; min-width: 0; }

.cc-conv-etiqueta {
    margin: 0 0 5px;
    font-size: .93rem;
    font-weight: 700;
    color: var(--cc-primary);
    line-height: 1.4;
    word-break: break-word;
    transition: color var(--cc-transition);
}

.cc-conv-desc {
    margin: 0;
    font-size: .86rem;
    color: var(--cc-text-muted);
    line-height: 1.5;
    word-break: break-word;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL LIGHTBOX
   ═══════════════════════════════════════════════════════════════════════════ */
.cc-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(14, 49, 120, 0.82);   /* azul INCAF semitransparente */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity .25s ease;
    backdrop-filter: blur(3px);
}

.cc-modal-overlay.cc-modal-visible {
    opacity: 1;
}

.cc-modal {
    background: var(--cc-white);
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0,0,0,.4);
    max-width: 820px;
    width: 100%;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(.94);
    transition: transform .25s ease;
}

.cc-modal-overlay.cc-modal-visible .cc-modal {
    transform: scale(1);
}

/* Cabecera modal */
.cc-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px 14px;
    background: #303844;
    color: var(--cc-white);
    flex-shrink: 0;
}

.cc-modal-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.4;
}

.cc-modal-fecha {
    margin: 3px 0 0;
    font-size: .82rem;
    opacity: .85;
    font-weight: 400;
}

.cc-modal-close {
    flex-shrink: 0;
    background: rgba(255,255,255,.15);
    border: none;
    color: var(--cc-white);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--cc-transition);
    line-height: 1;
    margin-top: 2px;
}

.cc-modal-close:hover {
    background: var(--cc-accent);
}

/* Cuerpo modal */
.cc-modal-body {
    overflow-y: auto;
    flex: 1;
    padding: 0;
}

.cc-modal-img-wrap {
    width: 100%;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.cc-modal-img-wrap img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 70vh;
    object-fit: contain;
}

.cc-modal-no-img {
    padding: 40px;
    text-align: center;
    color: var(--cc-text-muted);
    font-size: 3rem;
}

/* Descripción en modal */
.cc-modal-desc-wrap {
    padding: 16px 20px 20px;
    border-top: 3px solid var(--cc-accent);
}

.cc-modal-desc-wrap p {
    margin: 0;
    color: var(--cc-text);
    font-size: .95rem;
    line-height: 1.6;
}

/* Footer modal */
.cc-modal-footer {
    padding: 12px 20px;
    background: var(--cc-bg);
    border-top: 1px solid var(--cc-border);
    display: flex;
    justify-content: flex-end;
    flex-shrink: 0;
}

.cc-modal-btn-cerrar {
    background: #303844;
    color: var(--cc-white);
    border: none;
    padding: 8px 22px;
    border-radius: 4px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--cc-transition);
}

.cc-modal-btn-cerrar:hover {
    background: var(--cc-accent);
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .cc-year-btn       { font-size: 1rem; padding: 12px 14px; }
    .cc-conv-img-wrap  { width: 80px; height: 60px; }
    .cc-conv-item      { flex-direction: column; }
    .cc-conv-img-wrap  { width: 100%; height: 140px; }
    .cc-modal          { max-height: 96vh; }
    .cc-modal-title    { font-size: .9rem; }
}

/* ── Ajustes fondo oscuro tarjetas ────────────────────────────────────────── */
.cc-conv-item {
    background: #303844 !important;
    border-color: #4a5568 !important;
}
.cc-conv-etiqueta { color: #ffffff !important; }
.cc-conv-desc     { color: #c8cdd6 !important; }
.cc-conv-item:hover { border-left-color: var(--cc-accent) !important; }
.cc-conv-img-wrap { background: #1e2530; border-color: #4a5568; }
.cc-convocatorias { background: #252d38 !important; }
.cc-months        { background: #252d38; }
.cc-month-btn     { background: #252d38 !important; color: #e0e4ec !important; border-bottom: 1px solid #3a4352; }
.cc-month-btn:hover,
.cc-month-btn[aria-expanded="true"] { background: var(--cc-accent) !important; color: #fff !important; }
.cc-year-block    { background: #252d38 !important; border-color: #3a4352 !important; }

/* ═══════════════════════════════════════════════════════════════════════════
   ZOOM DE IMAGEN (lightbox de segundo nivel)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Imagen dentro del modal → cursor zoom */
#cc-modal-img-wrap img {
    cursor: zoom-in;
    transition: opacity .15s ease;
}
#cc-modal-img-wrap img:hover { opacity: .92; }

/* Overlay de zoom fullscreen */
.cc-zoom-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0, 0, 0, .93);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    transition: opacity .2s ease;
    cursor: zoom-out;
}
.cc-zoom-overlay.cc-zoom-visible { opacity: 1; }

.cc-zoom-overlay img {
    max-width: 100%;
    max-height: 95vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 40px rgba(0,0,0,.6);
    /* Pan con transform-origin al hacer clic */
    transition: transform .15s ease;
    cursor: zoom-out;
}

/* Botón cerrar zoom */
.cc-zoom-close {
    position: fixed;
    top: 14px;
    right: 18px;
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
    z-index: 1000000;
    line-height: 1;
}
.cc-zoom-close:hover { background: var(--cc-accent); }

/* Hint texto en modal */
.cc-modal-img-hint {
    text-align: center;
    font-size: .78rem;
    color: #a0aab8;
    padding: 5px 0 2px;
    font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BUSCADOR
   ═══════════════════════════════════════════════════════════════════════════ */
.cc-search-wrap {
    margin-bottom: 18px;
    position: relative;
}

.cc-search-inner {
    display: flex;
    align-items: center;
    background: #1e2530;
    border: 2px solid #4a5568;
    border-radius: 8px;
    padding: 0 14px;
    transition: border-color .2s;
}

.cc-search-inner:focus-within {
    border-color: #4a5568;
    box-shadow: none;
}

.cc-search-icon { font-size: 1rem; color: #8a95a8; flex-shrink: 0; margin-right: 8px; }

.cc-search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #e0e4ec;
    font-size: .95rem;
    padding: 12px 0;
    width: 100%;
}

.cc-search-input::placeholder { color: #6b7585; }

.cc-search-clear {
    background: none;
    border: none;
    color: #8a95a8;
    cursor: pointer;
    font-size: 1rem;
    padding: 4px 6px;
    border-radius: 4px;
    transition: color .2s, background .2s;
    flex-shrink: 0;
}
.cc-search-clear:hover { color: #fff; background: rgba(255,255,255,.1); }

/* Resultados de búsqueda */
.cc-search-results {
    background: #1e2530;
    border: 1px solid #4a5568;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 400px;
    overflow-y: auto;
}

.cc-search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid #2a3344;
    cursor: pointer;
    transition: background .15s;
}
.cc-search-result-item:last-child { border-bottom: none; }
.cc-search-result-item:hover { background: #252d3a; }

.cc-search-result-img {
    width: 50px;
    height: 38px;
    object-fit: cover;
    border-radius: 3px;
    flex-shrink: 0;
    background: #2a3344;
}

.cc-search-result-body { flex: 1; min-width: 0; }

.cc-search-result-nombre {
    font-size: .85rem;
    font-weight: 600;
    color: #e0e4ec;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cc-search-result-fecha {
    font-size: .78rem;
    color: var(--cc-accent);
    margin-top: 2px;
}

.cc-search-highlight { color: var(--cc-accent); font-weight: 700; }

.cc-search-empty {
    padding: 16px 14px;
    color: #8a95a8;
    font-style: italic;
    font-size: .9rem;
    text-align: center;
}

.cc-search-count {
    padding: 6px 14px;
    font-size: .78rem;
    color: #8a95a8;
    border-bottom: 1px solid #2a3344;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BOTÓN DESCARGAR EN MODAL
   ═══════════════════════════════════════════════════════════════════════════ */
.cc-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.cc-modal-btn-download {
    background: var(--cc-accent);
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background .2s;
}
.cc-modal-btn-download:hover { background: #d45e10; color: #fff; text-decoration: none; }
.cc-modal-btn-download[hidden] { display: none; }
