/* FILE: assets/css/style.css */
/* BAGIAN: 4/12 - Stylesheet Native */

/* ========== RESET & BASE ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #198754;
    --secondary: #FF9800;
    --dark: #212121;
    --light: #f5f5f5;
    --white: #ffffff;
    --gray: #757575;
    --border: #e0e0e0;
    --success: #4CAF50;
    --danger: #f44336;
    --warning: #FF9800;
    --info: #2196F3;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--dark);
    background: #144516;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

/* ========== CONTAINER ========== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ========== HEADER STICKY ========== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--white);
    box-shadow: var(--shadow);
    z-index: 1000;
    height: 60px;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    padding: 0 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.logo img {
    height: 40px;
    width: auto;
}

.hamburger {
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 3px;
    background: var(--dark);
    border-radius: 2px;
    transition: 0.3s;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* ========== SIDEBAR MENU ========== */
.sidebar {
    position: fixed;
    top: 60px;
    right: -300px;
    width: 280px;
    height: calc(100vh - 60px);
    background: var(--white);
    box-shadow: -2px 0 8px rgba(0,0,0,0.1);
    transition: 0.3s;
    z-index: 999;
    overflow-y: auto;
}

.sidebar.active {
    right: 0;
}

.sidebar-overlay {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
    z-index: 998;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.menu-list {
    list-style: none;
    padding: 16px 0;
}

.menu-item {
    border-bottom: 1px solid var(--border);
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    color: var(--dark);
    transition: 0.2s;
}

.menu-link:hover {
    background: var(--light);
    color: var(--primary);
}

.menu-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========== MAIN CONTENT ========== */
.main {
    margin-top: 60px;
    min-height: calc(100vh - 60px);
    padding-bottom: 24px;
}

/* ========== BANNER SLIDER - SWIPE SUPPORT ========== */
.banner-slider {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: var(--gray);
    touch-action: pan-y pinch-zoom;
}

.banner-track {
    display: flex;
    height: 100%;
    transition: transform 0.3s ease-out;
    will-change: transform;
}

.banner-track.dragging {
    transition: none;
}

.banner-slide {
    min-width: 100%;
    width: 100%;
    height: 100%;
    flex-shrink: 0;
}

.banner-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

.banner-dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: 0.3s;
}

.dot.active {
    background: var(--white);
    width: 24px;
    border-radius: 4px;
}

/* ========== SEARCH BAR ========== */
.search-section {
    padding: 12px 16px;
    background: var(--white);
}

.search-box {
    position: relative;
}

.search-input {
    width: 100%;
    padding: 12px 40px 12px 16px;
    border: 2px solid var(--border);
    border-radius: 24px;
    font-size: 14px;
    transition: 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
}

.search-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
}

/* ========== CATEGORY TABS - 3 KOLOM GRID ========== */
.category-section {
    padding: 12px 16px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
}

.category-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.category-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 8px;
    background: var(--light);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.2s;
    text-align: center;
    min-height: 70px;
}

.category-tab:hover {
    background: #e8f5e9;
}

.category-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    font-weight: bold;
}

.category-icon {
    font-size: 22px;
    line-height: 1;
}

.category-name {
    font-size: 11px;
    font-weight: 500;
    line-height: 1.2;
    word-break: break-word;
}

/* ========== PRODUCT GRID - HORIZONTAL LAYOUT ========== */
.product-section {
    padding: 12px 16px;
}

.product-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.product-card {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: 0.3s;
    display: flex;
    flex-direction: row;
}

.product-card:hover {
    box-shadow: var(--shadow-hover);
}

.product-image {
    width: 120px;
    overflow: hidden;
    background: var(--light);
    flex-shrink: 0;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-info {
    padding: 10px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.product-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
    color: var(--dark);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.product-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 2px;
}

.product-unit {
    font-size: 11px;
    color: var(--gray);
    margin-bottom: 4px;
}

.product-stock {
    font-size: 11px;
    color: var(--gray);
    margin-bottom: 8px;
}

.stock-low {
    color: var(--danger);
}

.product-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
}

.qty-control {
    display: flex;
    align-items: center;
    gap: 4px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    background: var(--white);
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.qty-btn:hover {
    background: var(--light);
    border-color: var(--primary);
}

.qty-input {
    width: 36px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px;
    font-size: 13px;
}

.add-cart-btn {
    flex: 1;
    padding: 5px 7px 7px 7px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    transition: 0.2s;
    white-space: nowrap;
}

.add-cart-btn:hover {
    background: #45a049;
}

/* ========== CART BADGE ========== */
.cart-badge {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: var(--primary);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(76,175,80,0.4);
    cursor: pointer;
    transition: 0.3s;
    z-index: 100;
}

.cart-badge:hover {
    transform: scale(1.1);
}

.cart-count {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--danger);
    color: var(--white);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
}

/* ========== PAGINATION ========== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.page-btn {
    padding: 8px 14px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
    min-width: 40px;
}

.page-btn:hover {
    background: var(--light);
}

.page-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* ========== FORM STYLES ========== */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 13px;
    color: var(--dark);
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(76,175,80,0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

/* ========== BUTTONS ========== */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: 0.2s;
    text-align: center;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: #45a049;
}

.btn-secondary {
    background: var(--secondary);
    color: var(--white);
}

.btn-secondary:hover {
    background: #f57c00;
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-danger:hover {
    background: #e53935;
}

.btn-block {
    width: 100%;
    display: block;
}

.btn-outline {
    background: #daffee;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: var(--white);
}

/* ========== ALERTS ========== */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.alert-danger {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

.alert-warning {
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffcc80;
}

.alert-info {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #90caf9;
}

/* ========== CARDS ========== */
.card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 16px;
}

.card-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 16px;
}

.card-body {
    padding: 16px;
}

.card-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    background: var(--light);
}

/* ========== TABLE ========== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th, .table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: var(--light);
    font-weight: 600;
    font-size: 13px;
}

.table tr:hover {
    background: #fafafa;
}

/* ========== BADGES ========== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-danger {
    background: #ffebee;
    color: #c62828;
}

.badge-warning {
    background: #fff3e0;
    color: #e65100;
}

.badge-info {
    background: #e3f2fd;
    color: #1565c0;
}

/* ========== LOADING ========== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* ========== RESPONSIVE ========== */
/* Tablet */
@media (min-width: 768px) {
    .banner-slider {
        height: 280px;
    }
    
    .category-tabs {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .category-tab {
        padding: 12px;
        min-height: 80px;
    }
    
    .category-icon {
        font-size: 26px;
    }
    
    .category-name {
        font-size: 12px;
    }
    
    .product-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .product-card {
        flex-direction: column;
    }
    
    .product-image {
        width: 100%;
        height: 180px;
    }
    
    .product-info {
        padding: 12px;
    }
    
    .product-name {
        font-size: 15px;
    }
    
    .product-price {
        font-size: 16px;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .banner-slider {
        height: 400px;
    }
    
    .category-section {
        overflow-x: auto;
    }
    
    .category-tabs {
        display: flex;
        gap: 8px;
        min-width: max-content;
    }
    
    .category-tab {
        min-width: 90px;
        padding: 12px 16px;
    }
    
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .product-image {
        height: 200px;
    }
}

/* Large Desktop */
@media (min-width: 1200px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ========== PRODUCT DETAIL MODAL ========== */
.product-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.product-modal-overlay.active {
    display: flex;
    opacity: 1;
}

.product-modal {
    background: var(--white);
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.product-modal-overlay.active .product-modal {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 24px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.7);
}

.modal-image {
    width: 100%;
    background: var(--light);
}

.modal-image img {
    width: 100%;
    max-height: 350px;
    object-fit: contain;
    display: block;
}

.modal-content {
    padding: 20px;
}

.modal-product-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 8px;
    line-height: 1.3;
}

.modal-product-price {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.modal-product-unit {
    font-size: 14px;
    color: var(--gray);
    margin-bottom: 8px;
}

.modal-product-stock {
    font-size: 14px;
    color: var(--gray);
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.modal-product-stock.stock-low {
    color: var(--danger);
}

.modal-product-description {
    font-size: 14px;
    color: var(--dark);
    line-height: 1.6;
    margin-bottom: 20px;
    white-space: pre-wrap;
}

.modal-product-description:empty {
    display: none;
}

.modal-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.modal-actions .qty-control {
    flex-shrink: 0;
}

.modal-actions .btn {
    flex: 1;
}

.modal-actions.hidden {
    display: none;
}

/* ========== UTILITIES ========== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.hidden { display: none; }