/* ==========================================================================
   ESTILOS PROFESIONALES PARA LISTA DE OBRAS
   Diseño Minimalista, Elegante y Compacto
   ========================================================================== */

:root {
    --pro-primary: #1a1d29;
    --pro-secondary: #2d3142;
    --pro-accent: #0066cc;
    --pro-text: #1a1d29;
    --pro-text-secondary: #4a5568;
    --pro-text-muted: #718096;
    --pro-border: #e2e8f0;
    --pro-border-light: #f1f5f9;
    --pro-surface: #f8fafc;
    --pro-white: #ffffff;
    --pro-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --pro-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
}

/* ============================================
   HEADER COMPACTO
   ============================================ */
.page-header {
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--pro-border);
    margin-bottom: 1.25rem;
}

.page-header h1 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--pro-text);
    margin: 0 0 0.375rem 0;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-header h1 svg.lucide {
    width: 1rem;
    height: 1rem;
    color: var(--pro-accent);
}

.catalog-meta {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    font-size: 0.75rem;
    color: var(--pro-text-secondary);
}

.catalog-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.catalog-meta svg.lucide {
    width: 0.75rem;
    height: 0.75rem;
    color: var(--pro-accent);
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    background: var(--pro-surface);
    color: var(--pro-accent);
    border: 1px solid var(--pro-border);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

/* ============================================
   BARRA DE BÚSQUEDA Y FILTROS - COMPACTA
   ============================================ */
.catalog-search-card {
    border: 1px solid var(--pro-border);
    background: var(--pro-white);
    padding: 0.875rem;
    box-shadow: var(--pro-shadow);
    margin-bottom: 1rem;
}

.catalog-search-card .form-label {
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--pro-text-muted);
    margin-bottom: 0.375rem;
}

.input-group-text {
    background: var(--pro-surface);
    border: 1px solid var(--pro-border);
    border-right: none;
    color: var(--pro-text-muted);
    font-size: 0.75rem;
}

.form-control,
.form-select {
    font-size: 0.8125rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--pro-border);
    transition: border-color 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--pro-accent);
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.1);
}

.form-control::placeholder {
    color: var(--pro-text-muted);
}

.btn-primary.filter-btn {
    background: var(--pro-accent);
    border: 1px solid var(--pro-accent);
    color: white;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
}

.btn-primary.filter-btn:hover {
    background: #0052a3;
    border-color: #0052a3;
}

.btn-primary.filter-btn svg.lucide {
    width: 0.75rem;
    height: 0.75rem;
}

/* ============================================
   CARDS DE OBRAS - COMPACTAS CON ÍNCIPIT VISIBLE
   ============================================ */
.catalogo-listado {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;      /* balance entre compacto y legible */
}

.obra-catalog-card {
    display: flex;
    gap: 0;
    padding: 0;
    border: 1px solid var(--pro-border);
    background: var(--pro-white);
    box-shadow: var(--pro-shadow);
    align-items: stretch;
    overflow: hidden;
    transition: all 0.2s ease;
    /* Sin max-height para que el íncipit sea completamente visible */
}

.obra-catalog-card:hover {
    box-shadow: var(--pro-shadow-md);
    border-color: var(--pro-text-muted);
}

.obra-catalog-card,
.obra-cover .btn,
.page-link {
    cursor: pointer;
}

/* ============================================
   SECCIÓN DE PORTADA
   ============================================ */
.obra-cover {
    width: 140px;
    flex-shrink: 0;
    background: var(--pro-surface);
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    border-right: 1px solid var(--pro-border);
}

.cover-frame {
    border: 1px dashed var(--pro-border);
    background: var(--pro-white);
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
}

.cover-placeholder {
    text-align: center;
    color: var(--pro-text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cover-placeholder svg.lucide {
    width: 1.5rem;
    height: 1.5rem;
    opacity: 0.4;
}

.obra-cover .btn {
    background: var(--pro-white);
    border: 1px solid var(--pro-border);
    color: var(--pro-text);
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.5rem 0.75rem;
    transition: all 0.2s ease;
}

.obra-cover .btn:hover {
    background: var(--pro-accent);
    border-color: var(--pro-accent);
    color: white;
}

/* ============================================
   DETALLES DE LA OBRA
   ============================================ */
.obra-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
}

/* Header de la obra */
.obra-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    padding: 0.1rem 1.25rem;
    border-bottom: 1px solid var(--pro-border-light);
    margin-bottom: 0;  /* eliminado para pegar con el info-stack */
    background: var(--pro-surface);
    padding: 10px;
}

.obra-main-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--pro-text);
    margin: 0;
    line-height: 1.4;
    letter-spacing: -0.01em;
}

/* Tags superiores */
.obra-top-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 10px;
}

.obra-tag {
    background: var(--pro-white);
    border: 1px solid var(--pro-border);
    padding: 0.5rem 0.75rem;
    min-width: 130px;
}

.tag-label {
    display: block;
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--pro-text-muted);
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.tag-value {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--pro-text);
}

.tag-value.meta-empty {
    color: var(--pro-text-muted);
    font-style: italic;
    font-weight: 400;
}

/* Stack de información - CON NUEVO FORMATO COMPACTO */
.obra-info-stack {
    display: flex;
    flex-direction: column;
    gap: 0;  /* eliminado para pegar completamente los recuadros */
}

/* Eliminamos los estilos antiguos que ya no se usan */
.obra-info-row {
    display: none;  /* oculto porque ya no se usa */
}

.obra-info-card {
    background: var(--pro-white);
    border: 1px solid var(--pro-border);
    border-radius: 6px;
    overflow: hidden;
    flex: 1;
}

.obra-info-card.mini {
    min-width: 0;
}

.obra-info-card .obra-card-label {
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--pro-text-primary);
    margin: 0;
    padding: 0.1rem 0.75rem;
    border-bottom: 1px solid var(--pro-border-light);
}

.obra-info-card .obra-card-body {
    padding: 0.1rem 0.75rem;  /* reducido de 0.75rem 1rem */
}

/* Cards de información - SIN LÍNEAS DIVISORIAS */
.obra-info-card {
    background: var(--pro-white);
    padding: 0.875rem 1rem;
    height: 100%;
}

.obra-info-card.mini {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Card de íncipit */
.obra-incipit-card {
    border: none;
    grid-column: 1 / -1;
    border-radius: 6px;
    padding: 0.5rem;
}

/* Labels de las cards */
.obra-card-label {
    font-size: 0.6875rem;
    letter-spacing: 0.05em;
    color: var(--pro-text-muted);
    margin: 0 0 0.5rem 0;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.obra-card-label::before {
    content: '';
    width: 2px;
    height: 12px;
    background: var(--pro-accent);
    margin-bottom: 1.5px;
}

/* Contenido de las cards */
.obra-line,
.obra-subline {
    margin: 0 0 0.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    color: var(--pro-text);
    font-size: 0.8125rem;
    font-weight: 400;
    line-height: 1.5;
}

.obra-line:last-child,
.obra-subline:last-child {
    margin-bottom: 0;
}

.obra-subline {
    font-size: 0.75rem;
    color: var(--pro-text-secondary);
}

.obra-inline-label {
    font-weight: 500;
    color: var(--pro-text-secondary);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Líneas de código (íncipit) */
.obra-inline-line {
    margin: 0 0 0.375rem;
    font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
    font-size: 0.75rem;
    color: var(--pro-text);
    letter-spacing: 0.02em;
    line-height: 1.6;
}

.obra-inline-line:last-child {
    margin-bottom: 0;
}

.obra-inline-line.code {
    color: var(--pro-text-secondary);
    background: var(--pro-white);
    padding: 0.5rem 0.625rem;
    border: 1px solid var(--pro-border-light);
    border-left: 2px solid var(--pro-accent);
}

/* Estados vacíos */
.meta-empty {
    font-style: italic;
    color: var(--pro-text-muted);
    font-size: 0.75rem;
}

/* ============================================
   PAGINACIÓN
   ============================================ */
.pagination {
    margin-top: 2rem;
    gap: 0.5rem;
}

.page-link {
    color: var(--pro-text);
    border: 1px solid var(--pro-border);
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
    transition: all 0.2s ease;
    background: var(--pro-white);
}

.page-link:hover {
    background: var(--pro-surface);
    border-color: var(--pro-text-secondary);
    color: var(--pro-text);
}

.page-link svg.lucide {
    width: 0.75rem;
    height: 0.75rem;
}

.page-item.disabled .page-link {
    background: var(--pro-surface);
    border-color: var(--pro-border);
    color: var(--pro-text-muted);
}

/* ============================================
   ESTADO VACÍO
   ============================================ */
.catalog-empty {
    background: var(--pro-surface);
    border: 1px solid var(--pro-border);
    padding: 3rem 2rem;
    text-align: center;
}

.empty-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
    background: var(--pro-white);
    border: 1px solid var(--pro-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--pro-text-muted);
    font-size: 1.5rem;
}

.catalog-empty h4 {
    color: var(--pro-text);
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.catalog-empty p {
    color: var(--pro-text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.btn-outline-primary {
    color: var(--pro-accent);
    border: 1px solid var(--pro-accent);
    font-size: 0.8125rem;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
}

.btn-outline-primary:hover {
    background: var(--pro-accent);
    border-color: var(--pro-accent);
    color: white;
}

.btn-outline-primary svg.lucide {
    width: 0.75rem;
    height: 0.75rem;
}

/* ============================================
   SPACING UTILITIES
   ============================================ */
.container.py-4 {
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
}

.mb-3 {
    margin-bottom: 1rem !important;
}

.mb-4 {
    margin-bottom: 1.5rem !important;
}

.mt-2 {
    margin-top: 0.5rem !important;
}

.mt-3 {
    margin-top: 1rem !important;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 992px) {
    .obra-info-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .obra-incipit-card {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .page-header h1 {
        font-size: 1rem;
    }

    .catalog-search-card {
        padding: 1rem;
    }

    .obra-catalog-card {
        flex-direction: column;
    }

    .obra-cover {
        width: 100%;
        flex-direction: row;
        align-items: center;
        padding: 1rem;
        border-right: none;
        border-bottom: 1px solid var(--pro-border);
    }

    .cover-frame {
        width: 100px;
        height: 100px;
    }

    .obra-cover .btn {
        width: auto;
        padding: 0.5rem 1rem;
    }

    .obra-header {
        flex-direction: column;
        padding: 1rem;
    }

    .obra-top-tags {
        width: 100%;
        justify-content: flex-start;
    }

    .obra-tag {
        min-width: 0;
        flex: 1;
    }

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

    .obra-info-card {
        border-right: none;
        border-bottom: 1px solid var(--pro-border-light);
    }

    .obra-info-card:last-child {
        border-bottom: none;
    }

    .obra-incipit-card {
        padding: 1rem;
    }

    .catalog-empty {
        padding: 2rem 1.5rem;
    }
}

@media (max-width: 576px) {
    .container.py-4 {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }

    .catalog-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .obra-cover {
        flex-direction: column;
    }

    .cover-frame {
        width: 100%;
        height: 140px;
    }

    .obra-cover .btn {
        width: 100%;
    }

    .obra-top-tags {
        flex-direction: column;
        gap: 0.5rem;
    }

    .obra-tag {
        width: 100%;
    }

    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }

    .page-item {
        flex: 0 0 auto;
    }
}