/* =============================================
   PRODIKLIM PRODUCT GRID
   Clean, professional design for B2C shop
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

:root {
    --pkg-primary: #0066cc;
    --pkg-primary-hover: #004d99;
    --pkg-accent: #00a651;
    --pkg-danger: #e53935;
    --pkg-bg: #f5f7fa;
    --pkg-white: #ffffff;
    --pkg-text: #1a1a2e;
    --pkg-text-light: #6b7280;
    --pkg-border: #e5e7eb;
    --pkg-shadow: 0 1px 3px rgba(0,0,0,0.08);
    --pkg-shadow-hover: 0 8px 25px rgba(0,0,0,0.12);
    --pkg-radius: 10px;
    --pkg-transition: all 0.25s ease;
}

#pkg-container {
    font-family: 'DM Sans', sans-serif;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    color: var(--pkg-text);
}

/* =============================================
   HEADER: Tabs + Search
   ============================================= */
.pkg-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.pkg-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.pkg-tab {
    padding: 10px 18px;
    border: none;
    background: var(--pkg-white);
    color: var(--pkg-text-light);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--pkg-transition);
    white-space: nowrap;
}

.pkg-tab:hover {
    background: #eef2f7;
    color: var(--pkg-text);
}

.pkg-tab.active {
    background: var(--pkg-primary);
    color: white;
    box-shadow: 0 2px 8px rgba(0,102,204,0.3);
}

.pkg-search-wrap {
    position: relative;
    min-width: 280px;
}

#pkg-search {
    width: 100%;
    padding: 10px 16px 10px 42px;
    border: 2px solid var(--pkg-border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    background: var(--pkg-white);
    transition: var(--pkg-transition);
    outline: none;
}

#pkg-search:focus {
    border-color: var(--pkg-primary);
    box-shadow: 0 0 0 3px rgba(0,102,204,0.1);
}

.pkg-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--pkg-text-light);
    pointer-events: none;
}

/* =============================================
   CATEGORY SELECT
   ============================================= */
.pkg-categories-wrap {
    margin-bottom: 12px;
}

.pkg-category-select {
    width: 100%;
    max-width: 350px;
    padding: 10px 16px;
    border: 2px solid var(--pkg-border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    background: var(--pkg-white);
    color: var(--pkg-text);
    cursor: pointer;
    outline: none;
    transition: var(--pkg-transition);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.pkg-category-select:focus {
    border-color: var(--pkg-primary);
    box-shadow: 0 0 0 3px rgba(0,102,204,0.1);
}

/* =============================================
   TOOLBAR
   ============================================= */
.pkg-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--pkg-border);
}

.pkg-result-count {
    font-size: 14px;
    color: var(--pkg-text-light);
    font-weight: 500;
}

.pkg-result-count span {
    font-weight: 700;
    color: var(--pkg-text);
}

.pkg-toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pkg-sort-select {
    padding: 8px 12px;
    border: 1.5px solid var(--pkg-border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    background: var(--pkg-white);
    cursor: pointer;
    outline: none;
    color: var(--pkg-text);
}

.pkg-sort-select:focus {
    border-color: var(--pkg-primary);
}

.pkg-view-toggle {
    display: flex;
    border: 1.5px solid var(--pkg-border);
    border-radius: 8px;
    overflow: hidden;
}

.pkg-view-btn {
    padding: 7px 10px;
    border: none;
    background: var(--pkg-white);
    color: var(--pkg-text-light);
    cursor: pointer;
    transition: var(--pkg-transition);
    display: flex;
    align-items: center;
}

.pkg-view-btn + .pkg-view-btn {
    border-left: 1.5px solid var(--pkg-border);
}

.pkg-view-btn.active {
    background: var(--pkg-primary);
    color: white;
}

/* =============================================
   PRODUCTS GRID
   ============================================= */
.pkg-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    min-height: 300px;
}

.pkg-grid.view-list {
    grid-template-columns: 1fr;
    gap: 12px;
}

/* =============================================
   PRODUCT CARD - GRID VIEW
   ============================================= */
.pkg-card {
    background: var(--pkg-white);
    border-radius: var(--pkg-radius);
    overflow: hidden;
    box-shadow: var(--pkg-shadow);
    transition: var(--pkg-transition);
    display: flex;
    flex-direction: column;
    position: relative;
}

.pkg-card:hover {
    box-shadow: var(--pkg-shadow-hover);
    transform: translateY(-3px);
}

.pkg-card-image {
    position: relative;
    padding-top: 100%;
    background: #f8f9fb;
    overflow: hidden;
}

.pkg-card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 15px;
    transition: transform 0.4s ease;
}

.pkg-card:hover .pkg-card-image img {
    transform: scale(1.06);
}

/* Badges */
.pkg-badges {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 2;
}

.pkg-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pkg-badge-sale {
    background: var(--pkg-danger);
    color: white;
}

.pkg-badge-new {
    background: var(--pkg-accent);
    color: white;
}

.pkg-badge-featured {
    background: #f59e0b;
    color: white;
}

.pkg-badge-outofstock {
    background: #6b7280;
    color: white;
}

/* Quick actions overlay */
.pkg-card-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px;
    display: flex;
    justify-content: center;
    opacity: 0;
    transform: translateY(10px);
    transition: var(--pkg-transition);
    z-index: 2;
}

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

/* Card body */
.pkg-card-body {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.pkg-card-category {
    font-size: 11px;
    color: var(--pkg-primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.pkg-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--pkg-text);
    margin: 0 0 4px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pkg-card-title a {
    color: inherit;
    text-decoration: none;
}

.pkg-card-title a:hover {
    color: var(--pkg-primary);
}

.pkg-card-sku {
    font-size: 11px;
    color: var(--pkg-text-light);
    margin-bottom: 8px;
}

.pkg-card-desc {
    font-size: 12px;
    color: var(--pkg-text-light);
    line-height: 1.4;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pkg-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--pkg-border);
}

.pkg-card-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--pkg-text);
}

.pkg-card-price del {
    font-size: 13px;
    color: var(--pkg-text-light);
    font-weight: 400;
}

.pkg-card-price ins {
    text-decoration: none;
    color: var(--pkg-danger);
}

.pkg-btn-cart {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    background: var(--pkg-primary);
    color: white;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--pkg-transition);
    text-decoration: none;
    white-space: nowrap;
}

.pkg-btn-cart:hover {
    background: var(--pkg-primary-hover);
    transform: scale(1.03);
}

.pkg-btn-cart:active {
    transform: scale(0.97);
}

.pkg-btn-cart.added {
    background: var(--pkg-accent);
}

.pkg-btn-cart svg {
    width: 16px;
    height: 16px;
}

.pkg-btn-cart-disabled {
    background: #d1d5db;
    cursor: not-allowed;
}

.pkg-btn-cart-disabled:hover {
    background: #d1d5db;
    transform: none;
}

/* Stock indicator */
.pkg-stock {
    font-size: 11px;
    font-weight: 500;
}

.pkg-stock-in {
    color: var(--pkg-accent);
}

.pkg-stock-out {
    color: var(--pkg-danger);
}

.pkg-stock-low {
    color: #f59e0b;
}

/* =============================================
   LIST VIEW
   ============================================= */
.view-list .pkg-card {
    flex-direction: row;
    max-height: 160px;
}

.view-list .pkg-card-image {
    width: 160px;
    min-width: 160px;
    padding-top: 0;
    height: 160px;
}

.view-list .pkg-card-image img {
    padding: 10px;
}

.view-list .pkg-card-body {
    padding: 14px 20px;
}

.view-list .pkg-card-title {
    font-size: 16px;
    -webkit-line-clamp: 1;
}

.view-list .pkg-card-desc {
    -webkit-line-clamp: 2;
}

.view-list .pkg-card-actions {
    position: static;
    opacity: 1;
    transform: none;
    justify-content: flex-start;
    padding: 0;
}

.view-list .pkg-card-footer {
    border-top: none;
    padding-top: 0;
}

/* =============================================
   PAGINATION
   ============================================= */
.pkg-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 30px 0;
}

.pkg-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1.5px solid var(--pkg-border);
    background: var(--pkg-white);
    color: var(--pkg-text);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--pkg-transition);
}

.pkg-page-btn:hover {
    border-color: var(--pkg-primary);
    color: var(--pkg-primary);
}

.pkg-page-btn.active {
    background: var(--pkg-primary);
    border-color: var(--pkg-primary);
    color: white;
}

.pkg-page-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pkg-page-dots {
    padding: 0 4px;
    color: var(--pkg-text-light);
}

/* =============================================
   LOADING & EMPTY
   ============================================= */
.pkg-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--pkg-text-light);
}

.pkg-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--pkg-border);
    border-top-color: var(--pkg-primary);
    border-radius: 50%;
    animation: pkg-spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes pkg-spin {
    to { transform: rotate(360deg); }
}

.pkg-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: var(--pkg-text-light);
}

.pkg-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.pkg-empty h3 {
    font-size: 18px;
    color: var(--pkg-text);
    margin: 0 0 8px;
}

.pkg-empty p {
    font-size: 14px;
    margin: 0;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1100px) {
    .pkg-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .pkg-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .pkg-header { flex-direction: column; align-items: stretch; }
    .pkg-search-wrap { min-width: 100%; }
    .pkg-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .pkg-toolbar { flex-wrap: wrap; gap: 10px; }
    .pkg-card-price { font-size: 16px; }
    
    .view-list .pkg-card { max-height: none; flex-direction: column; }
    .view-list .pkg-card-image { width: 100%; height: auto; padding-top: 80%; }
}

@media (max-width: 480px) {
    .pkg-grid { grid-template-columns: 1fr; }
    .pkg-tab { padding: 8px 12px; font-size: 13px; }
}

/* =============================================
   ANIMATIONS
   ============================================= */
.pkg-card {
    animation: pkg-fadeIn 0.4s ease both;
}

.pkg-card:nth-child(1) { animation-delay: 0.02s; }
.pkg-card:nth-child(2) { animation-delay: 0.04s; }
.pkg-card:nth-child(3) { animation-delay: 0.06s; }
.pkg-card:nth-child(4) { animation-delay: 0.08s; }
.pkg-card:nth-child(5) { animation-delay: 0.10s; }
.pkg-card:nth-child(6) { animation-delay: 0.12s; }
.pkg-card:nth-child(7) { animation-delay: 0.14s; }
.pkg-card:nth-child(8) { animation-delay: 0.16s; }

@keyframes pkg-fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
