* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Lightbox Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    position: relative;
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    max-width: 90%;
    max-height: 90%;
}

.modal img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.3s ease;
}

.close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.5);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close:hover,
.close:focus {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

#modalCaption {
    color: white;
    font-size: 16px;
    font-weight: 500;
    margin-top: 15px;
    text-align: center;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes zoomIn {
    from { 
        opacity: 0;
        transform: scale(0.8);
    }
    to { 
        opacity: 1;
        transform: scale(1);
    }
}

/* เพิ่ม cursor pointer ให้รูปสินค้าเพื่อบอกว่าคลิกได้ */
.product-image {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.product-image:hover {
    transform: scale(1.05);
}

@media (max-width: 768px) {
    .close {
        top: 10px;
        right: 15px;
        font-size: 30px;
        width: 40px;
        height: 40px;
    }
    
    .modal img {
        max-height: 70vh;
    }
    
    #modalCaption {
        font-size: 14px;
        margin-top: 10px;
        padding: 8px 15px;
    }
}

body {
    font-family: 'Sarabun', sans-serif;
    line-height: 1.4;
    background-color: #f8f9fa;
    padding: 10px;
}

.container {
    max-width: 100%;
    margin: 0 auto;
}

.header {
    background: white;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.filter-label {
    font-size: 14px;
    font-weight: bold;
    color: #333;
}

.sort-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.sort-btn {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
}

.sort-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

/* ปุ่มกรองตามประเภท */
.category-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.category-btn {
    padding: 8px 16px;
    border: 2px solid;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    background: white;
    min-width: auto;
    white-space: nowrap;
}

.category-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.category-btn.active {
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* สีปุ่มแต่ละประเภท */
.category-btn.hot {
    border-color: #dc3545;
    color: #dc3545;
}

.category-btn.hot:hover,
.category-btn.hot.active {
    background: #dc3545;
    border-color: #dc3545;
}

.category-btn.cool {
    border-color: #28a745;
    color: #28a745;
}

.category-btn.cool:hover,
.category-btn.cool.active {
    background: #28a745;
    border-color: #28a745;
}

.category-btn.beads {
    border-color: #6f42c1;
    color: #6f42c1;
}

.category-btn.beads:hover,
.category-btn.beads.active {
    background: #6f42c1;
    border-color: #6f42c1;
}

.category-btn.sweet {
    border-color: #fd7e14;
    color: #fd7e14;
}

.category-btn.sweet:hover,
.category-btn.sweet.active {
    background: #fd7e14;
    border-color: #fd7e14;
}

.category-btn.fruit {
    border-color: #e83e8c;
    color: #e83e8c;
}

.category-btn.fruit:hover,
.category-btn.fruit.active {
    background: #e83e8c;
    border-color: #e83e8c;
}

.category-btn.all {
    border-color: #6c757d;
    color: #6c757d;
    font-weight: 600;
}

.category-btn.all:hover,
.category-btn.all.active {
    background: #6c757d;
    border-color: #6c757d;
}

.product-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@media (min-width: 768px) {
    .product-list {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
}

.product-item {
    background: white;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 15px;
}

.product-item.out-of-stock {
    opacity: 0.4;
    filter: grayscale(50%);
}

.product-image {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    object-fit: cover;
    background: #f0f0f0;
    flex-shrink: 0;
}

.product-info {
    flex: 1;
    min-width: 0;
}

.product-name {
    font-weight: bold;
    font-size: 16px;
    color: #333;
    margin-bottom: 5px;
    word-wrap: break-word;
}

.product-code {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.product-status {
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 15px;
    display: inline-block;
}

.in-stock {
    background: #d4edda;
    color: #155724;
}

.out-of-stock {
    background: #f8d7da;
    color: #721c24;
}

.product-price {
    font-size: 13px;
    color: #ab0000;
    margin-top: 5px;
}

.product-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.btn {
    padding: 6px 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
    min-width: 60px;
}

.btn-copy {
    background: linear-gradient(45deg, #f09433 0%,#e6683c 25%,#dc2743 50%,#cc2366 75%,#bc1888 100%);
    color: white;
    height: 35px;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.btn-select {
    background: linear-gradient(45deg, #405de6 0%, #5851db 25%, #833ab4 50%, #c13584 75%, #e1306c 100%);
    color: white;
    height: 35px;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.btn-select.selected {
    background: linear-gradient(45deg, #fd5949 0%, #d6336c 25%, #c33764 50%, #8b2635 75%, #621220 100%);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.quantity-control {
    display: none;
    align-items: center;
    gap: 5px;
    margin-top: 5px;
}

.quantity-control.active {
    display: flex;
}

.qty-btn {
    width: 25px;
    height: 25px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.qty-input {
    width: 40px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 2px;
    font-size: 13px;
}

.floating-summary {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: linear-gradient(45deg, #405de6 0%, #5851db 25%, #833ab4 50%, #c13584 75%, #e1306c 100%);
    color: white;
    padding: 15px 20px;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
    font-weight: bold;
    white-space: nowrap;
    text-align: center;
    border-radius: 0;
    transform: translateY(100%);
    opacity: 0;
}

.floating-summary:hover {
    background: linear-gradient(45deg, #3b52d6 0%, #4c47cb 25%, #7332a4 50%, #b12574 75%, #d1275c 100%);
}

.floating-summary.show {
    transform: translateY(0);
    opacity: 1;
}

.floating-summary .arrow-down {
    margin-left: 8px;
    font-size: 16px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-4px);
    }
    60% {
        transform: translateY(-2px);
    }
}

.line-button {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: #00B900;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0,185,0,0.3);
    text-decoration: none;
    z-index: 1001;
    transition: all 0.3s ease;
}

.line-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,185,0,0.4);
}

.line-button svg {
    width: 30px;
    height: 30px;
    fill: white;
}

.hero-header {
    background: linear-gradient(45deg, #f09433 0%,#e6683c 25%,#dc2743 50%,#cc2366 75%,#bc1888 100%);
    color: white;
    text-align: center;
    padding: 40px 20px;
    margin-bottom: 20px;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.hero-title {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.hero-subtitle {
    font-size: 16px;
    opacity: 0.9;
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

.summary {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin: 30px 0;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
}

.payment-options {
    margin-bottom: 15px;
}

.payment-option {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.blockcode {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 5px;
    padding: 15px;
    font-family: monospace;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

.copy-summary-btn {
    margin-top: 10px;
    font-size: 16px;
    width: 100%;
    height: 50px;
    padding: 10px;
    background: linear-gradient(45deg, #f09433 0%,#e6683c 25%,#dc2743 50%,#cc2366 75%,#bc1888 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
}

.copy-summary-btn:hover {
    background: linear-gradient(45deg, #e08423 0%,#d6582c 25%,#cc1733 50%,#bc1356 75%, #ac0878 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.hidden {
    display: none;
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 24px;
    }
    
    .hero-subtitle {
        font-size: 14px;
    }
    
    .line-button {
        width: 50px;
        height: 50px;
        top: 15px;
        right: 15px;
    }
    
    .line-button svg {
        width: 24px;
        height: 24px;
    }
}

/* Toast Notification - Instagram Style */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(45deg, #f09433 0%,#e6683c 25%,#dc2743 50%,#cc2366 75%,#bc1888 100%);
    color: white;
    padding: 50px 60px;
    border-radius: 25px;
    font-size: 22px;
    font-weight: 600;
    box-shadow: 0 12px 35px rgba(0,0,0,0.2), 0 4px 10px rgba(0,0,0,0.15);
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    min-width: 280px;
    text-align: center;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.05);
}

/* To Top Button */
.to-top-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: linear-gradient(45deg, #405de6 0%, #5851db 25%, #833ab4 50%, #c13584 75%, #e1306c 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 1001;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.to-top-btn:hover {
    background: linear-gradient(45deg, #3b52d6 0%, #4c47cb 25%, #7332a4 50%, #b12574 75%, #d1275c 100%);
    transform: translateY(-2px) scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.to-top-btn.show {
    display: flex;
}

@media (max-width: 768px) {
    .category-filters {
        gap: 6px;
    }
    
    .category-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .product-item {
        padding: 10px;
        gap: 10px;
    }
    
    .product-image {
        width: 80px;
        height: 80px;
    }
    
    .product-name {
        font-size: 13px;
    }
    
    .controls {
        justify-content: space-between;
    }
    
    .sort-controls {
        width: 100%;
        justify-content: space-around;
    }
    
    .category-filters {
        gap: 4px;
        margin-top: 10px;
        padding-top: 10px;
        justify-content: space-between;
    }
    
    .category-btn {
        padding: 5px 8px;
        font-size: 12px;
        flex: 0 0 calc(33.333% - 3px);
        text-align: center;
        min-width: 0;
    }
    
    .toast {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .to-top-btn {
        width: 45px;
        height: 45px;
        bottom: 15px;
        right: 15px;
        font-size: 16px;
    }
}