/**
 * Shared Activity Components CSS
 * Unified component styles for both backend designer and frontend templates
 * This file should be included in both backend and frontend templates.
 * 
 * @version 1.0.0
 * @author Kilo Code
 */

/* ============================================
   CSS Variables - Shared Theme Configuration
   ============================================ */
:root {
    /* Primary Colors */
    --act-primary-color: #ff4d4f;
    --act-secondary-color: #fab387;
    --act-success-color: #a6e3a1;
    --act-warning-color: #f9e2af;
    
    /* Text Colors */
    --act-text-color: #333333;
    --act-text-muted: #666666;
    --act-text-light: #999999;
    
    /* Background Colors */
    --act-bg-light: #f9f9f9;
    --act-bg-white: #ffffff;
    
    /* Border Colors */
    --act-border-color: #e5e5e5;
    --act-border-light: #f0f0f0;
    
    /* Price Colors */
    --act-price-color: #e53935;
    --act-price-original: #999999;
    
    /* Card Styles */
    --act-card-radius: 10px;
    --act-card-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --act-card-hover-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    --act-card-gap: 15px;
    
    /* Transitions */
    --act-transition: all 0.3s ease;
    --act-transition-fast: all 0.2s ease;
}

/* ============================================
   Base Component Wrapper
   ============================================ */
.act-component-wrapper {
    width: 100%;
    margin: 0 auto;
}

/* Container Types */
.act-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.act-container-fluid {
    width: 100%;
    padding: 0 15px;
}

.act-container-narrow {
    max-width: 750px;
    margin: 0 auto;
    padding: 0 15px;
}

/* ============================================
   Product Grid Component
   ============================================ */
.act-product-grid {
    display: grid;
    gap: var(--act-card-gap);
}

/* Grid Column Variants */
.act-product-grid.cols-1 { grid-template-columns: 1fr; }
.act-product-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.act-product-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.act-product-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.act-product-grid.cols-5 { grid-template-columns: repeat(5, 1fr); }
.act-product-grid.cols-6 { grid-template-columns: repeat(6, 1fr); }

/* Responsive Grid */
@media (max-width: 1200px) {
    .act-product-grid.cols-6 { grid-template-columns: repeat(4, 1fr); }
    .act-product-grid.cols-5 { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 992px) {
    .act-product-grid.cols-6,
    .act-product-grid.cols-5,
    .act-product-grid.cols-4 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .act-product-grid.cols-6,
    .act-product-grid.cols-5,
    .act-product-grid.cols-4,
    .act-product-grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
    
    .act-product-grid {
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .act-product-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================
   Product Card Component
   ============================================ */
.act-product-card {
    background: var(--act-bg-white);
    border-radius: var(--act-card-radius);
    overflow: hidden;
    box-shadow: var(--act-card-shadow);
    transition: var(--act-transition);
    position: relative;
    display: flex;
    flex-direction: column;
}

.act-product-card:hover {
    box-shadow: var(--act-card-hover-shadow);
    transform: translateY(-4px);
}

.act-product-card a {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* Product Image */
.act-product-image {
    position: relative;
    width: 100%;
    padding-bottom: 100%; /* 1:1 Aspect Ratio */
    overflow: hidden;
    background: #f5f5f5;
}

.act-product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
}

.act-product-card:hover .act-product-image img {
    transform: scale(1.05);
}

/* Discount Badge */
.act-discount-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--act-primary-color);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    z-index: 1;
}

@media (min-width: 768px) {
    .act-discount-badge {
        font-size: 14px;
        padding: 5px 10px;
    }
}

/* Product Info */
.act-product-info {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .act-product-info {
        padding: 15px;
    }
}

/* Product Title */
.act-product-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--act-text-color);
    margin: 0 0 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 36px;
}

@media (min-width: 768px) {
    .act-product-title {
        font-size: 14px;
        min-height: 40px;
    }
}

/* Product Price */
.act-product-price {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto;
}

.act-sale-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--act-price-color);
}

@media (min-width: 768px) {
    .act-sale-price {
        font-size: 18px;
    }
}

.act-original-price {
    font-size: 13px;
    color: var(--act-price-original);
    text-decoration: line-through;
}

/* Product Rating */
.act-product-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
}

.act-rating-stars {
    color: #ffc107;
    font-size: 12px;
}

.act-rating-count {
    font-size: 12px;
    color: var(--act-text-muted);
}

/* ============================================
   Product Card Style Variants
   ============================================ */

/* Minimal Style */
.act-product-card.style-minimal {
    box-shadow: none;
    border: 1px solid var(--act-border-color);
}

.act-product-card.style-minimal:hover {
    box-shadow: var(--act-card-shadow);
}

/* Bordered Style */
.act-product-card.style-bordered {
    border: 2px solid var(--act-border-color);
}

.act-product-card.style-bordered:hover {
    border-color: var(--act-primary-color);
}

/* Elevated Style */
.act-product-card.style-elevated {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.act-product-card.style-elevated:hover {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
    transform: translateY(-6px);
}

/* Compact Style */
.act-product-card.style-compact .act-product-info {
    padding: 8px;
}

.act-product-card.style-compact .act-product-title {
    font-size: 12px;
    min-height: 32px;
}

.act-product-card.style-compact .act-sale-price {
    font-size: 14px;
}

/* ============================================
   Category Tabs Component
   ============================================ */
.act-category-tabs {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 20px 0;
}

.act-category-tab {
    background-color: var(--act-bg-light);
    border: 1px solid var(--act-border-color);
    border-radius: 20px;
    padding: 8px 20px;
    font-weight: 500;
    color: var(--act-text-color);
    cursor: pointer;
    font-size: 14px;
    transition: var(--act-transition);
}

.act-category-tab:hover {
    background-color: var(--act-primary-color);
    border-color: var(--act-primary-color);
    color: #fff;
    transform: translateY(-2px);
}

.act-category-tab.active {
    background-color: var(--act-primary-color);
    border-color: var(--act-primary-color);
    color: #fff;
    box-shadow: 0 4px 12px rgba(255, 77, 79, 0.3);
}

@media (min-width: 768px) {
    .act-category-tabs {
        gap: 16px;
    }
    
    .act-category-tab {
        padding: 10px 24px;
        font-size: 15px;
    }
}

/* ============================================
   Banner Component
   ============================================ */
.act-banner {
    width: 100%;
    position: relative;
    overflow: hidden;
}

.act-banner img {
    width: 100%;
    height: auto;
    display: block;
}

.act-banner-link {
    display: block;
}

/* Banner with Overlay */
.act-banner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 50%, rgba(0,0,0,0.5) 100%);
    display: flex;
    align-items: flex-end;
    padding: 20px;
}

.act-banner-content {
    color: #fff;
}

.act-banner-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px;
}

.act-banner-subtitle {
    font-size: 14px;
    opacity: 0.9;
}

@media (min-width: 768px) {
    .act-banner-overlay {
        padding: 30px;
    }
    
    .act-banner-title {
        font-size: 32px;
    }
    
    .act-banner-subtitle {
        font-size: 16px;
    }
}

/* ============================================
   Countdown Component
   ============================================ */
.act-countdown {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 20px;
}

.act-countdown-item {
    text-align: center;
    background: var(--act-bg-white);
    border-radius: 8px;
    padding: 10px 15px;
    min-width: 60px;
    box-shadow: var(--act-card-shadow);
}

.act-countdown-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--act-primary-color);
    line-height: 1;
}

.act-countdown-label {
    font-size: 11px;
    color: var(--act-text-muted);
    text-transform: uppercase;
    margin-top: 4px;
}

.act-countdown-separator {
    font-size: 24px;
    font-weight: 700;
    color: var(--act-text-color);
}

@media (min-width: 768px) {
    .act-countdown {
        gap: 15px;
    }
    
    .act-countdown-item {
        padding: 15px 20px;
        min-width: 80px;
    }
    
    .act-countdown-value {
        font-size: 32px;
    }
    
    .act-countdown-label {
        font-size: 12px;
    }
}

/* ============================================
   Divider Component
   ============================================ */
.act-divider {
    width: 100%;
    height: 1px;
    background: var(--act-border-color);
    margin: 20px 0;
}

.act-divider.style-dashed {
    background: none;
    border-top: 1px dashed var(--act-border-color);
}

.act-divider.style-dotted {
    background: none;
    border-top: 1px dotted var(--act-border-color);
}

.act-divider.style-thick {
    height: 3px;
}

.act-divider.style-gradient {
    height: 2px;
    background: linear-gradient(to right, transparent, var(--act-primary-color), transparent);
}

/* ============================================
   Text Block Component
   ============================================ */
.act-text-block {
    padding: 15px;
    line-height: 1.6;
    color: var(--act-text-color);
}

.act-text-block.align-center {
    text-align: center;
}

.act-text-block.align-right {
    text-align: right;
}

.act-text-block h1,
.act-text-block h2,
.act-text-block h3,
.act-text-block h4 {
    margin: 0 0 10px;
    font-weight: 600;
}

.act-text-block p {
    margin: 0 0 10px;
}

.act-text-block p:last-child {
    margin-bottom: 0;
}

/* ============================================
   Button Component
   ============================================ */
.act-button {
    display: inline-block;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--act-transition);
    border: none;
}

.act-button.style-primary {
    background: var(--act-primary-color);
    color: #fff;
}

.act-button.style-primary:hover {
    background: #ff7875;
    transform: translateY(-2px);
}

.act-button.style-secondary {
    background: var(--act-text-color);
    color: #fff;
}

.act-button.style-secondary:hover {
    background: #555;
}

.act-button.style-outline {
    background: transparent;
    border: 2px solid var(--act-primary-color);
    color: var(--act-primary-color);
}

.act-button.style-outline:hover {
    background: var(--act-primary-color);
    color: #fff;
}

.act-button.size-small {
    padding: 6px 16px;
    font-size: 12px;
}

.act-button.size-large {
    padding: 14px 32px;
    font-size: 16px;
}

/* ============================================
   Loading States
   ============================================ */
.act-loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: act-skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes act-skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.act-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--act-border-color);
    border-top-color: var(--act-primary-color);
    border-radius: 50%;
    animation: act-spin 1s linear infinite;
}

@keyframes act-spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   Empty State
   ============================================ */
.act-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--act-text-muted);
}

.act-empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.act-empty-state-text {
    font-size: 14px;
}

/* ============================================
   Pagination Component
   ============================================ */
.act-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 20px 0;
}

.act-pagination-btn {
    padding: 8px 16px;
    background: var(--act-bg-light);
    border: 1px solid var(--act-border-color);
    border-radius: 4px;
    color: var(--act-text-color);
    cursor: pointer;
    transition: var(--act-transition-fast);
}

.act-pagination-btn:hover,
.act-pagination-btn.active {
    background: var(--act-primary-color);
    border-color: var(--act-primary-color);
    color: #fff;
}

.act-pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   Utility Classes
   ============================================ */
.act-mt-0 { margin-top: 0; }
.act-mt-1 { margin-top: 10px; }
.act-mt-2 { margin-top: 20px; }
.act-mt-3 { margin-top: 30px; }

.act-mb-0 { margin-bottom: 0; }
.act-mb-1 { margin-bottom: 10px; }
.act-mb-2 { margin-bottom: 20px; }
.act-mb-3 { margin-bottom: 30px; }

.act-pt-0 { padding-top: 0; }
.act-pt-1 { padding-top: 10px; }
.act-pt-2 { padding-top: 20px; }
.act-pt-3 { padding-top: 30px; }

.act-pb-0 { padding-bottom: 0; }
.act-pb-1 { padding-bottom: 10px; }
.act-pb-2 { padding-bottom: 20px; }
.act-pb-3 { padding-bottom: 30px; }

.act-text-center { text-align: center; }
.act-text-left { text-align: left; }
.act-text-right { text-align: right; }

.act-hidden { display: none !important; }
.act-visible { display: block !important; }
