/*!
 * Custom Content Sections Styles
 * Comprehensive CSS for all custom section templates
 */

/* =================================
   BASE STYLES
   ================================= */

.custom-content-section {
    position: relative;
    overflow: hidden;
}

.custom-content-section .container {
    padding-left: 15px;
    padding-right: 15px;
}

.custom-content-section.full-width {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
}

/* Theme Colors - Updated to match main event page design system */
.custom-content-section.theme-primary {
    --section-color: var(--primary-color, #2563eb);
    --section-bg: var(--primary-color, #2563eb);
    --section-text: var(--white, #ffffff);
}

.custom-content-section.theme-success {
    --section-color: var(--success-color, #10b981);
    --section-bg: var(--success-color, #10b981);
    --section-text: var(--white, #ffffff);
}

.custom-content-section.theme-warning {
    --section-color: var(--warning-color, #f59e0b);
    --section-bg: var(--warning-color, #f59e0b);
    --section-text: var(--gray-900, #111827);
}

.custom-content-section.theme-danger {
    --section-color: var(--danger-color, #ef4444);
    --section-bg: var(--danger-color, #ef4444);
    --section-text: var(--white, #ffffff);
}

.custom-content-section.theme-info {
    --section-color: var(--info-color, #3b82f6);
    --section-bg: var(--info-color, #3b82f6);
    --section-text: var(--white, #ffffff);
}

.custom-content-section.theme-light {
    --section-color: var(--gray-100, #f3f4f6);
    --section-bg: var(--gray-100, #f3f4f6);
    --section-text: var(--gray-900, #111827);
}

.custom-content-section.theme-dark {
    --section-color: var(--gray-800, #1f2937);
    --section-bg: var(--gray-800, #1f2937);
    --section-text: var(--white, #ffffff);
}

/* =================================
   SECTION TYPE SPECIFIC STYLES
   ================================= */

/* Info Card Section */
.section-info-card .card {
    border: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.section-info-card .card:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

/* Feature Highlight Section */
.section-feature-highlight .alert {
    border-left: 5px solid var(--section-color, var(--bs-info));
    font-size: 1.1rem;
    line-height: 1.6;
}

.section-feature-highlight .alert-heading {
    font-weight: 700;
    margin-bottom: 1rem;
}

/* Race Info Section - Modern Design */
.section-race-info {
    margin-bottom: 3rem;
}

.race-info-card {
    border: none;
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
    transition: all 0.3s ease;
    overflow: hidden;
}

.race-info-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 60px rgba(0,0,0,0.18);
}

/* Header Section with Gradient - Updated to match design system */
.race-header {
    background: linear-gradient(135deg, var(--primary-color, #2563eb) 0%, var(--secondary-color, #7c3aed) 100%);
    position: relative;
    overflow: hidden;
}

.race-header-overlay {
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, transparent 50%, rgba(255,255,255,0.05) 100%);
}

.race-badge .badge {
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.race-header h2 {
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
    font-weight: 700;
}

.race-header .lead {
    text-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

/* Stats Panel */
.race-body .bg-light {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
}

.race-stats .stat-item {
    transition: all 0.3s ease;
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 1rem;
}

.race-stats .stat-item:hover {
    background: rgba(255,255,255,0.8);
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.race-stats .stat-icon {
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.race-stats .stat-label {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.75rem;
}

.race-stats .stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

/* Features Panel */
.feature-item {
    transition: all 0.3s ease;
    border: 1px solid rgba(0,0,0,0.08);
}

.feature-item:hover {
    background: rgba(255,255,255,0.9) !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

.feature-item h6 {
    color: #2c3e50;
    font-weight: 600;
}

.feature-item small {
    line-height: 1.4;
}

/* Race Image */
.race-image img {
    transition: all 0.3s ease;
    border: 3px solid rgba(255,255,255,0.8);
}

.race-image:hover img {
    transform: scale(1.02);
}

/* Pricing Section */
.race-pricing {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-top: 1px solid rgba(0,0,0,0.08);
}

.pricing-badge {
    background: rgba(255,255,255,0.9);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    text-align: center;
}

.price-main {
    display: flex;
    align-items: baseline;
    justify-content: center;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.price-currency {
    font-size: 1.2rem;
    margin-right: 0.25rem;
}

.price-amount {
    font-size: 2.5rem;
    line-height: 1;
}

.price-period {
    font-size: 0.9rem;
    margin-left: 0.25rem;
    color: #6c757d;
}

.price-note {
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* Action Buttons */
.race-actions {
    background: rgba(248,249,250,0.5);
}

.race-actions .btn {
    border-radius: 8px;
    font-weight: 600;
    letter-spacing: 0.3px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.race-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.race-actions .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.race-actions .btn-outline-primary {
    border: 2px solid #667eea;
    color: #667eea;
}

.race-actions .btn-outline-primary:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
}

/* Image + Text Section */
.section-image-text .card {
    border: none;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    overflow: hidden;
}

.section-image-text .row.g-0 > div:first-child img {
    transition: transform 0.3s ease;
}

.section-image-text:hover .row.g-0 > div:first-child img {
    transform: scale(1.05);
}

/* Text Block Section */
.section-text-block {
    font-size: 1.05rem;
    line-height: 1.7;
}

.section-text-block h3 {
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.75rem;
}

.section-text-block h3:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 3px;
    background: var(--bs-primary);
    border-radius: 2px;
}

/* Stats Grid Section */
.section-stats-grid .card {
    border: none;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
}

.section-stats-grid .stats-content {
    margin: 2rem 0;
}

.section-stats-grid .stat-item {
    background: white;
    border-radius: 12px;
    padding: 2rem 1.5rem;
    text-align: center;
    box-shadow: 0 3px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.section-stats-grid .stat-item:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--bs-primary);
}

.section-stats-grid .stat-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
}

.section-stats-grid .stat-number {
    font-size: 3rem;
    font-weight: 800;
    color: var(--bs-primary);
    margin-bottom: 0.5rem;
    line-height: 1;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.section-stats-grid .stat-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 0.5rem;
}

.section-stats-grid .stat-description {
    font-size: 0.9rem;
    color: #8a8a8a;
    line-height: 1.4;
}

/* Download Section */
.section-download-section .card {
    border: none;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
}

.section-download-section .download-item {
    background: white;
    border: 2px dashed #e0e0e0;
    transition: all 0.3s ease;
    position: relative;
}

.section-download-section .download-item:hover {
    border-color: var(--bs-primary);
    border-style: solid;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transform: translateY(-3px);
}

.section-download-section .download-icon i {
    transition: all 0.3s ease;
}

.section-download-section .download-item:hover .download-icon i {
    transform: scale(1.1);
    color: var(--bs-primary) !important;
}

.section-download-section .download-title {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.75rem;
}

/* Callout Box Section */
.section-callout-box {
    position: relative;
    padding: 2rem;
    margin: 2rem 0;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--section-bg, #f8f9fa) 0%, rgba(255,255,255,0.9) 100%);
    border-left: 5px solid var(--section-color, var(--bs-primary));
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
}

.section-callout-box:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 0%, rgba(255,255,255,0.1) 100%);
    pointer-events: none;
    border-radius: 12px;
}

/* =================================
   RESPONSIVE DESIGN
   ================================= */

@media (max-width: 768px) {
    .custom-content-section.d-none.d-md-block {
        display: none !important;
    }
    
    /* Race Info Mobile Adjustments */
    .race-header {
        padding: 2rem 1.5rem !important;
    }
    
    .race-header h2 {
        font-size: 1.8rem !important;
    }
    
    .race-badge .badge {
        font-size: 0.7rem;
        padding: 0.5rem 1rem !important;
    }
    
    .race-stats .stat-item {
        padding: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .race-stats .stat-icon {
        width: 45px;
        height: 45px;
    }
    
    .race-stats .stat-icon i {
        font-size: 1.2rem !important;
    }
    
    .feature-item {
        padding: 1.5rem !important;
        margin-bottom: 1rem;
    }
    
    .price-amount {
        font-size: 2rem !important;
    }
    
    .pricing-badge {
        padding: 1rem !important;
    }
    
    .race-actions .btn {
        padding: 0.75rem 1.5rem !important;
        font-size: 0.9rem;
        margin-bottom: 0.75rem;
    }
    
    .section-stats-grid .stat-number {
        font-size: 2.5rem;
    }
    
    .section-stats-grid .stat-item {
        padding: 1.5rem 1rem;
        margin-bottom: 1rem;
    }
    
    .section-image-text .row.g-0 > div img {
        height: 250px !important;
    }
    
    .section-download-section .download-item {
        margin-bottom: 1rem;
    }
}

@media (max-width: 576px) {
    .custom-content-section .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    /* Race Info Extra Small Screens */
    .race-header {
        padding: 1.5rem 1rem !important;
    }
    
    .race-header h2 {
        font-size: 1.5rem !important;
    }
    
    .race-badge .badge {
        font-size: 0.65rem;
        padding: 0.4rem 0.8rem !important;
    }
    
    .race-stats {
        padding: 1.5rem !important;
    }
    
    .race-stats .stat-item {
        padding: 0.75rem;
        margin-bottom: 0.5rem;
    }
    
    .race-stats .stat-icon {
        width: 40px;
        height: 40px;
    }
    
    .race-stats .stat-icon i {
        font-size: 1rem !important;
    }
    
    .race-stats .stat-value {
        font-size: 1rem;
    }
    
    .feature-item {
        padding: 1rem !important;
        margin-bottom: 0.75rem;
    }
    
    .feature-item h6 {
        font-size: 0.9rem;
    }
    
    .price-amount {
        font-size: 1.75rem !important;
    }
    
    .pricing-badge {
        padding: 0.75rem !important;
    }
    
    .race-actions {
        padding: 1rem !important;
    }
    
    .race-actions .btn {
        padding: 0.6rem 1.25rem !important;
        font-size: 0.85rem;
        margin-bottom: 0.5rem;
    }
    
    .section-stats-grid .stat-number {
        font-size: 2rem;
    }
    
    .section-feature-highlight .alert {
        font-size: 1rem;
        padding: 1rem;
    }
}

/* =================================
   ANIMATIONS AND EFFECTS
   ================================= */

/* Fade in animation for sections */
.custom-content-section {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger animation for multiple sections */
.custom-content-section:nth-child(2) { animation-delay: 0.1s; }
.custom-content-section:nth-child(3) { animation-delay: 0.2s; }
.custom-content-section:nth-child(4) { animation-delay: 0.3s; }
.custom-content-section:nth-child(5) { animation-delay: 0.4s; }

/* Loading skeleton animation for sections */
.custom-section-loading {
    background: linear-gradient(90deg, #f0f0f0 25%, transparent 37%, #f0f0f0 63%);
    background-size: 400% 100%;
    animation: loading 1.4s ease-in-out infinite;
    height: 200px;
    border-radius: 8px;
    margin-bottom: 2rem;
}

@keyframes loading {
    0% { background-position: 100% 50%; }
    100% { background-position: -100% 50%; }
}

/* Hover effects for buttons */
.custom-content-section .btn {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.custom-content-section .btn:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.custom-content-section .btn:hover:before {
    left: 100%;
}

/* Parallax effect for background images */
.custom-content-section[data-bg-parallax] {
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

@media (max-width: 768px) {
    .custom-content-section[data-bg-parallax] {
        background-attachment: scroll;
    }
}

/* =================================
   ACCESSIBILITY
   ================================= */

/* Focus styles */
.custom-content-section .btn:focus,
.custom-content-section a:focus {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .custom-content-section .card {
        border: 2px solid #000;
    }
    
    .section-stats-grid .stat-item {
        border: 2px solid #000;
    }
    
    .section-download-section .download-item {
        border: 2px solid #000;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .custom-content-section,
    .custom-content-section * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* =================================
   UTILITY CLASSES
   ================================= */

/* Section spacing utilities */
.custom-section-spacing-sm { margin-bottom: 2rem; }
.custom-section-spacing-md { margin-bottom: 3rem; }
.custom-section-spacing-lg { margin-bottom: 4rem; }

/* Text utilities for sections */
.custom-section-text-center { text-align: center; }
.custom-section-text-left { text-align: left; }
.custom-section-text-right { text-align: right; }

/* Background utilities */
.custom-section-bg-light { background-color: #f8f9fa; }
.custom-section-bg-primary { background-color: var(--bs-primary); color: white; }
.custom-section-bg-gradient { 
    background: linear-gradient(135deg, var(--bs-primary) 0%, var(--bs-secondary) 100%); 
    color: white; 
}

/* Bootstrap gradient utility classes for race info */
.bg-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
}

.bg-gradient-light {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%) !important;
}

/* Section borders */
.custom-section-border-top { border-top: 4px solid var(--bs-primary); }
.custom-section-border-left { border-left: 4px solid var(--bs-primary); }
.custom-section-border-bottom { border-bottom: 4px solid var(--bs-primary); }

/* Shadow utilities */
.custom-section-shadow-sm { box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.custom-section-shadow-md { box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
.custom-section-shadow-lg { box-shadow: 0 10px 25px rgba(0,0,0,0.15); }

/* Rounded corners */
.custom-section-rounded { border-radius: 8px; }
.custom-section-rounded-lg { border-radius: 16px; }

/* =================================
   DARK MODE SUPPORT
   ================================= */

@media (prefers-color-scheme: dark) {
    .custom-content-section {
        --section-bg-light: #2d3748;
        --section-text-muted: #a0aec0;
        --section-border-color: #4a5568;
    }
    
    .section-stats-grid .stat-item {
        background: #2d3748;
        color: white;
        border-color: #4a5568;
    }
    
    .section-download-section .download-item {
        background: #2d3748;
        color: white;
        border-color: #4a5568;
    }
    
    .custom-section-bg-light {
        background-color: var(--section-bg-light) !important;
        color: white;
    }
}

/* =================================
   PERFORMANCE OPTIMIZATIONS
   ================================= */

/* GPU acceleration for animations */
.custom-content-section,
.section-stats-grid .stat-item,
.section-download-section .download-item {
    will-change: transform;
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Lazy loading for images */
.custom-content-section img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.custom-content-section img[loading="lazy"].loaded {
    opacity: 1;
}

/* =================================
   PRINT STYLES
   ================================= */

@media print {
    .custom-content-section {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    .custom-content-section .btn {
        display: none;
    }
    
    .section-stats-grid .stat-item {
        border: 1px solid #ccc;
        box-shadow: none;
    }
    
    /* Print-specific styling */
    .custom-content-section {
        margin-bottom: 1rem !important;
    }
    
    .section-race-info .card-body {
        padding: 1rem !important;
    }
}

/* =================================
   SECTION-SPECIFIC ENHANCEMENTS
   ================================= */

/* Enhanced race info section */
.section-race-info .race-highlight {
    background: linear-gradient(135deg, #e8f5e8 0%, #f0fff0 100%);
    border-left: 4px solid #28a745;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 0 8px 8px 0;
}

/* Interactive timeline items */
.section-timeline-item .timeline-dot {
    cursor: pointer;
    transition: all 0.3s ease;
}

.section-timeline-item .timeline-dot:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* Enhanced video embed section */
.section-video-embed .video-container {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

/* Contact info section enhancements */
.section-contact-info .contact-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    margin: 0.5rem 0;
    background: #f8f9fa;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.section-contact-info .contact-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.section-contact-info .contact-item i {
    margin-right: 1rem;
    width: 24px;
    text-align: center;
}