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

html, body {
    height: 100%;
    font-family: 'Poppins', Arial, Helvetica, sans-serif;
    background-color: #E5ECFF;
    color: #222;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- SIDEBAR LATERAL FIJO --- */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background: #fff;
    box-shadow: 2px 0 12px rgba(0,0,0,0.1);
    overflow-y: auto;
    padding: 6rem 1.5rem 1.5rem 1.5rem;
    z-index: 100;
}

.sidebar h2 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
    color: #333;
}

/* === FILTROS COLAPSABLES === */
.filter-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
}

.filter-group.collapsible label {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 24px;
    transition: color 0.2s;
}

.filter-group.collapsible label::after {
    content: '▼';
    position: absolute;
    right: 0;
    font-size: 0.75rem;
    transition: transform 0.25s ease;
}

.filter-group.collapsible.collapsed label::after {
    transform: rotate(-90deg);
}

.filter-group label {
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
    color: #444;
    font-weight: 500;
}

/* Contenido del filtro */
.filter-content {
    max-height: 200px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 1;
}

.filter-group.collapsible.collapsed .filter-content {
    max-height: 0;
    opacity: 0;
}

.filter-group input,
.filter-group select {
    padding: 0.6rem;
    border-radius: 6px;
    border: 1px solid #ccc;
    transition: border-color 0.2s;
    width: 100%;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #2F60F4;
}

.btn-filter {
    width: 100%;
    background: #2F60F4;
    border: none;
    padding: 0.8rem;
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    transition: background 0.2s;
    margin-top: 0.5rem;
}

.btn-filter:hover {
    background: #1746D2;
}

.date-range {
    display: flex;
    justify-content: space-between;
    flex-direction: column;
    gap: 0.5rem;
}

.date-range input {
    flex: 1;
    width: 100%;
}

/* Scrollbar personalizada para el sidebar */
.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* --- CONTENEDOR PRINCIPAL --- */
.content-wrapper {
    margin-left: 280px;
    min-height: 100vh;
}

#collection-detail {
    padding: 2rem;
}

/* Cabecera de la colección */
.collection-header {
    margin-bottom: 1rem;
}

#collection-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #1746D2;
}

#collection-description {
    font-size: 1rem;
    color: #555;
    margin-bottom: 0;
}

/* ====== Botones de acción ====== */
.card-actions {
    display: flex;
    gap: 0.8rem;
    justify-content: flex-end;
    align-items: center;
    padding: 0;
    margin-top: 0;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.inline-form {
    margin: 0;
}

.btn-action {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: background 0.2s ease, transform 0.1s ease, color 0.2s ease;
    text-align: center;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    line-height: 1;
    box-sizing: border-box;
    height: 40px;
    min-width: 110px;
}

.btn-action i {
    font-size: 0.95rem;
}

.btn-action:hover {
    transform: scale(1.05);
}

.btn-destacar {
    background: #f59e0b;
    color: #fff;
}

.btn-destacar:hover {
    background: #d97706;
    color: #fff;
}

.btn-destacar.quitar {
    background: #6b7280;
    color: #fff;
}

.btn-destacar.quitar:hover {
    background: #4b5563;
    color: #fff;
}

.btn-edit {
    background: #2F60F4;
    color: #fff;
}

.btn-edit:hover {
    background: #1746D2;
    color: #fff;
}

.btn-delete {
    background: #e03131;
    color: #fff;
}

.btn-delete:hover {
    background: #c92a2a;
    color: #fff;
}

/* --- CARDS: contenedor y separación --- */
.cards-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

/* --- CARD: diseño compacto horizontal --- */
a {
    all: unset;
    display: block;
    cursor: pointer;
}

.card {
    background: linear-gradient(135deg, #ffffff 0%, #fafbff 100%);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: grid;
    grid-template-columns: 2fr 1.2fr 160px;
    gap: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid rgba(47, 96, 244, 0.08);
    position: relative;
    min-height: 170px;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, #2F60F4 0%, #1746D2 100%);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.card:hover::before {
    opacity: 1;
}

/* Columna 1: Contenido (Título + Descripción) */
.card-content {
    display: flex;
    flex-direction: column;
    padding: 1.2rem 1.4rem;
    gap: 0.65rem;
    border-right: 1px solid rgba(0, 0, 0, 0.06);
}

.card-title {
    font-weight: 600;
    font-size: 1.05rem;
    color: #1a1a1a;
    line-height: 1.35;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.card-description {
    font-size: 0.875rem;
    color: #555;
    line-height: 1.5;
    flex-grow: 1;
}

.card-description p {
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Columna 2: Metadata */
.card-metadata {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0.9rem 1.1rem;
    gap: 0.5rem;
    background: rgba(47, 96, 244, 0.02);
    border-right: 1px solid rgba(0, 0, 0, 0.06);
}

.card-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.825rem;
    color: #555;
}

.card-meta-item i {
    font-size: 0.75rem;
    width: 14px;
    text-align: center;
    color: #2F60F4;
    flex-shrink: 0;
}

.card-meta-item span {
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Columna 3: Imagen */
.card-image {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    overflow: hidden;
}

.card-img {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e8eef7 0%, #d4dff0 100%);
    color: #2F60F4;
    font-size: 2rem;
    opacity: 0.6;
}

/* Hover effects */
.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(47, 96, 244, 0.12);
    border-color: rgba(47, 96, 244, 0.15);
}

.card:active {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(47, 96, 244, 0.1);
}

/* Paginación */
#pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding: 1.5rem 0;
}

.pagination-arrow {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #fff;
    color: #2F60F4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    text-decoration: none;
    border: 2px solid rgba(47, 96, 244, 0.12);
}

.pagination-arrow:hover:not(.disabled) {
    background: #2F60F4;
    color: #fff;
    transform: scale(1.08);
    box-shadow: 0 4px 10px rgba(47, 96, 244, 0.25);
    border-color: #2F60F4;
}

.pagination-arrow.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    background: #f5f5f5;
    color: #999;
    border-color: #e0e0e0;
}

.pagination-page-number {
    min-width: 90px;
    height: 40px;
    border-radius: 8px;
    background: #fff;
    color: #333;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    border: 2px solid rgba(47, 96, 244, 0.08);
}

.pagination-page-number span {
    font-size: 0.875rem;
    font-weight: 400;
    color: #666;
}

.pagination-page-number strong {
    font-size: 0.875rem;
    color: #2F60F4;
    font-weight: 600;
    margin-left: 0.25rem;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .card {
        grid-template-columns: 2fr 1fr 140px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 240px;
    }

    .content-wrapper {
        margin-left: 240px;
    }

    .card {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .card-content,
    .card-metadata {
        border-right: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    }

    .card-image {
        height: 180px;
    }
}

@media (max-width: 600px) {
    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
        padding: 1.5rem;
    }

    .content-wrapper {
        margin-left: 0;
    }

    #collection-detail {
        padding: 1rem;
    }
}