/* ═══════════════════════════════════════════════
   AMD 3D — Catálogo Module CSS
   ═══════════════════════════════════════════════ */

.amd3d-catalogo {
    display: flex;
    flex-direction: column;
    gap: 20px;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

/* ── MINIMALIST CATALOG HEADER BAR ── */
.amd3d-cat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    padding: 4px 0 16px;
    border-bottom: 1px solid #E4E4E7;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
}

.amd3d-cat-header::before {
    display: none;
}

.amd3d-cat-header__left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.amd3d-cat-header__title {
    font-size: clamp(22px, 2.6vw, 26px);
    font-weight: 800;
    color: #09090B;
    margin: 0;
    line-height: 1.15;
    letter-spacing: -0.03em;
}

.amd3d-cat-header__count {
    font-size: 11px;
    color: #52525B;
    background: #F4F4F5;
    border: 1px solid #E4E4E7;
    padding: 4px 9px;
    border-radius: 6px;
    font-weight: 700;
}

.amd3d-cat-header__right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Search */
.amd3d-cat-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1.5px solid #E2E8F0;
    border-radius: 10px;
    padding: 7px 13px;
    min-width: 210px;
    transition: border-color .2s;
}
.amd3d-cat-search-wrap:focus-within {
    border-color: #5a53a0;
    box-shadow: 0 0 0 3px rgba(90,83,160,.1);
}
.amd3d-cat-search-wrap svg {
    color: #94a3b8;
    flex-shrink: 0;
}
.amd3d-cat-search {
    border: none;
    outline: none;
    background: transparent;
    font-size: 13.5px;
    color: #0f172a;
    width: 100%;
    font-family: inherit;
}
.amd3d-cat-search::placeholder { color: #94a3b8; }

/* Sort */
.amd3d-cat-sort {
    border: 1.5px solid #E2E8F0;
    border-radius: 10px;
    padding: 7px 32px 7px 12px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    color: #374151;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 10px center;
    appearance: none;
    cursor: pointer;
    outline: none;
    transition: border-color .2s;
}
.amd3d-cat-sort:focus { border-color: #5a53a0; }

/* View Toggle */
.amd3d-cat-view-toggle {
    display: flex;
    gap: 2px;
    background: #F1F5F9;
    border-radius: 9px;
    padding: 3px;
}
.amd3d-cat-view-btn {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
}
.amd3d-cat-view-btn.active {
    background: #fff;
    color: #5a53a0;
    box-shadow: 0 1px 4px rgba(0,0,0,.1);
}

/* ── CATEGORY PILL TABS ── */
.amd3d-cat-tabs-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
}
.amd3d-cat-tabs-wrap::-webkit-scrollbar { display: none; }

.amd3d-cat-tabs {
    display: flex;
    gap: 8px;
    align-items: center;
    white-space: nowrap;
    padding: 2px 0;
}

.amd3d-cat-tab {
    border: 1.5px solid #E2E8F0;
    border-radius: 100px;
    padding: 7px 18px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    color: #64748b;
    background: #fff;
    cursor: pointer;
    transition: border-color .18s, color .18s, background .18s, box-shadow .18s;
    white-space: nowrap;
    line-height: 1;
}
.amd3d-cat-tab:hover {
    border-color: #5a53a0;
    color: #5a53a0;
    background: rgba(90,83,160,.04);
}
.amd3d-cat-tab.active {
    background: #5a53a0;
    border-color: #5a53a0;
    color: #fff;
    box-shadow: 0 2px 8px rgba(90,83,160,.25);
}

/* ── PRODUCTS GRID (8 columns on desktop) ── */
.amd3d-catalogo__grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 12px;
}

/* ── PRODUCT CARD ── */
.amd3d-catalogo__card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #EAECEF;
    box-shadow: 0 2px 6px rgba(0,0,0,.04);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
    cursor: pointer;
}
.amd3d-catalogo__card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 18px rgba(90,83,160,.12);
    border-color: #dcd9f2;
}

/* Image */
.amd3d-catalogo__img-wrap {
    position: relative;
    aspect-ratio: 4 / 5;
    background: linear-gradient(135deg, #F8FAFD 0%, #EDF2F7 100%);
    overflow: hidden;
    text-decoration: none;
    display: block;
}
.amd3d-catalogo__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .35s ease;
}
.amd3d-catalogo__card:hover .amd3d-catalogo__img {
    transform: scale(1.05);
}
.amd3d-catalogo__img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    opacity: .25;
}

/* Category + New badges */
.amd3d-catalogo__badge-cat {
    position: absolute;
    top: 6px;
    left: 6px;
    padding: 2px 7px;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(4px);
    border-radius: 100px;
    font-size: 9.5px;
    font-weight: 700;
    color: #374151;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    letter-spacing: .2px;
    max-width: calc(100% - 24px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.amd3d-catalogo__badge-new {
    position: absolute;
    top: 6px;
    right: 6px;
    background: #5a53a0;
    color: #fff;
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 8px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.amd3d-catalogo__badge-rank {
    position: absolute;
    bottom: 6px;
    left: 6px;
    background: rgba(9, 9, 11, 0.88);
    backdrop-filter: blur(6px);
    color: #FFFFFF;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 9.5px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16);
}

.amd3d-catalogo__badge-rank--1 {
    background: #09090B;
    color: #FFFFFF;
}

.amd3d-catalogo__badge-rank--2,
.amd3d-catalogo__badge-rank--views {
    background: #5F55AA;
    color: #FFFFFF;
}

.amd3d-catalogo__badge-rank--3 {
    background: rgba(24, 24, 27, 0.78);
    color: #FFFFFF;
}

.amd3d-catalogo__stats-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.amd3d-catalogo__stat {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10.5px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #71717A;
}

.amd3d-catalogo__stat svg {
    flex-shrink: 0;
    opacity: 0.8;
}

/* Card body */
.amd3d-catalogo__content {
    padding: 8px 10px 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.amd3d-catalogo__title {
    font-size: 12px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 3px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.25;
}
.amd3d-catalogo__desc {
    font-size: 10.5px;
    color: #64748b;
    margin: 0 0 6px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}
.amd3d-catalogo__materials {
    margin-bottom: 6px;
}
.amd3d-catalogo__mat-badge {
    display: inline-block;
    border: 1px solid #E2E8F0;
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 9.5px;
    font-weight: 600;
    color: #64748b;
}
.amd3d-catalogo__price-wrap {
    margin-top: auto;
    margin-bottom: 6px;
}
.amd3d-catalogo__price-label {
    font-size: 9px;
    color: #94a3b8;
    font-weight: 500;
    display: block;
    margin-bottom: 1px;
}
.amd3d-catalogo__price {
    font-size: 14px;
    font-weight: 800;
    color: #5a53a0;
    line-height: 1.1;
}
.amd3d-catalogo__actions {
    display: flex;
    gap: 4px;
}
.amd3d-cat-btn {
    flex: 1;
    padding: 5px 4px;
    border-radius: 6px;
    font-size: 10.5px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    border: none;
    text-align: center;
    text-decoration: none;
    transition: background .15s, color .15s, transform .12s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.amd3d-cat-btn--ghost {
    background: #F1F5F9;
    color: #374151;
}
.amd3d-cat-btn--ghost:hover {
    background: #E2E8F0;
    transform: translateY(-1px);
}
.amd3d-cat-btn--primary {
    background: #5a53a0;
    color: #fff;
}
.amd3d-cat-btn--primary:hover {
    background: #4a4490;
    transform: translateY(-1px);
}
.amd3d-cat-btn--danger {
    background: #fef2f2;
    color: #ef4444;
    border: 1px solid #fecaca;
    flex: 0 0 28px;
    padding: 5px 0;
}
.amd3d-cat-btn--danger:hover {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
    transform: translateY(-1px);
}
.amd3d-cat-btn--edit {
    background: #EEF2FF;
    color: #4F46E5;
    border: 1px solid #C7D2FE;
    flex: 0 0 28px;
    padding: 5px 0;
}
.amd3d-cat-btn--edit:hover {
    background: #4F46E5;
    color: #fff;
    border-color: #4F46E5;
    transform: translateY(-1px);
}
.amd3d-catalogo__card-admin-actions {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 10;
    display: flex;
    gap: 5px;
    align-items: center;
}
.amd3d-catalogo__btn-edit-card {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(90, 83, 160, 0.92);
    color: #fff !important;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,.2);
    transition: transform .15s ease, background .15s ease;
    padding: 0;
    text-decoration: none !important;
}
.amd3d-catalogo__btn-edit-card:hover {
    background: #4a4490;
    transform: scale(1.1);
}
.amd3d-catalogo__btn-delete-card {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.9);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,.2);
    transition: transform .15s ease, background .15s ease;
    padding: 0;
}
.amd3d-catalogo__btn-delete-card:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* ── LIST VIEW ── */
.amd3d-catalogo[data-view="list"] .amd3d-catalogo__grid {
    grid-template-columns: 1fr;
    gap: 12px;
}
.amd3d-catalogo[data-view="list"] .amd3d-catalogo__card {
    flex-direction: row;
    align-items: stretch;
}
.amd3d-catalogo[data-view="list"] .amd3d-catalogo__img-wrap {
    width: 180px;
    aspect-ratio: unset;
    flex-shrink: 0;
    border-radius: 0;
}
.amd3d-catalogo[data-view="list"] .amd3d-catalogo__content {
    flex-direction: row;
    align-items: center;
    gap: 16px;
    padding: 16px;
}
.amd3d-catalogo[data-view="list"] .amd3d-catalogo__title { font-size: 15px; -webkit-line-clamp: 1; }
.amd3d-catalogo[data-view="list"] .amd3d-catalogo__desc  { display: none; }
.amd3d-catalogo[data-view="list"] .amd3d-catalogo__price-wrap { margin: 0; min-width: 110px; }
.amd3d-catalogo[data-view="list"] .amd3d-catalogo__actions { margin-left: auto; flex-shrink: 0; min-width: 200px; }

/* ── SKELETONS ── */
.amd3d-catalogo__skeleton-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #F1F5F9;
}
.amd3d-catalogo__skeleton-img {
    aspect-ratio: 4/5;
    background: linear-gradient(90deg, #F1F5F9 25%, #E2E8F0 50%, #F1F5F9 75%);
    background-size: 200% 100%;
    animation: amd3d-shimmer 1.5s infinite;
}
.amd3d-catalogo__skeleton-text {
    height: 12px;
    background: linear-gradient(90deg, #F1F5F9 25%, #E2E8F0 50%, #F1F5F9 75%);
    background-size: 200% 100%;
    animation: amd3d-shimmer 1.5s infinite;
    border-radius: 4px;
    margin: 8px 10px 4px;
}
.amd3d-catalogo__skeleton-text.short { width: 55%; margin-top: 0; }

@keyframes amd3d-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── EMPTY STATE ── */
.amd3d-catalogo__empty {
    padding: 60px 20px;
    text-align: center;
}
.amd3d-empty__icon { font-size: 48px; margin-bottom: 12px; }
.amd3d-empty__text { font-size: 15px; color: #94a3b8; font-weight: 500; }

/* ── LOAD MORE ── */
.amd3d-catalogo__load-more-wrap { text-align: center; margin-top: 8px; }
.amd3d-cat-load-more {
    background: transparent;
    border: 2px solid #5a53a0;
    color: #5a53a0;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    border-radius: 12px;
    padding: 12px 32px;
    cursor: pointer;
    transition: background .18s, color .18s;
}
.amd3d-cat-load-more:hover {
    background: #5a53a0;
    color: #fff;
}

/* ── RESPONSIVE ── */
@media (min-width: 1200px) {
    .amd3d-catalogo__grid {
        grid-template-columns: repeat(8, 1fr);
        gap: 12px;
    }
}

@media (max-width: 1199px) and (min-width: 992px) {
    .amd3d-catalogo__grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 10px;
    }
}

@media (max-width: 991px) and (min-width: 768px) {
    .amd3d-catalogo__grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }
    .amd3d-cat-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 767px) and (min-width: 480px) {
    .amd3d-catalogo {
        padding: 14px 12px 32px;
        box-sizing: border-box;
    }
    .amd3d-catalogo__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }
    .amd3d-cat-header {
        flex-direction: column;
        align-items: stretch;
    }
    .amd3d-cat-header__right {
        width: 100%;
    }
    .amd3d-cat-search-wrap {
        min-width: 0;
        width: 100%;
        flex: 1 1 100%;
    }
    .amd3d-cat-sort {
        flex: 1;
    }
}

@media (max-width: 479px) {
    .amd3d-catalogo {
        padding: 12px 10px 32px;
        box-sizing: border-box;
    }
    .amd3d-catalogo__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }
    .amd3d-cat-header {
        flex-direction: column;
        align-items: stretch;
    }
    .amd3d-cat-header__right {
        width: 100%;
    }
    .amd3d-cat-search-wrap {
        min-width: 0;
        width: 100%;
        flex: 1 1 100%;
    }
    .amd3d-cat-sort {
        flex: 1;
    }
    .amd3d-catalogo[data-view="list"] .amd3d-catalogo__card { flex-direction: column; }
    .amd3d-catalogo[data-view="list"] .amd3d-catalogo__img-wrap { width: 100%; aspect-ratio: 4/5; }
    .amd3d-catalogo[data-view="list"] .amd3d-catalogo__content { flex-direction: column; }
    .amd3d-catalogo[data-view="list"] .amd3d-catalogo__actions { margin-left: 0; min-width: 0; width: 100%; }
}
