/* ====================================
   Buttons
   ==================================== */
.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-lg);
    font-weight: var(--font-weight-medium);
    text-align: center;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: var(--font-family);
    font-size: 0.95rem;
    line-height: 1.5;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    color: white;
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.btn-sm {
    padding: var(--spacing-xs) var(--spacing-md);
    font-size: 0.875rem;
}

.btn-lg {
    padding: var(--spacing-md) var(--spacing-2xl);
    font-size: 1.125rem;
}

/* ====================================
   Forms
   ==================================== */
.form-control {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 0.95rem;
    transition: border-color var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: var(--font-weight-medium);
    color: var(--text-dark);
}

/* ====================================
   Cards & Products
   ==================================== */
.product-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: var(--spacing-xs);
}

.product-card .btn {
    height: 40px;
    padding-top: 0;
    padding-bottom: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.product-card .btn.btn-stacked {
    height: 40px;
    padding-top: 0;
    padding-bottom: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    flex-direction: row;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.product-image {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* Aspect ratio 16:9 */
    overflow: hidden;
    background: var(--bg-gray);
    border-radius: var(--radius-lg);
}

.product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-placeholder,
.category-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-gray), var(--bg-light));
}

.discount-badge {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    background: var(--error-color);
    color: white;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: var(--font-weight-bold);
    z-index: 1;
}

.product-info {
    padding: var(--spacing-md);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-name {
    font-size: 1rem;
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--spacing-sm);
    line-height: 1.4;
}

.product-name a {
    color: var(--text-dark);
}

.product-price {
    margin-bottom: var(--spacing-md);
}

.price-original {
    text-decoration: line-through;
    color: var(--text-medium);
    font-size: 0.875rem;
    margin-right: var(--spacing-xs);
}

.price-current {
    font-size: 1.25rem;
    font-weight: var(--font-weight-bold);
    color: var(--primary-color);
}

.product-card-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: auto;
}

.product-card-actions .btn {
    width: 100%;
}

.btn-add-cart {
    margin-top: auto;
    width: 100%;
}

/* ====================================
   Grids
   ==================================== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--spacing-lg);
}

@media (min-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-sm);
    padding: var(--spacing-md) 0;
}

@media (min-width: 1024px) {
    .categories-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: var(--spacing-lg);
    }
}

.categories-grid::-webkit-scrollbar {
    display: none;
}

.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    background: transparent;
    box-shadow: none;
    padding: 0;
    border-radius: 0;
    width: 100%;
}

.category-card:hover {
    transform: translateY(-3px);
    box-shadow: none;
}

.category-card img {
    position: relative;
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-xs);
    box-shadow: var(--shadow-sm);
    background: var(--bg-white);
}

.category-card h3 {
    position: relative;
    background: none;
    color: var(--text-dark);
    padding: 0;
    margin: 0;
    font-size: 0.75rem;
    font-weight: var(--font-weight-medium);
    text-align: center;
    width: 100%;
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.25;
    max-height: calc(2 * 1.25em);
    min-height: calc(2 * 1.25em);
}

/* Category placeholder style */
.category-placeholder {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-xs);
    background: linear-gradient(135deg, var(--bg-gray), var(--bg-light));
}

/* ====================================
   Sections
   ==================================== */
.section-title {
    font-size: 2rem;
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--spacing-md);
    text-align: center;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.products-section {
    padding: var(--spacing-lg) 0 var(--spacing-2xl);
}

.products-section.bg-light {
    background: var(--bg-white);
}

.categories-section {
    padding: var(--spacing-lg) 0;
    margin: 2.5rem var(--spacing-lg) 0 var(--spacing-lg);
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.empty-message {
    text-align: center;
    padding: var(--spacing-2xl);
    color: var(--text-medium);
    grid-column: 1 / -1;
}

/* ====================================
   Badges & Labels
   ==================================== */
.badge {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: var(--font-weight-semibold);
}

.badge-success {
    background: var(--success-color);
    color: white;
}

.badge-error {
    background: var(--error-color);
    color: white;
}

.badge-warning {
    background: var(--warning-color);
    color: white;
}

/* Mobile optimizations for product cards */
@media (max-width: 768px) {
    .discount-badge {
        top: 0.5rem;
        right: 0.5rem;
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
        border-radius: 6px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.2);
        font-weight: 700;
        letter-spacing: 0.5px;
    }
}

/* ====================================
   Pagination
   ==================================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-2xl);
}

.page-link {
    padding: var(--spacing-xs) var(--spacing-md);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.page-link:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.page-link.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* ====================================
   Responsive
   ==================================== */
@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: var(--spacing-md);
    }

    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--spacing-sm);
    }

    .section-title {
        font-size: 1.5rem;
        margin-bottom: var(--spacing-sm);
    }

    .categories-section {
        padding: var(--spacing-md) 0;
        margin: 2rem var(--spacing-md) 0 var(--spacing-md);
        border-radius: var(--radius-md);
    }

    .products-section {
        padding: var(--spacing-sm) 0 var(--spacing-md);
    }

    .btn.btn-add-cart {
        font-size: 0.8rem;
        white-space: nowrap;
    }

    .product-price {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
        margin-bottom: 8px;
    }

    /* Stack buttons vertically on mobile */
    .product-info > div[style*="display: flex"] {
        flex-direction: column;
        gap: 0.5rem !important;
    }

    .product-info .btn {
        width: 100%;
        margin: 0;
    }

    .product-card .btn.btn-stacked {
        height: auto;
        min-height: 40px;
        flex-direction: column;
        line-height: 1.1;
        white-space: normal;
        padding: 4px 0;
        gap: 0;
    }
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: capitalize;
}

.status-pending { background-color: #FEF3C7; color: #D97706; }
.status-processing { background-color: #DBEAFE; color: #2563EB; }
.status-completed, .status-delivered { background-color: #D1FAE5; color: #059669; }
.status-failed, .status-cancelled { background-color: #FEE2E2; color: #DC2626; }
.status-refunded { background-color: #F3F4F6; color: #4B5563; }
.status-verification_pending { background-color: #E0E7FF; color: #4F46E5; }

