/* ========== SHOP PAGE SPECIFIC STYLES ========== */
/* This file contains only shop-specific styles */
/* Navigation, book cards, and color palette come from style.css */

/* Shop Main Content Layout */
.shop-main-content {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: var(--spacing-sm) var(--spacing-md);
    min-height: calc(100vh - 200px);
}

/* Price slider layout (Shop sidebar) */
.price-sliders {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    /* allow label to flow under on narrow widths */
}

.price-sliders input[type="range"] {
    flex: 1 1 0;
    min-width: 160px;
    /* prevents label collision */
}

#maxPriceLabel {
    white-space: nowrap;
    /* keep the + together */
}

@media (max-width: 540px) {
    .price-sliders input[type="range"] {
        flex: 1 1 100%;
        min-width: 0;
    }

    #maxPriceLabel {
        margin-left: auto;
        /* keep it inside and right-aligned */
    }
}

/* Shop Page Header */
.shop-page-header {
    text-align: center;
    margin-bottom: var(--spacing-sm);
}

.shop-page-title {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shop-page-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Shop Controls Section */
.shop-controls {
    background: var(--background);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-3xl);
    border: 1px solid var(--border-color);
}

.search-section {
    margin-bottom: var(--spacing-lg);
}

.search-container {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
}

.search-input {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-lg);
    padding-right: 50px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 1rem;
    background: var(--background-light);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.1);
}

.search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.search-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-50%) scale(1.05);
}

/* Filters Section */
.filters-section {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-lg);
    align-items: end;
    justify-content: center;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    min-width: 150px;
}

.filter-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.filter-select {
    padding: var(--spacing-sm) var(--spacing-md);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--background-light);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.1);
}

/* Clear filters button uses standard styling from style.css */

/* Results Info Section */
.results-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-xl);
    padding: 0 var(--spacing-md);
}

#resultsCount {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.view-toggle {
    display: flex;
    gap: var(--spacing-xs);
    background: var(--background-light);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.view-btn {
    background: transparent;
    border: none;
    padding: var(--spacing-xs);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-btn.active,
.view-btn:hover {
    background: var(--primary-color);
    color: white;
}

/* Search and Sort Section */
.search-sort-section {
    display: flex;
    align-items: center;
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-lg);
    background: var(--background);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.search-container {
    flex: 1;
    position: relative;
    max-width: 500px;
}

.search-input {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-lg);
    padding-right: 50px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--background-light);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all var(--transition-fast);
    box-sizing: border-box;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.1);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary-color);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-50%) scale(1.05);
}

.sort-container {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex-shrink: 0;
}

.sort-label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
    white-space: nowrap;
}

.sort-select {
    padding: var(--spacing-sm) var(--spacing-md);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--background-light);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    min-width: 160px;
}

.sort-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.1);
}

/* Shop Content Area - 2 Column Layout */
.shop-content-area {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-3xl);
}

/* Left Sidebar Filters */
.filters-sidebar {
    background: var(--background);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    height: fit-content;
    position: sticky;
    top: var(--spacing-xl);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

.sidebar-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* Clear filters button styling inherited from style.css */

/* Filter Sections */
.filter-section {
    margin-bottom: var(--spacing-xl);
}

.filter-section-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: color var(--transition-fast);
}

.checkbox-item:hover {
    color: var(--primary-color);
}

.checkbox-item input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    position: relative;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.checkbox-item input[type="checkbox"]:checked+.checkmark {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-item input[type="checkbox"]:checked+.checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* Price Range */
.price-range-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.price-inputs {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    width: 100%;
}

.price-input {
    flex: 1;
    padding: var(--spacing-sm) var(--spacing-xs);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--background-light);
    color: var(--text-primary);
    font-size: 0.875rem;
    text-align: center;
    min-width: 0;
    width: 100%;
    height: 36px;
    box-sizing: border-box;
}

.price-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.1);
}

.price-input::placeholder {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.price-separator {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
    flex-shrink: 0;
    padding: 0 2px;
}

.price-presets {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.price-preset {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: var(--spacing-sm);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
}

.price-preset:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.price-preset.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Main Content Area */
.main-content {
    min-width: 0;
}

/* Books Container */
.books-container {
    margin-bottom: var(--spacing-3xl);
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: var(--spacing-xl);
}

/* Desktop view - responsive grid */
@media (min-width: 1400px) {
    .books-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 20px;
    }

    .books-grid .book-card {
        font-size: 0.9rem;
    }

    .books-grid .book-title {
        font-size: 0.95rem;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .books-grid .book-author {
        font-size: 0.8rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .books-grid .book-details {
        padding: var(--spacing-sm);
    }


    .books-grid .book-actions button {
        width: 32px;
        height: 32px;
    }

    .books-grid .book-actions svg {
        width: 14px;
        height: 14px;
    }
}

.books-grid.list-view {
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
}

.books-grid.list-view .book-card {
    display: flex;
    flex-direction: row;
    max-width: 100%;
    height: 200px;
}

.books-grid.list-view .book-image-container {
    width: 150px;
    flex-shrink: 0;
}

.books-grid.list-view .book-details {
    flex: 1;
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Load More Button */
.load-more-container {
    text-align: center;
    margin-top: var(--spacing-xl);
}

.load-more-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: var(--spacing-md) var(--spacing-xl);
    border-radius: var(--radius-lg);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 1rem;
}

.load-more-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* No Results State */
.no-results {
    text-align: center;
    padding: var(--spacing-4xl);
    color: var(--text-secondary);
}

.no-results-icon {
    font-size: 4rem;
    margin-bottom: var(--spacing-xl);
    opacity: 0.5;
}

.no-results-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

.no-results-description {
    font-size: 1rem;
    margin-bottom: var(--spacing-xl);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.browse-all-btn {
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    padding: var(--spacing-md) var(--spacing-xl);
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all var(--transition-fast);
    display: inline-block;
    border: none;
    cursor: pointer;
}

.browse-all-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Shop Toast Notifications */
.shop-toast {
    position: fixed;
    bottom: var(--spacing-xl);
    right: var(--spacing-xl);
    background: var(--success-color);
    color: white;
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    font-weight: 500;
    z-index: 10000;
    transform: translateY(100px);
    opacity: 0;
    transition: all var(--transition-normal);
}

.shop-toast.show {
    transform: translateY(0);
    opacity: 1;
}

.shop-toast.error {
    background: var(--error-color);
}

/* Mobile Responsive Styles */
@media (min-width: 1200px) and (max-width: 1399px) {
    .books-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 18px;
    }
}

@media (min-width: 992px) and (max-width: 1199px) {
    .books-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .shop-content-area {
        grid-template-columns: 250px 1fr;
        gap: var(--spacing-lg);
    }

    .books-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 14px;
    }

    .filters-sidebar {
        padding: var(--spacing-lg);
    }
}

@media (max-width: 767px) {
    .shop-page-title {
        font-size: 2rem;
    }

    .shop-main-content {
        padding: var(--spacing-xl) var(--spacing-md);
    }

    .search-sort-section {
        flex-direction: column;
        gap: var(--spacing-md);
        align-items: stretch;
        padding: var(--spacing-md);
    }

    .search-container {
        max-width: none;
    }

    .sort-container {
        justify-content: space-between;
    }

    .sort-select {
        min-width: auto;
        flex: 1;
    }

    .shop-content-area {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }

    .filters-sidebar {
        position: static;
        order: -1;
        margin-bottom: var(--spacing-lg);
    }

    .books-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .books-grid.list-view .book-card {
        flex-direction: column;
        height: auto;
    }

    .books-grid.list-view .book-image-container {
        width: 100%;
        aspect-ratio: 3/4;
    }
}

@media (max-width: 480px) {
    .books-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .search-container {
        max-width: 100%;
    }

    .filters-sidebar {
        padding: var(--spacing-md);
    }

    .checkbox-group {
        gap: var(--spacing-xs);
    }

    .price-inputs {
        gap: var(--spacing-sm);
    }

    .price-input {
        font-size: 0.875rem;
        height: 44px;
        padding: var(--spacing-sm);
        min-width: 80px;
    }

    .price-separator {
        font-size: 0.875rem;
        padding: 0 var(--spacing-xs);
    }

    .price-presets {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-xs);
    }
}

/* Animation for book cards */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.books-grid .book-card {
    animation: fadeInUp 0.6s ease forwards;
}

.books-grid .book-card:nth-child(even) {
    animation-delay: 0.1s;
}

.books-grid .book-card:nth-child(3n) {
    animation-delay: 0.2s;
}

/* Loading state */
.books-grid.loading {
    opacity: 0.6;
    pointer-events: none;
}

.books-grid.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Out of Stock Overlay */
.book-card {
    position: relative;
}

.out-of-stock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    border-radius: var(--radius-lg);
}

.out-of-stock-badge {
    background: var(--error-color, #dc3545);
    color: white;
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: var(--shadow-lg);
}

/* Responsive Filter Dropdown Styles */
.filters-dropdown {
    display: block;
}
.filter-toggle-btn {
    display: none;
    background: none;
    border: none;
    padding: 0.5rem;
    margin-left: 1rem;
    cursor: pointer;
    border-radius: 999px;
    transition: background 0.2s;
    color: var(--primary-color);
}
.filter-toggle-btn:focus, .filter-toggle-btn:hover {
    background: var(--background-light);
}
@media (max-width: 767px) {
    .filters-dropdown {
        display: none;
        position: fixed;
        z-index: 1011;
        top: 76px; /* Adjust as needed for your header height */
        left: 50%;
        transform: translateX(-50%);
        width: 90vw;
        max-width: 340px;
        max-height: 70vh;
        background: var(--background, #fff);
        border-radius: 12px;
        box-shadow: 0 6px 24px rgba(0,0,0,0.12);
        overflow-y: auto;
        padding-bottom: var(--spacing-xl);
        transition: all 0.3s cubic-bezier(.62,.01,.47,1.04);
    }
    .filters-dropdown.open {
        display: block;
    }
    .filter-toggle-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    /* Adjust content area so books stay visible */
    .shop-content-area {
        grid-template-columns: 1fr;
    }
    /* Make filter sidebar full-width in dropdown */
    .filters-sidebar {
        border-radius: inherit;
        background: transparent;
        box-shadow: none;
        border: none;
        padding: var(--spacing-lg) var(--spacing-md);
        margin: 0;
    }
    .filter-overlay {
        display: none;
        position: fixed;
        z-index: 1010;
        top: 0; left: 0; width: 100vw; height: 100vh;
        background: rgba(40,40,50,0.25);
    }
    .filters-dropdown.open + .filter-overlay {
        display: block;
    }
}