/**
 * Tutor Courses Grid - Frontend Styles
 * Design: Dark mode with purple accents
 */

/* Reset and base */
.tcg-wrapper {
    --tcg-bg: #1a1a2e;
    --tcg-card-bg: #16213e;
    --tcg-text: #ffffff;
    --tcg-text-secondary: #a0a0a0;
    --tcg-price: #9b59b6;
    --tcg-button-bg: #9b59b6;
    --tcg-button-text: #ffffff;
    --tcg-button-hover: #8e44ad;
    --tcg-radius: 12px;
    --tcg-image-height: 200px;
    --tcg-gap: 24px;
    --tcg-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    padding: 40px 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    box-sizing: border-box;
}

.tcg-wrapper *,
.tcg-wrapper *::before,
.tcg-wrapper *::after {
    box-sizing: border-box;
}

/* Grid Layout */
.tcg-grid {
    display: grid;
    gap: var(--tcg-gap);
    max-width: 1400px;
    margin: 0 auto;
}

.tcg-cols-2 { grid-template-columns: repeat(2, 1fr); }
.tcg-cols-3 { grid-template-columns: repeat(3, 1fr); }
.tcg-cols-4 { grid-template-columns: repeat(4, 1fr); }
.tcg-cols-5 { grid-template-columns: repeat(5, 1fr); }
.tcg-cols-6 { grid-template-columns: repeat(6, 1fr); }

/* Card Styles */
.tcg-card {
    background-color: var(--tcg-card-bg);
    border-radius: var(--tcg-radius);
    overflow: hidden;
    transition: var(--tcg-transition);
    display: flex;
    flex-direction: column;
    position: relative;
}

.tcg-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* Card Image Link */
.tcg-card-image-link {
    display: block;
    text-decoration: none;
    cursor: pointer;
}

/* Card Image */
.tcg-card-image {
    position: relative;
    width: 100%;
    height: var(--tcg-image-height);
    overflow: hidden;
    background: linear-gradient(135deg, var(--tcg-card-bg) 0%, rgba(0,0,0,0.3) 100%);
}

.tcg-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--tcg-transition);
}

.tcg-card:hover .tcg-card-image img {
    transform: scale(1.08);
}

.tcg-placeholder-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--tcg-card-bg) 0%, rgba(155, 89, 182, 0.2) 100%);
}

.tcg-placeholder-image svg {
    width: 60px;
    height: 60px;
    color: var(--tcg-text-secondary);
    opacity: 0.5;
}

/* Card Content */
.tcg-card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* Card Title Link */
.tcg-card-title-link {
    text-decoration: none;
    display: block;
}

.tcg-card-title-link:hover .tcg-card-title {
    color: var(--tcg-price);
}

.tcg-card-title {
    color: var(--tcg-text);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 8px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: var(--tcg-transition);
}

.tcg-card-instructor {
    color: var(--tcg-text-secondary);
    font-size: 0.85rem;
    margin: 0 0 8px 0;
}

.tcg-card-price {
    color: var(--tcg-price);
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 16px 0;
}

/* WooCommerce Price Compatibility */
.tcg-card-price .woocommerce-Price-amount,
.tcg-card-price .amount {
    color: var(--tcg-price);
    font-size: inherit;
    font-weight: inherit;
}

.tcg-card-price .woocommerce-Price-currencySymbol {
    font-size: 0.85em;
    margin-right: 2px;
}

.tcg-card-price del {
    opacity: 0.5;
    margin-right: 8px;
    font-size: 0.9em;
}

.tcg-card-price ins {
    text-decoration: none;
}

/* Button */
.tcg-card-button {
    display: block;
    width: 100%;
    padding: 14px 20px;
    background: var(--tcg-button-bg);
    color: var(--tcg-button-text);
    text-align: center;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-radius: calc(var(--tcg-radius) - 4px);
    transition: var(--tcg-transition);
    margin-top: auto;
    border: none;
    cursor: pointer;
}

.tcg-card-button:hover {
    background: var(--tcg-button-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(155, 89, 182, 0.4);
    color: var(--tcg-button-text);
    text-decoration: none;
}

.tcg-card-button:active {
    transform: translateY(0);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .tcg-cols-5,
    .tcg-cols-6 {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 992px) {
    .tcg-cols-4,
    .tcg-cols-5,
    .tcg-cols-6 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .tcg-wrapper {
        padding: 30px 15px;
    }
}

@media (max-width: 768px) {
    .tcg-cols-3,
    .tcg-cols-4,
    .tcg-cols-5,
    .tcg-cols-6 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tcg-grid {
        gap: 16px;
    }
    
    .tcg-card-content {
        padding: 16px;
    }
    
    .tcg-card-title {
        font-size: 0.95rem;
    }
    
    .tcg-card-button {
        padding: 12px 16px;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .tcg-cols-2,
    .tcg-cols-3,
    .tcg-cols-4,
    .tcg-cols-5,
    .tcg-cols-6 {
        grid-template-columns: 1fr;
    }
    
    .tcg-wrapper {
        padding: 20px 12px;
    }
    
    .tcg-card:hover {
        transform: translateY(-4px);
    }
}

/* Animation on Load */
@keyframes tcgFadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tcg-card {
    animation: tcgFadeInUp 0.5s ease-out forwards;
    opacity: 0;
}

.tcg-card:nth-child(1) { animation-delay: 0.05s; }
.tcg-card:nth-child(2) { animation-delay: 0.1s; }
.tcg-card:nth-child(3) { animation-delay: 0.15s; }
.tcg-card:nth-child(4) { animation-delay: 0.2s; }
.tcg-card:nth-child(5) { animation-delay: 0.25s; }
.tcg-card:nth-child(6) { animation-delay: 0.3s; }
.tcg-card:nth-child(7) { animation-delay: 0.35s; }
.tcg-card:nth-child(8) { animation-delay: 0.4s; }
.tcg-card:nth-child(n+9) { animation-delay: 0.45s; }

/* Badge Support (optional) */
.tcg-card-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--tcg-price);
    color: #fff;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    z-index: 2;
}

/* Rating Support (optional) */
.tcg-card-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #ffc107;
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.tcg-card-rating svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.tcg-card-rating span {
    color: var(--tcg-text-secondary);
    margin-left: 4px;
}

/* Loading State */
.tcg-loading {
    display: flex;
    justify-content: center;
    padding: 60px 20px;
}

.tcg-loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 3px solid var(--tcg-card-bg);
    border-top-color: var(--tcg-price);
    border-radius: 50%;
    animation: tcgSpin 0.8s linear infinite;
}

@keyframes tcgSpin {
    to { transform: rotate(360deg); }
}

/* No Results */
.tcg-no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--tcg-text-secondary);
}

.tcg-no-results svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}
