/**
 * Modern Categories Section
 * Enhanced category browsing with card-based layout
 */

/* ========================================================================
   Categories Section Base
   ======================================================================== */

.categories-section-modern {
    padding: 5rem 0 4rem;
    background: linear-gradient(180deg, #f9fafb 0%, #ffffff 50%, #f9fafb 100%);
    position: relative;
    overflow: hidden;
}

.categories-section-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 15% 30%, rgba(124, 58, 237, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 85% 70%, rgba(79, 70, 229, 0.03) 0%, transparent 50%);
    pointer-events: none;
}

/* ========================================================================
   Section Header
   ======================================================================== */

.categories-header {
    max-width: 750px;
    margin: 0 auto 3.5rem;
    text-align: center;
    padding: 0 1rem;
}

/* ========================================================================
   Categories Grid
   ======================================================================== */

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
    position: relative;
    padding: 0 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* ========================================================================
   Category Item
   ======================================================================== */

.category-item {
    position: relative;
}

.category-card {
    display: block;
    background: white;
    border-radius: 16px;
    padding: 2rem 1.5rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid #F3F4F6;
    text-decoration: none;
    height: 100%;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #4F46E5, #7C3AED);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 16px 16px 0 0;
}

.category-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1);
    border-color: #E5E7EB;
    text-decoration: none;
}

.category-card:hover::before {
    opacity: 1;
}

/* ========================================================================
   Decorative Background Patterns
   ======================================================================== */

.category-bg {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    opacity: 0.08;
    transition: all 0.3s ease;
    z-index: 1;
}

.category-card:hover .category-bg {
    transform: scale(1.3) rotate(30deg);
    opacity: 0.12;
}

.category-bg-1 { background: linear-gradient(135deg, #4F46E5, #7C3AED); }
.category-bg-2 { background: linear-gradient(135deg, #10b981, #059669); }
.category-bg-3 { background: linear-gradient(135deg, #f59e0b, #d97706); }
.category-bg-4 { background: linear-gradient(135deg, #ef4444, #dc2626); }
.category-bg-5 { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.category-bg-6 { background: linear-gradient(135deg, #ec4899, #db2777); }

/* ========================================================================
   Category Icon
   ======================================================================== */

.category-icon-wrapper {
    position: relative;
    width: 70px;
    height: 70px;
    margin-bottom: 1.25rem;
    z-index: 2;
}

.category-icon-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    border-radius: 16px;
    opacity: 0.12;
    transition: all 0.3s ease;
}

.category-card:hover .category-icon-bg {
    transform: rotate(8deg) scale(1.08);
    opacity: 0.18;
}

.category-icon {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #F9FAFB 0%, #F3F4F6 100%);
    border-radius: 16px;
    transition: all 0.3s ease;
    z-index: 2;
}

.category-icon i {
    font-size: 2rem;
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all 0.3s ease;
}

.category-card:hover .category-icon {
    transform: scale(1.08);
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
}

.category-card:hover .category-icon i {
    -webkit-text-fill-color: white;
}

/* ========================================================================
   Category Content
   ======================================================================== */

.category-content {
    text-align: center;
    z-index: 2;
    position: relative;
}

.category-name {
    font-size: 1.125rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.875rem;
    line-height: 1.3;
    transition: color 0.3s ease;
    letter-spacing: -0.01em;
}

.category-card:hover .category-name {
    color: #4F46E5;
}

/* ========================================================================
   Category Meta (Mentor Count)
   ======================================================================== */

.category-meta {
    display: flex;
    justify-content: center;
    align-items: center;
}

.mentor-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    background: #F3F4F6;
    border-radius: 50px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #6B7280;
    transition: all 0.3s ease;
}

.mentor-count-badge i {
    font-size: 0.875rem;
    color: #10b981;
}

.category-card:hover .mentor-count-badge {
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    color: white;
    transform: scale(1.05);
}

.category-card:hover .mentor-count-badge i {
    color: white;
}

/* ========================================================================
   Hover Arrow Indicator
   ======================================================================== */

.category-arrow {
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 40px;
    height: 40px;
    background: #f3f4f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
    z-index: 3;
}

.category-arrow i {
    font-size: 1.25rem;
    color: #4F46E5;
}

.category-card:hover .category-arrow {
    opacity: 1;
    transform: translateX(0);
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
}

.category-card:hover .category-arrow i {
    color: white;
}

/* ========================================================================
   Categories CTA
   ======================================================================== */

.categories-cta {
    margin-top: 4rem;
}

.categories-cta .btn-modern-outline {
    padding: 1rem 2.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
    background: white;
    color: #4F46E5;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
}

.categories-cta .btn-modern-outline:hover {
    border-color: #4F46E5;
    background: #4F46E5;
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.3);
}

/* ========================================================================
   Loading State (Optional)
   ======================================================================== */

.category-card.loading {
    pointer-events: none;
}

.category-card.loading .category-icon {
    animation: pulse-loading 1.5s ease-in-out infinite;
}

@keyframes pulse-loading {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ========================================================================
   Empty State
   ======================================================================== */

.categories-grid:empty::after {
    content: 'No categories available';
    display: block;
    text-align: center;
    padding: 3rem;
    color: #9ca3af;
    font-size: 1.125rem;
    grid-column: 1 / -1;
}

/* ========================================================================
   Mobile Responsiveness
   ======================================================================== */

@media (max-width: 1200px) {
    .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1.5rem;
    }
}

@media (max-width: 991px) {
    .categories-section-modern {
        padding: 5rem 0;
    }
    
    .categories-header {
        margin-bottom: 3rem;
    }
    
    .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    }
    
    .category-card {
        padding: 2rem 1.5rem;
        min-height: 200px;
    }
    
    .category-icon-wrapper {
        width: 80px;
        height: 80px;
        margin-bottom: 1.25rem;
    }
    
    .category-icon i {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .categories-section-modern {
        padding: 4rem 0;
    }
    
    .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1.25rem;
    }
    
    .category-card {
        padding: 1.75rem 1.25rem;
        min-height: 180px;
    }
    
    .category-icon-wrapper {
        width: 70px;
        height: 70px;
        margin-bottom: 1rem;
    }
    
    .category-icon i {
        font-size: 1.75rem;
    }
    
    .category-name {
        font-size: 1.125rem;
    }
    
    .mentor-count-badge {
        font-size: 0.8125rem;
        padding: 0.4rem 0.875rem;
    }
    
    .category-arrow {
        width: 35px;
        height: 35px;
        bottom: 1rem;
        right: 1rem;
    }
    
    .category-arrow i {
        font-size: 1.125rem;
    }
}

@media (max-width: 576px) {
    .categories-section-modern {
        padding: 3rem 0;
    }
    
    .categories-header {
        margin-bottom: 2rem;
    }
    
    .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1rem;
    }
    
    .category-card {
        padding: 1.5rem 1rem;
        min-height: 160px;
        border-radius: 16px;
    }
    
    .category-icon-wrapper {
        width: 60px;
        height: 60px;
        margin-bottom: 0.875rem;
    }
    
    .category-icon i {
        font-size: 1.5rem;
    }
    
    .category-icon,
    .category-icon-bg {
        border-radius: 14px;
    }
    
    .category-name {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .mentor-count-badge {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }
    
    .mentor-count-badge i {
        font-size: 0.875rem;
    }
    
    .category-bg {
        width: 80px;
        height: 80px;
        top: -15px;
        right: -15px;
    }
    
    .categories-cta {
        margin-top: 2.5rem;
    }
    
    .categories-cta .btn-modern-outline {
        width: 100%;
        justify-content: center;
        padding: 0.875rem 2rem;
        font-size: 1rem;
    }
}

@media (max-width: 400px) {
    .categories-grid {
        grid-template-columns: 1fr;
    }
    
    .category-card {
        min-height: 150px;
    }
}

/* ========================================================================
   Hover Effects Enhancement
   ======================================================================== */

@media (hover: hover) {
    .category-card::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(135deg, transparent 0%, rgba(79, 70, 229, 0.05) 100%);
        opacity: 0;
        transition: opacity 0.4s ease;
        z-index: 1;
    }
    
    .category-card:hover::after {
        opacity: 1;
    }
}

/* ========================================================================
   Accessibility
   ======================================================================== */

.category-card:focus {
    outline: 3px solid rgba(79, 70, 229, 0.5);
    outline-offset: 2px;
}

.category-card:focus:not(:focus-visible) {
    outline: none;
}

@media (prefers-reduced-motion: reduce) {
    .category-card,
    .category-icon,
    .category-icon-bg,
    .category-bg,
    .category-arrow,
    .mentor-count-badge {
        transition: none;
    }
    
    .category-card:hover {
        transform: none;
    }
}

/* ========================================================================
   Print Styles
   ======================================================================== */

@media print {
    .categories-section-modern {
        padding: 2rem 0;
    }
    
    .category-card {
        box-shadow: none;
        border: 1px solid #e5e7eb;
        page-break-inside: avoid;
    }
    
    .category-arrow,
    .categories-cta {
        display: none;
    }
}

/* ========================================================================
   Dark Mode Support (Optional)
   ======================================================================== */

@media (prefers-color-scheme: dark) {
    .categories-section-modern {
        background: linear-gradient(180deg, #1f2937 0%, #111827 50%, #1f2937 100%);
    }
    
    .category-card {
        background: #1f2937;
        border-color: #374151;
    }
    
    .category-name {
        color: #f9fafb;
    }
    
    .category-icon {
        background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
    }
    
    .mentor-count-badge {
        background: #374151;
        color: #e5e7eb;
    }
    
    .category-arrow {
        background: #374151;
    }
}
