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

:root {
    --primary: #0066a4;
    --primary-dark: #004d7a;
    --primary-light: #e8f4f8;
    --primary-rgb: 0, 102, 164;
    --secondary: #f5a623;
    --secondary-dark: #d4891a;
    --accent: #00a1e0;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --dark: #1a1a2e;
    --gray-900: #1a1a2e;
    --gray-800: #2d2d3f;
    --gray-700: #495057;
    --gray-600: #6c757d;
    --gray-500: #adb5bd;
    --gray-400: #ced4da;
    --gray-300: #dee2e6;
    --gray-200: #e9ecef;
    --gray-100: #f5f6f8;
    --white: #ffffff;
    --body-bg: #f5f6f8;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --border-radius: 8px;
    --border-radius-sm: 4px;
    --border-radius-lg: 12px;
    --box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    --box-shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --box-shadow-lg: 0 8px 25px rgba(0,0,0,0.12);
    --transition: all 0.25s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: var(--font-family);
    color: var(--gray-700);
    background-color: var(--body-bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }

.container { max-width: 1480px; margin: 0 auto; padding: 0 20px; }

/* ===== SECTIONS ===== */
.section { padding: 40px 0; }
.section-title {
    font-size: 1.35rem; font-weight: 700; color: var(--dark); margin-bottom: 24px;
}
.section-title.center { text-align: center; }

/* ===== SUBCATEGORY GRID ===== */
.subcategory-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px;
    margin-bottom: 30px;
}
.subcategory-card {
    display: flex; flex-direction: column; align-items: center;
    text-align: center; padding: 24px 16px;
    background: var(--white); border-radius: var(--border-radius);
    box-shadow: var(--box-shadow); transition: var(--transition);
    text-decoration: none; color: var(--gray-700);
    border: 1px solid var(--gray-200);
}
.subcategory-card:hover {
    transform: translateY(-4px); box-shadow: var(--box-shadow-lg);
    color: var(--primary); border-color: var(--primary);
}
.subcategory-card img { width: 64px; height: 64px; object-fit: contain; margin-bottom: 12px; }
.subcategory-card .subcategory-placeholder {
    width: 64px; height: 64px; display: flex; align-items: center; justify-content: center;
    color: var(--gray-400); font-size: 2rem; margin-bottom: 12px;
}
.subcategory-card h3 { font-size: 0.85rem; font-weight: 600; line-height: 1.3; margin-bottom: 4px; }
.subcategory-card .count { font-size: 0.75rem; color: var(--gray-500); }

/* ===== PRODUCT GRID & CARDS ===== */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.product-card {
    background: var(--white); border-radius: var(--border-radius);
    overflow: hidden; box-shadow: var(--box-shadow); transition: var(--transition);
    display: flex; flex-direction: column; border: 1px solid var(--gray-200);
    position: relative;
}
.product-card:hover { box-shadow: var(--box-shadow-lg); border-color: var(--gray-300); }
.product-card-img {
    position: relative; height: 220px; background: var(--white);
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
}
.product-card-img a { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.product-card-img img { max-height: 188px; max-width: 100%; object-fit: contain; }
.product-card-noimg { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: var(--gray-400); }
.product-card-noimg i { font-size: 2.5rem; }

/* Favorite button */
.product-favorite {
    position: absolute; top: 12px; right: 12px; z-index: 2;
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--white); border: 1px solid var(--gray-200);
    display: flex; align-items: center; justify-content: center;
    color: var(--gray-400); font-size: 1rem;
    cursor: pointer; transition: all 0.2s ease;
    opacity: 0;
}
.product-card:hover .product-favorite { opacity: 1; }
.product-favorite:hover { color: #e74c3c; border-color: #e74c3c; background: #fef2f2; }
.product-favorite.is-favorited { opacity: 1; color: #e74c3c; border-color: #e74c3c; }
.product-favorite.is-favorited i { font-weight: 900; }

.product-card-body {
    padding: 14px 16px; flex: 1; display: flex; flex-direction: column;
    transition: transform 0.25s ease;
    position: relative; z-index: 1; background: var(--white);
}
.product-card:hover .product-card-body { transform: translateY(-74px); }
.product-card-body h3 {
    font-size: 0.92rem; font-weight: 600; color: var(--dark);
    margin-bottom: 4px; line-height: 1.35;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.product-card-body h3 a { color: inherit; text-decoration: none; }
.product-card-body h3 a:hover { color: var(--primary); }
.product-card-body .product-sku { font-size: 0.75rem; color: var(--gray-500); margin-bottom: 8px; }
.product-card-body .product-manufacturer { font-size: 0.75rem; color: var(--gray-600); }

/* Price */
.product-price { font-size: 1.05rem; font-weight: 700; color: var(--dark); margin-top: 8px; }
.product-price .unit { font-size: 0.78rem; color: var(--gray-600); font-weight: 400; }
.vat-note { font-size: 0.7rem; color: var(--gray-500); margin-bottom: 4px; }

/* Stock status */
.product-stock {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.78rem; margin-top: auto; padding-top: 8px;
}
.stock-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.product-stock-in_stock { color: #2e7d32; }
.product-stock-in_stock .stock-dot { background: #2e7d32; }
.product-stock-on_order { color: #e67e22; }
.product-stock-on_order .stock-dot { background: #e67e22; }
.product-stock-out_of_stock { color: #c0392b; }
.product-stock-out_of_stock .stock-dot { background: #c0392b; }

/* Card footer - button on hover */
.product-card-footer {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 0 16px 16px;
    opacity: 0; transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}
.product-card:hover .product-card-footer {
    opacity: 1; transform: translateY(0); pointer-events: auto;
}
.product-card-btn {
    display: block; width: 100%; padding: 10px 0;
    text-align: center; background: var(--primary); color: var(--white);
    border-radius: var(--border-radius-sm); font-size: 0.88rem; font-weight: 600;
    text-decoration: none; transition: background 0.15s ease;
}
.product-card-btn:hover { background: var(--primary-dark); color: var(--white); }

/* Legacy stock badges (keep for other pages) */
.stock-badge.stock-in { background: #d4edda; color: #155724; }
.stock-badge.stock-low { background: #fff3cd; color: #856404; }
.stock-badge.stock-out { background: #f8d7da; color: #721c24; }

/* Product toolbar */
.product-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 0; flex-wrap: wrap; gap: 12px;
    border-bottom: 1px solid var(--gray-200); margin-bottom: 20px;
}
.product-toolbar .result-count { font-size: 0.9rem; color: var(--gray-600); }
.product-toolbar .toolbar-right { display: flex; align-items: center; gap: 12px; }
.product-toolbar select {
    padding: 8px 12px; border: 1px solid var(--gray-300);
    border-radius: var(--border-radius-sm); font-size: 0.85rem;
    background: var(--white); font-family: var(--font-family);
}
.per-page-buttons { display: flex; gap: 4px; }
.per-page-buttons a {
    padding: 6px 10px; border: 1px solid var(--gray-300);
    border-radius: var(--border-radius-sm); font-size: 0.8rem; color: var(--gray-600);
}
.per-page-buttons a.active, .per-page-buttons a:hover {
    background: var(--primary); color: var(--white); border-color: var(--primary);
}

/* ===== PRODUCT DETAIL ===== */
.product-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; padding: 30px 0; }
.product-gallery {
    background: var(--white); border-radius: var(--border-radius);
    padding: 30px; text-align: center; border: 1px solid var(--gray-200);
}
.product-gallery .main-image img { max-height: 400px; object-fit: contain; margin: 0 auto; }
.product-gallery .thumbnails { display: flex; gap: 8px; margin-top: 16px; justify-content: center; }
.product-gallery .thumbnails img {
    width: 60px; height: 60px; object-fit: contain;
    border: 2px solid var(--gray-200); border-radius: 4px; cursor: pointer;
}
.product-gallery .thumbnails img:hover, .product-gallery .thumbnails img.active { border-color: var(--primary); }

.product-info h1 { font-size: 1.4rem; font-weight: 700; color: var(--dark); margin-bottom: 8px; line-height: 1.3; }
.product-info .sku { font-size: 0.85rem; color: var(--gray-600); margin-bottom: 20px; }
.product-info .price-box {
    background: var(--primary-light); border-radius: var(--border-radius);
    padding: 20px; margin-bottom: 20px; border-left: 4px solid var(--primary);
}
.product-info .price-box .price { font-size: 1.75rem; font-weight: 700; color: var(--primary); }
.product-info .price-box .price .unit { font-size: 0.9rem; font-weight: 400; }
.product-info .price-box .vat-info { font-size: 0.82rem; color: var(--gray-600); margin-top: 2px; }
.product-info .stock-info {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: 20px; font-size: 0.82rem; font-weight: 600; margin-bottom: 20px;
}
.product-info .stock-in-stock { background: #d4edda; color: #155724; }
.product-info .stock-on-order { background: #fff3cd; color: #856404; }
.product-info .stock-out-of-stock { background: #f8d7da; color: #721c24; }

.quantity-row { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.quantity-input { display: flex; align-items: center; border: 2px solid var(--gray-300); border-radius: var(--border-radius); overflow: hidden; }
.quantity-input button {
    background: var(--gray-100); border: none; width: 38px; height: 38px;
    font-size: 1rem; cursor: pointer; transition: var(--transition);
}
.quantity-input button:hover { background: var(--gray-200); }
.quantity-input input {
    width: 60px; height: 38px; border: none; text-align: center;
    font-size: 0.95rem; font-family: var(--font-family); font-weight: 600; outline: none;
}

.product-tabs { margin-top: 30px; }
.product-tabs .tab-nav { display: flex; border-bottom: 2px solid var(--gray-200); }
.product-tabs .tab-nav button {
    padding: 12px 24px; background: none; border: none;
    border-bottom: 2px solid transparent; margin-bottom: -2px;
    font-size: 0.9rem; font-weight: 600; color: var(--gray-600);
    cursor: pointer; transition: var(--transition); font-family: var(--font-family);
}
.product-tabs .tab-nav button.active,
.product-tabs .tab-nav button:hover { color: var(--primary); border-bottom-color: var(--primary); }
.product-tabs .tab-content { padding: 20px 0; }
.product-tabs .tab-panel { display: none; }
.product-tabs .tab-panel.active { display: block; }
.product-specs table { width: 100%; border-collapse: collapse; }
.product-specs td { padding: 10px 14px; border-bottom: 1px solid var(--gray-200); font-size: 0.9rem; }
.product-specs td:first-child { font-weight: 600; color: var(--gray-700); width: 40%; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 24px; border: none; border-radius: var(--border-radius);
    font-size: 0.9rem; font-weight: 600; font-family: var(--font-family);
    cursor: pointer; transition: var(--transition); text-decoration: none;
    white-space: nowrap; line-height: 1.4;
}
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); color: var(--white); }
.btn-secondary { background: var(--secondary); color: var(--white); }
.btn-secondary:hover { background: var(--secondary-dark); color: var(--white); }
.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: #218838; color: var(--white); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #c82333; color: var(--white); }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: var(--white); }
.btn-outline-white { background: transparent; border: 2px solid var(--white); color: var(--white); }
.btn-outline-white:hover { background: var(--white); color: var(--primary); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 32px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ===== BREADCRUMBS ===== */
.breadcrumbs { padding: 14px 0; font-size: 0.84rem; color: var(--gray-600); }
.breadcrumbs a { color: var(--primary); }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs .sep { margin: 0 8px; color: var(--gray-400); }

/* ===== PAGINATION ===== */
.pagination { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 30px 0; }
.pagination a, .pagination span {
    display: flex; align-items: center; justify-content: center;
    min-width: 36px; height: 36px; padding: 0 10px;
    border-radius: var(--border-radius-sm); font-size: 0.88rem; font-weight: 500;
}
.pagination a { background: var(--white); color: var(--gray-700); border: 1px solid var(--gray-300); }
.pagination a:hover { background: var(--primary); color: var(--white); border-color: var(--primary); }
.pagination .active { background: var(--primary); color: var(--white); border: 1px solid var(--primary); }

/* ===== FLASH MESSAGES ===== */
.flash-message {
    padding: 14px 20px; border-radius: var(--border-radius); margin: 15px 0;
    font-size: 0.9rem; display: flex; align-items: center; gap: 10px;
}
.flash-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.flash-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.flash-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 600; font-size: 0.88rem; margin-bottom: 5px; color: var(--gray-700); }
.form-control, .form-input {
    width: 100%; padding: 10px 14px; border: 2px solid var(--gray-300);
    border-radius: var(--border-radius); font-size: 0.92rem; font-family: var(--font-family);
    transition: var(--transition); background: var(--white); color: var(--gray-800);
}
.form-control:focus, .form-input:focus {
    border-color: var(--primary); outline: none;
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb),0.12);
}
.form-control::placeholder, .form-input::placeholder { color: var(--gray-500); }
textarea.form-control, textarea.form-input { min-height: 120px; resize: vertical; }
select.form-control, select.form-input { appearance: auto; }
select.form-select {
    padding: 8px 12px; border: 1px solid var(--gray-300);
    border-radius: var(--border-radius-sm); font-size: 0.85rem;
    background: var(--white); font-family: var(--font-family);
    cursor: pointer; appearance: auto;
}
.form-check { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.form-check input[type="checkbox"] { margin-top: 3px; width: 18px; height: 18px; }

/* ===== TABLES ===== */
.table-responsive { overflow-x: auto; }
.table {
    width: 100%; border-collapse: collapse; background: var(--white);
    border-radius: var(--border-radius); overflow: hidden; box-shadow: var(--box-shadow);
}
.table th {
    background: var(--gray-100); padding: 12px 16px; font-size: 0.82rem;
    font-weight: 600; color: var(--gray-600); text-align: left;
    border-bottom: 2px solid var(--gray-200); text-transform: uppercase; letter-spacing: 0.3px;
}
.table td { padding: 12px 16px; font-size: 0.88rem; border-bottom: 1px solid var(--gray-200); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(var(--primary-rgb),0.02); }

.badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; }
.badge-pending { background: #fff3cd; color: #856404; }
.badge-accepted { background: #d4edda; color: #155724; }
.badge-rejected { background: #f8d7da; color: #721c24; }
.badge-processing { background: #d1ecf1; color: #0c5460; }
.badge-shipped { background: #cce5ff; color: #004085; }
.badge-delivered { background: #d4edda; color: #155724; }
.badge-completed { background: #d4edda; color: #155724; }
.badge-in_progress { background: #d1ecf1; color: #0c5460; }
.badge-cancelled { background: #e2e3e5; color: #383d41; }

/* ===== CART ===== */
.cart-layout { display: grid; grid-template-columns: 1fr 360px; gap: 30px; padding: 30px 0; }
.cart-table { width: 100%; }
.cart-table th { text-align: left; padding: 12px 16px; font-size: 0.82rem; color: var(--gray-600); font-weight: 600; border-bottom: 2px solid var(--gray-200); }
.cart-table td { padding: 16px; vertical-align: middle; border-bottom: 1px solid var(--gray-200); }
.cart-product { display: flex; align-items: center; gap: 14px; }
.cart-product img { width: 72px; height: 72px; object-fit: contain; background: var(--gray-100); border-radius: 6px; padding: 4px; }
.cart-summary {
    background: var(--white); border-radius: var(--border-radius); padding: 24px;
    box-shadow: var(--box-shadow); border: 1px solid var(--gray-200); position: sticky; top: 80px;
}
.cart-summary h3 { font-size: 1rem; font-weight: 700; margin-bottom: 16px; color: var(--dark); }
.cart-summary .line { display: flex; justify-content: space-between; padding: 8px 0; font-size: 0.9rem; color: var(--gray-600); }
.cart-summary .total {
    border-top: 2px solid var(--gray-300); margin-top: 10px; padding-top: 12px;
    font-size: 1.1rem; font-weight: 700; color: var(--dark);
}

/* ===== PAGE CONTENT ===== */
.page-content { max-width: 960px; margin: 0 auto; padding: 30px 0; }
.page-title { font-size: 1.6rem; font-weight: 700; color: var(--dark); margin-bottom: 20px; }
.content-card {
    background: var(--white); border-radius: var(--border-radius); padding: 30px;
    box-shadow: var(--box-shadow); border: 1px solid var(--gray-200); margin-bottom: 20px;
}
.content-card h2 { font-size: 1.15rem; font-weight: 700; margin-bottom: 12px; color: var(--dark); }
.content-card p { font-size: 0.92rem; color: var(--gray-600); line-height: 1.7; margin-bottom: 12px; }
.content-card ul, .content-card ol { margin-left: 20px; margin-bottom: 12px; }
.content-card li { font-size: 0.92rem; color: var(--gray-600); padding: 3px 0; list-style: disc; }

/* ===== AUTH ===== */
.auth-container {
    background: var(--white); border-radius: var(--border-radius-lg); padding: 40px;
    width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo img { height: 48px; display: inline-block; }
.auth-title { text-align: center; font-size: 1.25rem; font-weight: 700; color: var(--dark); margin-bottom: 5px; }
.auth-subtitle { text-align: center; font-size: 0.88rem; color: var(--gray-600); margin-bottom: 28px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .product-detail { grid-template-columns: 1fr; }
    .cart-layout { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .product-grid { grid-template-columns: repeat(2,1fr); gap: 12px; }
    .product-toolbar { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) {
    .product-grid { grid-template-columns: 1fr; }
}
