/**
 * Modern Categories Grid CSS
 * เหมาะสำหรับคนไม่เก่งเทคโนโลยี - ออกแบบให้ใช้งานง่าย
 */

/* Section Header */
.section-header {
    margin-bottom: 3rem;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 1rem;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

.section-subtitle {
    font-size: 1.2rem;
    color: #6c757d;
    margin-bottom: 0;
    font-weight: 400;
}

/* Categories Grid */
.categories-grid {
    margin-top: 2rem;
}

.category-card {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden;
    height: 100%;
    border: 2px solid transparent;
    position: relative;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.category-card:hover::before {
    transform: scaleX(1);
}

.category-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.category-link {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 2rem 1.5rem;
    height: 100%;
    position: relative;
}

.category-link:hover {
    text-decoration: none;
    color: inherit;
}

/* Category Icon */
.category-icon {
    text-align: center;
    margin-bottom: 1.5rem;
    position: relative;
}

.category-icon img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    transition: all 0.3s ease;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.category-card:hover .category-icon img {
    transform: scale(1.1);
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.15));
}

/* Category Content */
.category-content {
    text-align: center;
    margin-bottom: 1rem;
}

.category-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.8rem;
    line-height: 1.4;
    transition: color 0.3s ease;
}

.category-card:hover .category-name {
    color: #667eea;
}

.category-count {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: #6c757d;
    font-size: 0.95rem;
    font-weight: 500;
}

.count-icon {
    display: flex;
    align-items: center;
    opacity: 0.7;
}

.count-icon svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.count-text {
    font-weight: 500;
}

/* Category Arrow */
.category-arrow {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
    color: #667eea;
}

.category-card:hover .category-arrow {
    opacity: 1;
    transform: translateX(0);
}

.category-arrow svg {
    width: 16px;
    height: 16px;
}

/* Show More Button */
.show-more-categories {
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 50px;
    border: 2px solid #667eea;
    color: #667eea;
    background: transparent;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.show-more-categories:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.toggle-icon {
    transition: transform 0.3s ease;
}

.show-more-categories.expanded .toggle-icon {
    transform: rotate(180deg);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .section-title {
        font-size: 2.2rem;
    }
    
    .category-icon img {
        width: 70px;
        height: 70px;
    }
}

@media (max-width: 992px) {
    .section-title {
        font-size: 2rem;
    }
    
    .category-link {
        padding: 1.5rem 1rem;
    }
    
    .category-icon img {
        width: 60px;
        height: 60px;
    }
    
    .category-name {
        font-size: 1.1rem;
    }
}

@media (max-width: 768px) {
    .section-title {
        font-size: 1.8rem;
    }
    
    .section-subtitle {
        font-size: 1rem;
    }
    
    .category-link {
        padding: 1.2rem 0.8rem;
    }
    
    .category-icon img {
        width: 50px;
        height: 50px;
    }
    
    .category-name {
        font-size: 1rem;
    }
    
    .category-count {
        font-size: 0.85rem;
    }
    
    .category-arrow {
        top: 1rem;
        right: 1rem;
    }
}

@media (max-width: 576px) {
    .section-header {
        margin-bottom: 2rem;
    }
    
    .section-title {
        font-size: 1.6rem;
    }
    
    .category-link {
        padding: 1rem 0.6rem;
    }
    
    .category-icon {
        margin-bottom: 1rem;
    }
    
    .category-icon img {
        width: 45px;
        height: 45px;
    }
    
    .category-name {
        font-size: 0.95rem;
        margin-bottom: 0.5rem;
    }
    
    .category-count {
        font-size: 0.8rem;
    }
    
    .show-more-categories {
        padding: 0.8rem 2rem;
        font-size: 1rem;
    }
}

/* Animation for showing/hiding categories */
.category-card.hidden {
    display: none;
}

.category-card.fade-in {
    animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading state */
.category-card.loading {
    pointer-events: none;
    opacity: 0.7;
}

.category-card.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibility improvements */
.category-card:focus-within {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

.category-link:focus {
    outline: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .category-card {
        border: 2px solid #000;
    }
    
    .category-name {
        color: #000;
    }
    
    .category-count {
        color: #333;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .category-card,
    .category-icon img,
    .category-arrow,
    .toggle-icon {
        transition: none;
    }
    
    .category-card:hover {
        transform: none;
    }
    
    .category-card:hover .category-icon img {
        transform: none;
    }
}

/* Print styles */
@media print {
    .category-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .category-arrow {
        display: none;
    }
    
    .show-more-categories {
        display: none;
    }
}