html, body {
    width: 100%;
    height: auto !important;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-y: auto !important;
    overflow-x: hidden;
    background-color: #f9f9f9;
    font-family: 'Kanit', sans-serif;
}

.dashboard-container {
    display: flex;
    flex-direction: column;
    width: 90%;
    max-width: 1200px;
    margin: 40px auto;
    height: auto !important;
    min-height: 0;
}

.sidebar {
    width: 100%;
    background-color: #ffffff;
    padding: 20px 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.03);
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    box-sizing: border-box;
}

.nav-item {
    display: inline-block;
    padding: 8px 20px;
    color: #555;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
    border-radius: 20px;
    transition: all 0.2s ease;
    background: #f4f4f4;
}

.nav-item:hover {
    background: #e9e9e9;
}

.nav-item.active { 
    background-color: #F89b42; 
    color: white; 
    font-weight: 500; 
}

.product-card { position: relative; }
    .fav-btn {
        position: absolute;
        top: 10px; left: 10px;
        background: white; border: none; border-radius: 50%;
        width: 35px; height: 35px;
        display: flex; align-items: center; justify-content: center;
        cursor: pointer; box-shadow: 0 2px 5px rgba(0,0,0,0.15);
        z-index: 10; transition: transform 0.2s;
    }
    .fav-btn:hover { transform: scale(1.1); }
    .fav-btn i { font-size: 1.2rem; color: #ccc; transition: color 0.2s; }
    .fav-btn.active i { color: #ff4757; }

.main-content {
    width: 100%;
    background-color: #ffffff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    box-sizing: border-box;
    height: auto !important;
    display: block;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}
.page-title { font-size: 1.8rem; color: #F89b42; font-weight: 600; }
.controls-wrapper { display: flex; gap: 15px; align-items: center; }

.search-box { position: relative; }
.search-box input {
    padding: 10px 15px 10px 40px;
    border: 1px solid #ddd;
    border-radius: 20px;
    width: 240px;
}
.search-box i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #999; }

.filter-btn {
    background: white; border: 1px solid #ddd;
    padding: 9px 20px; border-radius: 20px; cursor: pointer;
    font-family: 'Kanit', sans-serif;
}

.filter-container { position: relative; }
.filter-dropdown {
    display: none; position: absolute; top: 110%; right: 0;
    background: white; border: 1px solid #eee;
    padding: 15px; z-index: 100; width: 250px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-radius: 8px;
}
.filter-dropdown.show { display: block; }
.filter-group { margin-bottom: 15px; }
.filter-group label { display: block; margin-bottom: 5px; font-weight: 500; font-size: 0.9rem;}
.filter-group select { width: 100%; padding: 8px; border: 1px solid #ddd; border-radius: 4px; }

.type-section { margin-bottom: 40px; }
.type-title { font-size: 1.4rem; border-bottom: 2px solid #eee; margin-bottom: 20px; padding-bottom: 10px; }

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 25px;
    width: 100%;
}

.product-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.2s;
    position: relative;
}

.fav-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: white;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 10;
    transition: transform 0.2s;
}

.fav-btn:hover {
    transform: scale(1.1);
}

.fav-btn i {
    font-size: 1.2rem;
    color: #ccc;
    transition: color 0.2s;
}

.fav-btn.liked i {
    color: #ff4757;
    font-weight: 900;
}

.product-card:hover { 
    box-shadow: 0 10px 20px rgba(0,0,0,0.08); 
    transform: translateY(-3px);
}

.card-image {
    width: 100%;
    height: 180px;
    background: #fcfcfc;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    border-bottom: 1px solid #f9f9f9;
    box-sizing: border-box;
}

.card-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.card-info { padding: 15px; }
.card-info h4 { margin: 0 0 5px 0; font-size: 1.1rem; color: #333; font-weight: 500; }
.brand { font-size: 0.85rem; color: #777; margin-bottom: 10px; margin-top: 0; }
.specs { display: flex; gap: 10px; font-size: 0.85rem; color: #888; border-top: 1px solid #eee; padding-top: 10px; }
.specs i { color: #F89b42; }

/* --- MODALS --- */

body.modal-open {
    overflow: hidden !important;
    height: 100vh;
    touch-action: none; 
}

.modal-overlay {
    display: none; position: fixed; z-index: 9999; left: 0; top: 0;
    width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px); justify-content: center; align-items: center;
}

.modal-box {
    background-color: #ffffff; padding: 40px; border-radius: 15px;
    width: 90%; max-width: 400px; text-align: center; position: relative;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}

.modal-content i { font-size: 3rem; color: orange; margin-bottom: 20px; display: block; }
.modal-content h3 { margin: 0 0 10px 0; color: #333; font-size: 1.5rem; }
.modal-content p { color: #666; margin-bottom: 25px; font-size: 1rem; line-height: 1.5; }

.close-modal {
    position: absolute; top: 15px; right: 20px;
	font-size: 28px; color: #ccc; cursor: pointer;
}

.close-modal-modal {
    position: absolute;
    top: 25px;
    right: 25px;
    width: 44px;
    height: 44px;
    background: #f0f0f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    color: #555;
    font-size: 20px;
    transition: all 0.2s ease;
}

.close-modal:hover { color: #333; }

.close-modal-modal:hover {
    background: #ff6b6b;
    color: white;
    transform: rotate(90deg);
}

.modal-actions { display: flex; gap: 15px; justify-content: center; width: 100%; }

.btn-login, .btn-signup {
    padding: 12px 30px; border-radius: 8px; text-decoration: none; font-weight: 500; font-size: 1rem;
}
.btn-login { background-color: #1A2238; color: white; }
.btn-signup { background-color: #f5f5f5; color: #333; }

.detail-modal-box {
    width: 90%;
    max-width: 1000px;
	height: 580px;
    padding: 0;
    border-radius: 24px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 30px 60px -10px rgba(0, 0, 0, 0.3);
    position: relative;
    display: flex;
    flex-direction: column;
}

.detail-modal-layout {
    display: flex;
    align-items: stretch;
    min-height: 550px;
}

.detail-content {
    display: flex;
    flex-direction: row;
    gap: 30px;
    flex: 1;
    align-items: center;
    text-align: left;
}

.detail-image-container {
    flex: 1;
    background: #f8fafc;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    height: 580px; 
    max-height: 580px;
    box-sizing: border-box;
    overflow: hidden;
}

.detail-image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain; 
    filter: drop-shadow(0 15px 25px rgba(0,0,0,0.1));
    transition: transform 0.3s ease;
}

.detail-image-container img:hover {
    transform: scale(1.03);
}

.detail-info-container {
    flex: 1.4;
    padding: 60px 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: left;
}

.detail-brand {
    font-size: 0.9rem;
    color: #F89b42;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 15px;
    display: inline-block;
}

.detail-info-container h2 {
    font-size: 2rem;
    color: #1a202c;
    margin: 0 0 30px 0;
    line-height: 1.2;
}

.detail-specs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: auto;
}

.spec-item {
    background: #ffffff;
    border: 1px solid #edf2f7;
    padding: 18px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.spec-item:hover {
    border-color: #F89b42;
    background: #fffbf7;
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}

.spec-item i {
    font-size: 1.4rem;
    color: #F89b42;
    margin-bottom: 8px;
}

.spec-item .label {
    font-size: 0.7rem;
    color: #718096;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.spec-item .value {
    font-size: 1.2rem;
    color: #2d3748;
    font-weight: 600;
}

.spec-item:nth-child(n+3) .text-content {
    display: flex;
    flex-direction: column;
}

.spec-item:nth-child(3), 
.spec-item:nth-child(4) {
    grid-column: span 2; 
    flex-direction: row;
    align-items: center;
    gap: 15px;
}

.spec-item:nth-child(3) {
    background: #ebf8ff;
    border-color: #bee3f8;
}
.spec-item:nth-child(3) i { color: #3182ce; }
.spec-item:nth-child(3) .value { font-size: 0.95rem; color: #2c5282; line-height: 1.4; }

.spec-item:nth-child(4) {
    background: #fff5f5;
    border-color: #fed7d7;
}
.spec-item:nth-child(4) i { color: #e53e3e; }
.spec-item:nth-child(4) .value { font-size: 0.95rem; color: #9b2c2c; line-height: 1.4; }

.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: #fff;
    border: 1px solid #eee;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.2rem;
    color: #333;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.nav-arrow:hover {
    background: #F89b42;
    color: white;
    border-color: #F89b42;
    box-shadow: 0 8px 20px rgba(248, 155, 66, 0.3);
}

.nav-arrow.prev { left: -10px; }
.nav-arrow.next { right: -10px; }


.detail-modal-layout {
    transition: opacity 0.2s ease, transform 0.2s ease;
    opacity: 1;
    transform: translateX(0);
}

.slide-out-left {
    opacity: 0;
    transform: translateX(-30px);
}

.slide-in-right {
    animation: slideInRight 0.3s forwards;
}

.slide-out-right {
    opacity: 0;
    transform: translateX(30px);
}

.slide-in-left {
    animation: slideInLeft 0.3s forwards;
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

.appliance-hidden {
    display: none;
}

.see-more-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 10px 0 30px 0;
}

.btn-see-more {
    background: #fff;
    border: 1px solid #ddd;
    padding: 8px 25px;
    border-radius: 20px;
    color: #666;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.btn-see-more:hover {
    border-color: orange;
    color: orange;
    transform: translateY(-2px);
}

@media (max-width: 700px) {
    .header-row { 
        flex-direction: column; 
        align-items: flex-start; 
        gap: 15px;
    }

    .controls-wrapper { 
        width: 100%; 
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .search-box, .search-box input { 
        width: 100%; 
        box-sizing: border-box; 
    }

    .filter-container { width: 100%; display: block; }
    .filter-btn { width: 100%; text-align: center; display: block; }
    
    .filter-dropdown {
        width: 100%;
        right: auto; left: 0;
        position: absolute;
    }
    
    .sidebar { justify-content: center; }

    .detail-modal-box {
        width: 95%;
        margin: 10px auto;
        max-height: 90vh;
        overflow-y: auto;
    }

    .detail-modal-layout {
        flex-direction: column;
        min-height: auto;
    }
    
    .detail-image-container {
        padding: 30px 20px 20px;
        height: 220px;
    }
    
    .detail-image-container img {
        max-height: 160px;
    }

    .detail-info-container {
        padding: 25px 20px;
    }

    .detail-brand {
        font-size: 0.8rem;
        margin-bottom: 5px;
    }

    .detail-info-container h2 { 
        font-size: 1.6rem;
        margin-bottom: 20px;
    }
    
    .detail-specs-grid {
        gap: 15px; 
    }

    .spec-item {
        padding: 12px 15px;
    }
    
    .spec-item i {
        font-size: 1.2rem;
        margin-bottom: 8px;
    }
    
    .spec-item .value {
        font-size: 1.1rem;
    }

    .nav-arrow {
        width: 35px; height: 35px;
        font-size: 0.9rem;
    }
    .nav-arrow.prev { left: 5px; }
    .nav-arrow.next { right: 5px; }
    
    .close-modal {
        top: 15px; right: 15px;
        width: 35px; height: 35px;
        font-size: 18px;
    }
	
	.detail-modal-layout { flex-direction: column; }
    .detail-image-container { height: 250px; padding: 20px; }
    .detail-info-container { padding: 30px 20px; }
    .detail-specs-grid { grid-template-columns: 1fr; }
    .spec-item:nth-child(n) { grid-column: span 1; }
}

@media (max-width: 480px) {
    .detail-modal-box {
        width: 92%;
        height: 90vh; 
        margin: 5vh auto;
    }

    .detail-image-container {
        flex: 0 0 200px;
        height: 200px;
        min-height: 200px;
        padding: 15px;
    }

    .detail-image-container img {
        max-height: 170px;
    }

    .detail-info-container {
        padding: 20px 15px;
    }

    .detail-brand {
        font-size: 0.75rem;
        letter-spacing: 1px;
    }

    .detail-info-container h2 {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }

    .detail-specs-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .spec-item, 
    .spec-item:nth-child(3), 
    .spec-item:nth-child(4) {
        grid-column: span 1;
        flex-direction: row;
        align-items: center;
        gap: 12px;
        padding: 12px;
    }

    .spec-item i {
        margin-bottom: 0;
        font-size: 1.2rem;
        width: 25px;
        text-align: center;
    }

    .spec-item .value {
        font-size: 1rem;
    }

    .spec-item .label {
        font-size: 0.65rem;
    }

    .nav-arrow {
        top: 100px;
        width: 35px;
        height: 35px;
        font-size: 0.8rem;
    }

    .close-modal-modal {
        top: 8px;
        right: 8px;
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
}