/* ============================================
   SILADESBENG PASAR DAERAH - PREMIUM CSS
   Theme: SiladesBeng Modern Ocean Blue
   ============================================ */

/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* CSS Custom Properties */
:root {
    --primary: #115789;
    --primary-light: #0ea5e9;
    --primary-dark: #0c436b;
    --secondary: #0284c7;
    --secondary-light: #38bdf8;
    --accent: #0ea5e9;
    --bg-main: #f8fafc;
    --bg-section: #f0f9ff;
    --bg-card: #ffffff;
    --bg-dark: #0f172a;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --text-white: #ffffff;
    --gradient-primary: linear-gradient(135deg, #115789 0%, #0ea5e9 100%);
    --gradient-hero: linear-gradient(135deg, #115789 0%, #0284c7 50%, #0ea5e9 100%);
    --gradient-card: linear-gradient(135deg, rgba(17, 87, 137, 0.04) 0%, rgba(14, 165, 233, 0.04) 100%);
    --shadow-sm: 0 2px 8px rgba(17, 87, 137, 0.06);
    --shadow-md: 0 4px 20px rgba(17, 87, 137, 0.08);
    --shadow-lg: 0 8px 40px rgba(17, 87, 137, 0.12);
    --shadow-xl: 0 20px 60px rgba(17, 87, 137, 0.16);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 30px;
    --radius-full: 50px;
    --transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --transition-fast: all 0.2s ease;
    --transition-slow: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ============================================
   SCROLL REVEAL ANIMATIONS
   ============================================ */
.reveal {
    opacity: 1;
    transform: translateY(0);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 1;
    transform: translateX(0);
}

.reveal-left.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-scale {
    opacity: 1;
    transform: scale(1);
}

.reveal-scale.active {
    opacity: 1;
    transform: scale(1);
}

/* ============================================
   PRODUCTS / KATALOG
   ============================================ */
.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 28px;
}

.product-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid rgba(124, 58, 237, 0.05);
    position: relative;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.product-image-wrapper {
    position: relative;
    width: 100%;
    height: 240px;
    overflow: hidden;
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.product-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: var(--transition);
}

.product-card:hover .product-image-wrapper img {
    transform: scale(1.08);
}

.product-badge {
    position: absolute;
    top: 14px;
    left: 14px;
    background: var(--gradient-primary);
    color: white;
    padding: 4px 14px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.product-actions-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    background: linear-gradient(transparent, rgba(30, 27, 46, 0.6));
    display: flex;
    justify-content: center;
    gap: 10px;
    opacity: 0;
    transform: translateY(10px);
    transition: var(--transition);
}

.product-card:hover .product-actions-overlay {
    opacity: 1;
    transform: translateY(0);
}

.product-action-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.product-action-btn svg {
    width: 18px;
    height: 18px;
    stroke: var(--text-primary);
}

.product-action-btn:hover {
    background: var(--primary);
    transform: scale(1.1);
}

.product-action-btn:hover svg {
    stroke: white;
}

.product-info {
    padding: 20px;
}

.product-info .product-name {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-info .product-desc {
    font-size: 0.78rem;
    color: var(--text-light);
    margin-bottom: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

.product-price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.product-price {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
}

.btn-add-cart {
    padding: 8px 18px;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    color: white;
    border: none;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Poppins', sans-serif;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-add-cart:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}

.btn-add-cart svg {
    width: 14px;
    height: 14px;
}

/* ============================================
   CART SIDEBAR
   ============================================ */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(30, 27, 46, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.cart-overlay.open {
    opacity: 1;
    visibility: visible;
}

.cart-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 90vw;
    height: 100%;
    background: var(--bg-card);
    z-index: 2001;
    transform: translateX(100%);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15);
}

.cart-sidebar.open {
    transform: translateX(0);
}

.cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #ffffff;
}

.cart-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #0f172a;
    margin: 0;
}

.cart-header h3 svg {
    width: 20px;
    height: 20px;
    stroke: #115789;
}

.cart-close {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.cart-close svg {
    width: 16px;
    height: 16px;
    stroke: #64748b;
}

.cart-close:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
}

.cart-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.cart-empty svg {
    width: 60px;
    height: 60px;
    stroke: var(--text-light);
    margin-bottom: 16px;
    opacity: 0.5;
}

.cart-empty p {
    font-size: 0.95rem;
}

.cart-item {
    display: flex;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid rgba(124, 58, 237, 0.06);
    animation: fadeInUp 0.3s ease;
}

.cart-item-image {
    width: 72px;
    height: 72px;
    min-width: 72px;
    border-radius: var(--radius-md);
    background: var(--bg-section);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.cart-item-details {
    flex: 1;
}

.cart-item-details h4 {
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cart-item-details .cart-item-price {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 10px;
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 0;
}

.cart-item-qty button {
    width: 30px;
    height: 30px;
    border: 1px solid rgba(124, 58, 237, 0.15);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: var(--transition-fast);
    font-family: 'Poppins', sans-serif;
}

.cart-item-qty button:first-child {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.cart-item-qty button:last-child {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.cart-item-qty button:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.cart-item-qty span {
    width: 40px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: 1px solid rgba(124, 58, 237, 0.15);
    border-bottom: 1px solid rgba(124, 58, 237, 0.15);
    font-size: 0.85rem;
    font-weight: 600;
}

.cart-item-remove {
    align-self: flex-start;
    width: 32px;
    height: 32px;
    min-width: 32px;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    transition: var(--transition-fast);
}

.cart-item-remove svg {
    width: 16px;
    height: 16px;
    stroke: var(--text-light);
}

.cart-item-remove:hover {
    background: #fee2e2;
}

.cart-item-remove:hover svg {
    stroke: #ef4444;
}

.cart-footer {
    padding: 20px 24px;
    border-top: 1px solid rgba(124, 58, 237, 0.08);
    background: rgba(250, 245, 255, 0.5);
}

.cart-subtotal {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    padding-top: 12px;
    border-top: 1px solid rgba(124, 58, 237, 0.1);
}

.btn-checkout {
    width: 100%;
    padding: 16px;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    color: white;
    border: none;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-checkout:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.4);
}

.btn-checkout svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   ORDER MODAL
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(30, 27, 46, 0.6);
    backdrop-filter: blur(6px);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    padding: 20px;
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 500px;
    max-width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    transition: var(--transition);
    box-shadow: var(--shadow-xl);
}

.modal-overlay.open .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 24px 28px;
    border-bottom: 1px solid rgba(124, 58, 237, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 1;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h3 svg {
    width: 22px;
    height: 22px;
    stroke: var(--primary);
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(124, 58, 237, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.modal-close svg {
    width: 18px;
    height: 18px;
    stroke: var(--text-primary);
}

.modal-close:hover {
    background: rgba(124, 58, 237, 0.15);
}

.modal-body {
    padding: 28px;
}

.modal-product {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(124, 58, 237, 0.08);
}

.modal-product-image {
    width: 100px;
    height: 100px;
    min-width: 100px;
    border-radius: var(--radius-md);
    background: var(--bg-section);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.modal-product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.modal-product-info h4 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.modal-product-info .modal-product-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.modal-product-info .modal-product-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
}

.modal-qty-section {
    margin-bottom: 24px;
}

.modal-qty-section label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.modal-qty-controls {
    display: flex;
    align-items: center;
    gap: 0;
}

.modal-qty-controls button {
    width: 44px;
    height: 44px;
    border: 2px solid rgba(124, 58, 237, 0.15);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: var(--transition-fast);
    font-family: 'Poppins', sans-serif;
}

.modal-qty-controls button:first-child {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.modal-qty-controls button:last-child {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.modal-qty-controls button:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.modal-qty-controls span {
    width: 60px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: 2px solid rgba(124, 58, 237, 0.15);
    border-bottom: 2px solid rgba(124, 58, 237, 0.15);
    font-size: 1rem;
    font-weight: 700;
}

.modal-calculation {
    background: rgba(124, 58, 237, 0.04);
    border: 1px solid rgba(124, 58, 237, 0.1);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 24px;
}

.modal-calc-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.modal-calc-row:last-child {
    margin-bottom: 0;
    padding-top: 12px;
    border-top: 1px solid rgba(124, 58, 237, 0.1);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-calc-row .calc-label {
    display: flex;
    align-items: center;
    gap: 6px;
}

.modal-footer {
    display: flex;
    gap: 12px;
}

.modal-footer .btn {
    flex: 1;
    justify-content: center;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--bg-dark);
    color: white;
    padding: 16px 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 5000;
    transform: translateY(100px);
    opacity: 0;
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 500;
}

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

.toast svg {
    width: 20px;
    height: 20px;
    stroke: #4ade80;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 900;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.5);
}

.back-to-top svg {
    width: 22px;
    height: 22px;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .modal {
        margin: 10px;
    }
    
    .cart-sidebar {
        width: 100%;
    }
}
