/* Catalog Main Container */
.catalog-main {
    min-height: 80vh;
    padding: 40px 5%;
    background: linear-gradient(to bottom, #f8f9fa 0%, #ffffff 100%);
}

.catalog-header {
    text-align: center;
    margin-bottom: 50px;
}

.catalog-header h1 {
    font-size: 42px;
    background: var(--background-gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.catalog-header p {
    color: #666;
    font-size: 18px;
}

/* Search Bar Styles */
.search-bar-container {
    margin-top: 25px;
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 800px; /* makes it longer */
    margin-left: auto;
    margin-right: auto;
    padding: 0 15px;
    box-sizing: border-box;
}

.search-input-wrapper {
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 15px 50px 15px 25px; /* Added right padding to prevent text overlapping icon */
    border: 2px solid #e0e0e0;
    border-radius: 50px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
}

.search-input:focus {
    border-color: var(--primary-teal);
    box-shadow: 0 4px 15px rgba(0, 139, 148, 0.15);
}

.search-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: #999;
    pointer-events: none; /* Allows clicking through to the input */
}

/* Category Scroll Styles */
.category-wrapper {
    position: relative;
    max-width: 1200px;
    margin: -20px auto 40px;
    padding: 0 40px;
    display: flex;
    align-items: center;
}

.category-scroll {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 10px 5px;
    scrollbar-width: none;
    /* Hide scrollbar Firefox */
    -ms-overflow-style: none;
    /* Hide scrollbar IE/Edge */
}

.category-scroll::-webkit-scrollbar {
    display: none;
    /* Hide scrollbar Chrome/Safari */
}

.category-card {
    flex: 0 0 140px;
    background: white;
    border-radius: 15px;
    padding: 15px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid #f0f0f0;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 139, 148, 0.1);
    border-color: var(--primary-teal);
}

.category-card img,
.category-card .placeholder-image {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 50%;
    background: #f8f9fa;
    padding: 5px;
}

.category-card .placeholder-image {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--background-gradient);
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.category-card span {
    font-size: 13px;
    font-weight: 600;
    color: var(--deep-blue);
    text-align: center;
}

.category-card.active {
    background: var(--primary-teal);
    border-color: var(--primary-teal);
    box-shadow: 0 8px 15px rgba(0, 139, 148, 0.2);
}

.category-card.active span {
    color: white;
}

.category-card.active img,
.category-card.active .placeholder-image {
    background: rgba(255, 255, 255, 0.2);
}

.scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: white;
    border: 1px solid #eee;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    color: var(--primary-teal);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.scroll-btn:hover {
    background: var(--primary-teal);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 139, 148, 0.3);
}

.scroll-btn.left {
    left: 0;
}

.scroll-btn.right {
    right: 0;
}

@media (max-width: 768px) {
    .catalog-main {
        padding: 20px 3%;
    }

    .catalog-header {
        margin-bottom: 30px;
    }

    .catalog-header h1 {
        font-size: 28px;
    }

    .category-wrapper {
        margin: -10px auto 30px;
        padding: 0;
        /* Remove padding for edge-to-edge look on mobile */
    }

    .category-scroll {
        padding: 10px 15px;
        /* Add internal padding for better alignment */
        gap: 12px;
    }

    .category-card {
        flex: 0 0 100px;
        /* Slimmer cards on mobile */
        padding: 12px 8px;
        border-radius: 12px;
    }

    .category-card img,
    .category-card .placeholder-image {
        width: 45px;
        height: 45px;
    }

    .category-card span {
        font-size: 11px;
    }

    .scroll-btn {
        display: none;
        /* Hide arrows on mobile as touch swiping is intuitive */
    }
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-teal);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #999;
}

.empty-state p {
    font-size: 18px;
    margin: 10px 0;
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

/* Product Card */
.product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 139, 148, 0.15);
}

.product-id-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 74, 124, 0.8);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    z-index: 5;
    pointer-events: none;
}

.product-image {
    width: 100%;
    height: 280px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 5px;
}

.product-image::after {
    content: '🔍 Click for details';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px;
    text-align: center;
    font-size: 13px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.product-card:hover .product-image::after {
    opacity: 1;
}

.product-info {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--deep-blue);
    margin-bottom: 8px;
    line-height: 1.3;
}

.product-rating {
    color: #ffa726;
    font-size: 14px;
    margin-bottom: 12px;
}

.rating-value {
    color: #666;
    margin-left: 5px;
}

.product-price {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-teal);
    margin-bottom: 15px;
}

.product-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
}

.btn-primary,
.btn-secondary {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--background-gradient);
    color: white;
}

.btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 139, 148, 0.3);
}

.btn-secondary {
    background: white;
    color: var(--primary-teal);
    border: 2px solid var(--primary-teal);
}

.btn-secondary:hover {
    background: var(--primary-teal);
    color: white;
}

.btn-block {
    width: 100%;
}

/* Cart Button in Header */
.cart-button {
    position: relative;
    background: var(--background-gradient);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 50px;
    font-size: 20px;
    cursor: pointer;
    transition: transform 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
}

.cart-button:hover {
    transform: scale(1.1);
}

/* Admin Button in Header */
.admin-button {
    color: white;
    font-size: 20px;

}

.admin-button:hover {
    transform: scale(1.1);
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff5252;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

/* Cart Sidebar */
.cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 2000;
}

.cart-overlay.active {
    display: block;
}

.cart-panel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: 400px;
    max-width: 90%;
    background: white;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 2001;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
}

.cart-panel.active {
    transform: translateX(0);
}

.cart-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.cart-content h3 {
    margin: 10px 0 20px;
    color: var(--deep-blue);
    font-size: 24px;
}

.cart-items-list {
    flex-grow: 1;
    overflow-y: auto;
    margin-bottom: 20px;
}

.cart-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    border-bottom: 1px solid #eee;
    align-items: center;
}

.cart-item-image {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #e0f7fa 0%, #b2ebf2 100%);
    border-radius: 8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-details {
    flex-grow: 1;
}

.cart-item-name {
    font-weight: 600;
    color: var(--deep-blue);
    margin-bottom: 5px;
    font-size: 14px;
}

.cart-item-price {
    color: var(--primary-teal);
    font-weight: 600;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.qty-btn:hover {
    background: var(--primary-teal);
    color: white;
    border-color: var(--primary-teal);
}

.qty-display {
    min-width: 30px;
    text-align: center;
    font-weight: 600;
}

.remove-btn {
    background: none;
    border: none;
    color: #ff5252;
    cursor: pointer;
    font-size: 20px;
    padding: 5px;
    margin-left: auto;
}

.remove-btn:hover {
    color: #d32f2f;
}

.cart-footer {
    border-top: 2px solid #eee;
    padding-top: 20px;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 20px;
    color: var(--deep-blue);
}

.cart-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

/* Modal Styles */
.modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal[hidden] {
    display: none;
}


.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 3001;
    animation: modalSlideIn 0.3s ease;
}

.modal-small {
    max-width: 500px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.modal-close:hover {
    background: #f5f5f5;
}

.modal-body {
    padding: 30px;
}

.modal-body h2 {
    color: var(--deep-blue);
    margin-bottom: 20px;
}

.modal-body .form-group {
    margin-bottom: 20px;
}

.modal-body label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--deep-blue);
}

.modal-body input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.modal-body textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
}

.modal-body input:focus {
    outline: none;
    border-color: var(--primary-teal);
}

.modal-body textarea:focus {
    outline: none;
    border-color: var(--primary-teal);
}

/* Product Modal Specific */
#product-modal .modal-body {
    display: flex;
    gap: 30px;
}

#product-modal .modal-image {
    flex: 1;
    min-width: 300px;
}

#product-modal .modal-image img {
    width: 100%;
    height: 400px;
    object-fit: contain;
    border-radius: 12px;
    background: #f8f9fa;
}

#product-modal .modal-details {
    flex: 1;
}

#product-modal .modal-details h2 {
    font-size: 28px;
    margin-bottom: 15px;
}

#product-modal .modal-rating {
    color: #ffa726;
    font-size: 18px;
    margin-bottom: 15px;
}

#product-modal .modal-price {
    font-size: 32px;
    font-weight: bold;
    color: var(--primary-teal);
    margin-bottom: 20px;
}

#product-modal .modal-description {
    color: #666;
    line-height: 1.6;
    margin-bottom: 30px;
}

#product-modal .modal-actions {
    display: flex;
    gap: 15px;
}

#product-modal .modal-actions .btn-primary,
#product-modal .modal-actions .btn-secondary {
    flex: 1;
    padding: 15px 20px;
    font-size: 16px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .catalog-header h1 {
        font-size: 32px;
    }

    .cart-panel {
        width: 100%;
    }

    #product-modal .modal-body {
        flex-direction: column;
        padding: 20px;
    }

    #product-modal .modal-image {
        min-width: 100%;
        height: 300px;
    }

    #product-modal .modal-image img {
        height: 100%;
        object-fit: contain;
    }

    .modal-content {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .modal-close {
        top: 10px;
        right: 10px;
        background: rgba(255, 255, 255, 0.9);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
}


@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: 1fr;
    }

    .product-info {
        padding: 15px;
    }

    .product-name {
        font-size: 16px;
    }

    .product-price {
        font-size: 20px;
    }

    .product-actions {
        flex-direction: column;
        gap: 8px;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        padding: 10px;
    }

}

/* ==========================================
   WISHLIST STYLES
   ========================================== */

/* Wishlist Heart Button on Product Card */
.product-card {
    position: relative;
}

.wishlist-heart-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 15;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
    transition: all 0.3s ease;
}

.wishlist-heart-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 16px rgba(255, 82, 82, 0.3);
    color: #ff5252;
}

.wishlist-heart-btn.active {
    color: #ff5252;
    background: rgba(255, 255, 255, 0.95);
    animation: heartPulse 0.4s ease;
}

@keyframes heartPulse {
    0% {
        transform: scale(1);
    }

    30% {
        transform: scale(1.3);
    }

    60% {
        transform: scale(0.95);
    }

    100% {
        transform: scale(1);
    }
}

/* Wishlist Header Button */
.wishlist-button {
    position: relative;
    background: var(--background-gradient);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 50px;
    font-size: 20px;
    cursor: pointer;
    transition: transform 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 6px;
}

.wishlist-button:hover {
    transform: scale(1.1);
}

/* Wishlist panel specific — reuses cart-panel styles */
.wishlist-panel .cart-content h3 {
    color: #e53935;
}

/* "Add to Cart" button inside wishlist items */
.wishlist-to-cart-btn {
    margin-top: 6px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    border: 1.5px solid var(--primary-teal);
    background: white;
    color: var(--primary-teal);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wishlist-to-cart-btn:hover {
    background: var(--primary-teal);
    color: white;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .wishlist-heart-btn {
        width: 32px;
        height: 32px;
        font-size: 16px;
        top: 8px;
        right: 8px;
    }

    .wishlist-button {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .wishlist-heart-btn {
        width: 30px;
        height: 30px;
        font-size: 15px;
        top: 6px;
        right: 6px;
    }
}