/**
 * Txiki - Catálogo Styles
 * Estilos específicos para la página del catálogo
 */

/* Navbar Catálogo */
.catalog-nav {
    position: sticky;
    top: 70px;
    z-index: 90;
    background: rgba(240, 231, 213, 0.95);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(33, 40, 66, 0.1);
    padding: var(--space-4) 0;
    margin-bottom: var(--space-8);
}

.catalog-nav ul {
    display: flex;
    justify-content: center;
    gap: var(--space-6);
    list-style: none;
    overflow-x: auto;
    padding-bottom: 4px;
}

.catalog-nav a {
    font-family: var(--font-serif);
    font-size: var(--fs-lg);
    color: var(--text-muted);
    text-decoration: none;
    white-space: nowrap;
    padding-bottom: 2px;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
}

.catalog-nav a:hover,
.catalog-nav a.active {
    color: var(--midnight-indigo);
    border-color: var(--midnight-indigo);
}

/* Layout Grids Propios */
.grid-3-cols {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-6);
}

@media(min-width: 768px) {
    .grid-3-cols {
        grid-template-columns: repeat(3, 1fr);
    }
}

.catalog-layout {
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
}

@media(min-width: 768px) {
    .catalog-layout {
        flex-direction: row;
    }
}

.sidebar {
    width: 100%;
}

@media(min-width: 768px) {
    .sidebar {
        width: 260px;
        flex-shrink: 0;
    }
}

/* Widgets Info Cards */
.info-widget {
    background: var(--vanilla-cream);
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(33, 40, 66, 0.05);
    transition: var(--transition-base);
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.info-widget:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: rgba(33, 40, 66, 0.1);
}

.info-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-bottom: var(--space-4);
    background: var(--soft-tan);
    border-radius: 50%;
    border: 1px solid rgba(33, 40, 66, 0.08);
}

.info-icon svg {
    width: 28px;
    height: 28px;
    stroke: var(--midnight-indigo);
    flex-shrink: 0;
}

/* Sidebar Box */
.filters-box {
    background: var(--vanilla-cream);
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(33, 40, 66, 0.05);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 150px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.filter-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-muted);
    font-family: var(--font-serif);
    border: 1px solid transparent;
}

.filter-option:hover {
    background: rgba(255, 255, 255, 0.6);
    color: var(--midnight-indigo);
    transform: translateX(4px);
}

.filter-option.active {
    background: var(--midnight-indigo);
    color: var(--vanilla-cream);
    box-shadow: var(--shadow-md);
}

/* Imágenes Cover - Heredar estilos de components.css (object-fit: contain) */

/* Tabs */
.tabs-nav {
    display: flex;
    justify-content: center;
    gap: var(--space-4);
    margin-top: var(--space-4);
}

.tab-btn {
    padding: var(--space-3) var(--space-6);
    border: 1px solid var(--midnight-indigo);
    background: transparent;
    color: var(--midnight-indigo);
    border-radius: var(--radius-md);
    font-family: var(--font-serif);
    cursor: pointer;
    transition: var(--transition-fast);
}

.tab-btn:hover,
.tab-btn.active {
    background: var(--midnight-indigo);
    color: var(--vanilla-cream);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Estilos de Texto utilitarios */
.text-midnight {
    color: var(--midnight-indigo);
}

.text-muted {
    color: var(--text-muted);
}

.text-sm {
    font-size: var(--fs-sm);
}

.font-serif {
    font-family: var(--font-serif);
}

.mb-3 {
    margin-bottom: var(--space-3);
}

.mb-16 {
    margin-bottom: var(--space-16);
}

/* Enlaces */
.link-action {
    color: var(--yale-blue);
    font-weight: 500;
    margin-top: auto;
    padding-top: var(--space-4);
    font-size: var(--fs-sm);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.link-action:hover {
    text-decoration: underline;
}

/* View Sections */
.view-section {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ========================================
   PLACEHOLDER para libros sin imagen
   ======================================== */
.book-cover-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, var(--soft-tan) 0%, #e8dcc8 100%);
    color: var(--text-muted);
    padding: var(--space-6);
    text-align: center;
    gap: var(--space-3);
}

.book-cover-placeholder svg {
    width: 48px;
    height: 48px;
    opacity: 0.4;
    stroke: var(--midnight-indigo);
}

.book-cover-placeholder span {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: var(--fs-sm);
    color: var(--text-muted);
    opacity: 0.6;
    line-height: 1.4;
}

/* ========================================
   PRECIO en tarjetas
   ======================================== */
.book-price {
    font-family: var(--font-serif);
    font-size: var(--fs-lg);
    font-weight: 700;
    color: var(--midnight-indigo);
}

/* ========================================
   FILTRO COUNTER BADGE
   ======================================== */
.filter-count {
    font-size: var(--fs-xs);
    background: rgba(33, 40, 66, 0.1);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    color: var(--text-muted);
    font-weight: 500;
}

.filter-option.active .filter-count {
    background: rgba(255, 255, 255, 0.2);
    color: var(--vanilla-cream);
}

/* ========================================
   UPPERCASE UTILITY
   ======================================== */
.uppercase {
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ========================================
   OUTLINE BUTTON VARIANT
   ======================================== */
.btn-outline {
    background: transparent;
    color: var(--midnight-indigo);
    border: 1px solid var(--midnight-indigo);
    padding: var(--space-2) var(--space-5);
    border-radius: var(--radius-full);
    font-family: var(--font-serif);
    font-size: var(--fs-sm);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-outline:hover {
    background: var(--midnight-indigo);
    color: var(--vanilla-cream);
}

/* ========================================
   PADDING TOP UTILITY (para header offset)
   ======================================== */
.pt-32 {
    padding-top: 8rem;
}

.pb-0 {
    padding-bottom: 0;
}

.mb-10 {
    margin-bottom: 2.5rem;
}

.mb-32 {
    margin-bottom: 8rem;
}

.mt-6 {
    margin-top: 1.5rem;
}

.py-10 {
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
}

.p-4 {
    padding: 1rem;
}

.items-end {
    align-items: flex-end;
}

/* Mejora visual del search input en sidebar */
#search-input {
    font-family: var(--font-serif);
    font-size: var(--fs-sm);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

#search-input:focus {
    border-color: var(--midnight-indigo);
    outline: none;
    box-shadow: 0 0 0 3px rgba(33, 40, 66, 0.1);
}

/* Webkit overrides para formularios */
#sort-select,
.filters-box select,
.filters-box input[type="text"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.filters-box input[type="checkbox"] {
    -webkit-appearance: checkbox;
    accent-color: var(--midnight-indigo);
}

/* ========================================
   MODAL DE PRODUCTO
   ======================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(33, 40, 66, 0.4);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: var(--space-4);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: var(--vanilla-cream);
    width: 100%;
    max-width: 1000px;
    max-height: 90vh;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .modal-container {
    transform: translateY(0) scale(1);
}

.modal-close {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    background: white;
    border: 1px solid rgba(33,40,66,0.1);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    color: var(--midnight-indigo);
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.modal-close:hover {
    background: var(--midnight-indigo);
    color: white;
    transform: rotate(90deg);
}

.modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 400px;
    gap: var(--space-4);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(33, 40, 66, 0.1);
    border-left-color: var(--yale-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

.modal-content {
    overflow-y: auto;
    padding: var(--space-8);
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-8);
}

@media(min-width: 768px) {
    .modal-grid {
        grid-template-columns: 350px 1fr;
    }
}

.modal-image-col {
    position: sticky;
    top: 0;
}

.modal-info-col {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.modal-badges {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.badge-outline {
    background: transparent;
    border: 1px solid var(--midnight-indigo);
    color: var(--midnight-indigo);
    padding: 4px 10px;
    font-size: var(--fs-xs);
    border-radius: var(--radius-full);
}

.modal-title {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    font-style: italic;
    color: var(--midnight-indigo);
    line-height: 1.1;
    margin-bottom: var(--space-1);
}

.modal-author {
    font-size: var(--fs-lg);
    color: var(--text-muted);
}

.modal-price-row {
    display: flex;
    align-items: baseline;
    gap: var(--space-4);
    margin-top: var(--space-2);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid rgba(33,40,66,0.1);
}

.modal-price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--midnight-indigo);
    font-family: var(--font-serif);
}

.modal-stock {
    font-size: var(--fs-sm);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-weight: 500;
}

.modal-stock.in-stock {
    background: #e6f4ea;
    color: #137333;
}

.modal-stock.out-stock {
    background: #fce8e6;
    color: #c5221f;
}

.modal-section-title {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    color: var(--midnight-indigo);
    margin: var(--space-6) 0 var(--space-3);
    border-bottom: 2px solid var(--soft-tan);
    padding-bottom: var(--space-2);
    display: inline-block;
}

.sinopsis-text {
    line-height: 1.7;
    color: var(--text-muted);
}

.specs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-3) var(--space-6);
    background: white;
    padding: var(--space-5);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(33,40,66,0.05);
}

.spec-item {
    display: flex;
    flex-direction: column;
}

.spec-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    margin-bottom: 2px;
}

.spec-value {
    color: var(--midnight-indigo);
    font-weight: 500;
    font-size: 0.95rem;
}

.editions-list {
    display: grid;
    gap: var(--space-3);
}

.edition-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4);
    background: white;
    border: 1px solid rgba(33,40,66,0.1);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.edition-card:hover {
    border-color: var(--midnight-indigo);
    background: rgba(255,255,255,0.6);
    transform: translateX(4px);
}

.edition-info {
    display: flex;
    flex-direction: column;
}

.edition-title {
    font-weight: 500;
    color: var(--midnight-indigo);
}

.edition-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.edition-price {
    font-family: var(--font-serif);
    font-weight: bold;
    color: var(--yale-blue);
}

/* ========================================
   RESPONSIVO Y PAGINACIÓN
   ======================================== */
.filter-toggle-btn {
    display: none;
    font-family: var(--font-serif);
}

@media(max-width: 767px) {
    .filter-toggle-btn {
        display: block;
    }
    .sidebar .filters-box {
        display: none;
    }
    .sidebar.show .filters-box {
        display: block;
    }
}

.pagination-container .btn {
    padding: var(--space-2) var(--space-4);
}

.btn.disabled, .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ========================================
   NETFLIX-STYLE RELATED PRODUCTS
   ======================================== */
.modal-related-sections {
    margin-top: var(--space-6);
    padding: var(--space-6) var(--space-8);
    background: rgba(255, 255, 255, 0.4);
    border-top: 1px solid rgba(33, 40, 66, 0.08);
}

.related-row {
    margin-bottom: var(--space-8);
}

.related-row:last-child {
    margin-bottom: 0;
}

.related-row-title {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    font-style: italic;
    color: var(--midnight-indigo);
    margin-bottom: var(--space-4);
    font-weight: 600;
}

.related-scroll-wrapper {
    position: relative;
    margin: 0 -1rem;
}

.related-scroll {
    display: flex;
    gap: var(--space-5);
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: var(--space-2) 1rem var(--space-4);
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.related-scroll::-webkit-scrollbar {
    display: none;
}

.related-card {
    flex: 0 0 140px;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1);
}

.related-card:hover {
    transform: translateY(-8px);
}

.related-card-cover {
    width: 140px;
    height: 190px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--soft-tan);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border: 1px solid rgba(0,0,0,0.05);
}

.related-card:hover .related-card-cover {
    box-shadow: 0 12px 24px rgba(0,0,0,0.15);
    border-color: var(--midnight-indigo);
}

.related-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.related-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, var(--soft-tan) 0%, #e8dcc8 100%);
}

.related-placeholder svg {
    opacity: 0.3;
    stroke: var(--midnight-indigo);
}

.related-card-title {
    font-family: var(--font-serif);
    font-size: 0.85rem;
    color: var(--midnight-indigo);
    margin-top: var(--space-3);
    line-height: 1.3;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-align: center;
}

@media(max-width: 767px) {
    .modal-related-sections {
        padding: var(--space-6) var(--space-4);
    }
    .related-card {
        flex: 0 0 110px;
    }
    .related-card-cover {
        width: 110px;
        height: 150px;
    }
    .related-card-title {
        font-size: 0.75rem;
    }
}

