/* ==========================================
   1. පොදු හැඩගැන්වීම් (Global Styles)
   ========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Arial, sans-serif;
}

html, body {
    height: 100%;
    overflow: hidden;
    background-color: #f7f9fa;
    color: #111;
    display: flex;
    flex-direction: column;
}

/* ==========================================
   2. Header Banner
   ========================================== */
.top-banner {
    background-color: #111111;
    color: white;
    padding: 15px 10px;
    text-align: center;
    border-bottom: 5px solid #ffd814;
    width: 100%;
    flex-shrink: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.header-logo-img {
    position: absolute;
    left: 110px;
    top: 50%;
    transform: translateY(-50%);
    width: 210px !important;
    height: 210px !important;
    max-width: 210px !important;
    max-height: 210px !important;
    object-fit: contain;
    border-radius: 50%;
}

#searchinput {
    display: block;
    width: 240px;
    height: 40px;
    padding: 6px 12px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    outline: none;
    position: absolute;
    right: 25px;
    top: 50%;
    transform: translateY(-50%);
}

.banner-logo {
    font-size: 55px;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #ffd814;
    margin-bottom: 4px;
    line-height: 1.1;
}

.banner-tagline {
    font-size: 16px;
    color: #eee;
    font-weight: 500;
}

/* ==========================================
   3. Main Layout Setup
   ========================================== */
.main-layout {
    display: flex;
    flex: 1;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    overflow: hidden;
}

/* ==========================================
   4. Left Sidebar (Category Navigation)
   ========================================== */
.sidebar {
    width: 260px; 
    background-color: #fff;
    padding: 25px 15px;
    border-right: 1px solid #ddd;
    height: 100%;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 15px;
    font-weight: 700;
    color: #111;
    margin-bottom: 15px;
    padding-left: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-left: 4px solid #ffd814;
}

.category-btn {
    display: block;
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    padding: 12px 15px;
    font-size: 14px; 
    font-weight: 500;
    color: #070707;
    cursor: pointer;
    border-radius: 6px;
    margin-bottom: 5px;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-btn:hover {
    background-color: #ffe600;
    color: #111;
    padding-left: 20px;
}

.category-btn.active {
    background-color: #ffd814;
    color: #111;
    font-weight: 600;
}

/* ==========================================
   5. Right Products Content Area
   ========================================== */
.products-content {
    flex: 1;
    padding: 25px;
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* පේළියට Items 4ක් පෙන්වීම */
.products-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr); 
    gap: 15px;
    padding-bottom: 20px;
    align-items: start; 
}

/* ==========================================
   6. Product Cards
   ========================================== */
.product-card {
    position: relative;
    font-size: 14px;
    background-color: #fff;
    border-radius: 6px;
    padding: 15px;
    border: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    height: fit-content;
    transition: transform 0.2s, box-shadow 0.2s, height 0.3s ease;
    display: flex;
    flex-direction: column;
}

.product-card.hide {
    display: none !important;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.product-card.e27-bulb {
    background-color: #ffffff;
    border: 2px solid #e9e8e8;
}

.product-card.e27-bulb .product-full-details {
    background-color: rgba(255, 255, 255, 0.7);
    border-left: 3px solid #111;
}

/* ==========================================
   7. Images & Thumbnails
   ========================================== */
.product-image-box {
    width: 100%;
    height: 180px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f7f7f7;
    border-radius: 4px;
    overflow: hidden;
}

.product-image-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; 
    cursor: pointer;
    transition: transform 0.2s ease;
}

.product-image-box img:hover {
    transform: scale(1.03);
}

.thumbnail-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    margin-bottom: 15px;
}

.thumb {
    width: 40px;
    height: 40px;
    border: 2px solid #e4e7eb;
    border-radius: 4px;
    cursor: pointer;
    object-fit: cover;
}

.thumb:hover, 
.thumb.active {
    border-color: #ffd814;
}

/* ==========================================
   8. Product Details & Text
   ========================================== */
.product-title {
    font-size: 14px;
    font-weight: 700;
    color: #0066c0;
    margin-bottom: 6px;
    line-height: 1.3;
    height: 36px;
    overflow: hidden;
}

.product-short-desc {
    font-size: 12px;
    color: #565959;
    margin-bottom: 10px;
    line-height: 1.4;
    height: 34px;
    overflow: hidden;
}

.details-btn {
    background: none;
    border: none;
    color: #007185;
    font-size: 12px;
    text-align: left;
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 8px;
}

.details-btn:hover {
    color: #111;
    text-decoration: underline;
}

.product-full-details {
    display: none;
    font-size: 12px;
    color: #333;
    background: #f7f7f7;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 12px;
    border-left: 3px solid #ffd814;
}

.product-full-details ul {
    padding-left: 12px;
}

.buy-now-btn {
    display: block;
    background-color: #ffd814;
    border: 1px solid #fcd200;
    color: #111;
    padding: 10px;
    text-align: center;
    text-decoration: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: bold;
    transition: background 0.2s;
    margin-top: auto;
}

.buy-now-btn:hover {
    background-color: #f7ca00;
}

/* ==========================================
   9. Page Numbers (හැමවෙලාවෙම පල්ලෙහා පෙන්වීම)
   ========================================== */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding-top: 20px;
    padding-bottom: 20px;
    width: 100%;
    flex-shrink: 0;
}

.page-btn {
    background-color: #ffffff;
    border: 1px solid #cccccc;
    color: #111111;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.page-btn:hover:not(:disabled) {
    background-color: #ffe600;
    border-color: #ffd814;
}

.page-btn.active {
    background-color: #ffd814;
    border-color: #fcd200;
    color: #111111;
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background-color: #e9e9e9;
}

/* Product Image Hover Cursor */
.product-image-box img {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.product-image-box img:hover {
    transform: scale(1.02);
}

/* Modal Popup Styles */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    padding-top: 50px; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0, 0, 0, 0.85); 
    backdrop-filter: blur(5px);
}

/* Modal Content (Enlarged Image) */
.modal-content {
    margin: auto;
    display: block;
    max-width: 85%;
    max-height: 85vh;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.2);
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from { transform: scale(0.7); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Close Button */
.close-modal {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #ff4d4d;
}

/* ==========================================
   10. Image Zoom Modal Popup & Gallery Navigation
   ========================================== */
.modal {
    display: none; 
    position: fixed; 
    z-index: 9999; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0, 0, 0, 0.9); 
    backdrop-filter: blur(5px);
}

.modal-gallery-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    position: relative;
}

.modal-content {
    max-width: 80%;
    max-height: 65vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 25px rgba(255, 255, 255, 0.2);
    animation: zoomIn 0.25s ease-out;
}

@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-thumbnail-row {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 80%;
}

.modal-thumb {
    width: 55px;
    height: 55px;
    border: 2px solid #666;
    border-radius: 6px;
    cursor: pointer;
    object-fit: cover;
    opacity: 0.6;
    transition: all 0.2s ease;
}

.modal-thumb:hover,
.modal-thumb.active {
    opacity: 1;
    border-color: #ffd814;
    transform: scale(1.08);
}

/* Navigation Arrows (Prev / Next) */
.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #ffffff;
    font-size: 45px;
    font-weight: bold;
    cursor: pointer;
    padding: 15px 20px;
    user-select: none;
    transition: color 0.2s, background-color 0.2s;
    border-radius: 5px;
    z-index: 10001;
}

.modal-nav:hover {
    color: #ffd814;
    background-color: rgba(255, 255, 255, 0.1);
}

.modal-nav.prev { left: 25px; }
.modal-nav.next { right: 25px; }

.close-modal {
    position: absolute;
    top: 15px;
    right: 30px;
    color: #ffffff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10002;
    transition: color 0.2s ease;
}

.close-modal:hover {
    color: #ffd814;
}



/* ==========================================
   11. Responsive Design (Mobile / Tablet)
   ========================================== */
@media (max-width: 992px) {
    .products-container {
        grid-template-columns: repeat(2, 1fr); 
    }
}

@media (max-width: 768px) {
    html, body {
        overflow: auto;
        height: auto;
    }
    
    .top-banner {
        padding: 20px 15px;
    }
    
    .header-logo-img {
        position: static;
        transform: none;
        margin-bottom: 10px;
        width: 70px !important;
        height: 70px !important;
    }
    
    #searchinput {
        position: static;
        transform: none;
        width: 100%;
        margin-top: 15px;
    }

    .main-layout {
        display: block;
        overflow: auto;
    }

    .sidebar {
        width: 100%;
        height: auto;
        padding: 10px;
        overflow-x: auto;
        display: flex;
        gap: 8px;
        border-right: none;
        border-bottom: 1px solid #ddd;
    }

    .sidebar-title {
        display: none;
    }

    .category-btn {
        width: auto;
        margin-bottom: 0;
        white-space: nowrap;
    }

    .products-content {
        width: 100%;
        padding: 15px;
        height: auto;
        overflow: auto;
    }

    .products-container {
        grid-template-columns: repeat(1, 1fr);
        align-items: start; 
    }

    .close-modal {
        top: 10px;
        right: 20px;
        font-size: 32px;
    }

    .modal-nav {
        font-size: 30px;
        padding: 10px;
    }
    
    .modal-nav.prev { left: 5px; }
    .modal-nav.next { right: 5px; }
}