<?php
session_start();
require_once '../config/database.php';
require_once '../includes/functions.php';

$page_title = 'Koolisõidu punktiarvestus';
$page_description = 'Estreka Ratsaklubi koolisõidu punktiarvestuse reeglid ja süsteem.';

// Lisame uue CSS faili
$extra_head_content = '<link rel="stylesheet" href="' . url('assets/css/rules-pages.css') . '">';

include '../includes/header.php';
?>

<main class="rules-main">
    <div class="container">
        <!-- Header -->
        <div class="page-header">
            <div class="page-header-content">
                <div class="breadcrumb">
                    <a href="<?php echo url(); ?>">Avaleht</a>
                    <i class="icon-chevron-right"></i>
                    <span>Koolisõidu reeglid</span>
                </div>
                <h1 class="page-title">
                    <i class="icon-target"></i>
                    Koolisõidu punktiarvestus
                </h1>
                <p class="page-subtitle">
                    Täielik ülevaade koolisõidu punktiarvestuse süsteemist ja reeglitest
                </p>
            </div>
            <div class="discipline-badge koolisoit">
                <i class="icon-target"></i>
                <span>Koolisõit</span>
            </div>
        </div>

        <!-- Quick Summary -->
        <div class="summary-card">
            <div class="summary-header">
                <h2>Kokkuvõte</h2>
                <div class="summary-highlight">Arvestatakse <strong>6 parimat tulemust</strong></div>
            </div>
            <div class="summary-content">
                <div class="summary-grid">
                    <div class="summary-item">
                        <div class="summary-number">3</div>
                        <div class="summary-label">Punktikomponenti</div>
                        <div class="summary-detail">Protsent + Skeem + Koht</div>
                    </div>
                    <div class="summary-item">
                        <div class="summary-number">70%+</div>
                        <div class="summary-label">Maksimum baaspunkte</div>
                        <div class="summary-detail">12 baaspunkti</div>
                    </div>
                    <div class="summary-item">
                        <div class="summary-number">L</div>
                        <div class="summary-label">Kõrgeim skeem</div>
                        <div class="summary-detail">+3 boonuspunkti</div>
                    </div>
                </div>
            </div>
        </div>

        <!-- Detailed Rules -->
        <div class="rules-grid">
            <!-- Protsendipõhised baaspunktid -->
            <div class="rules-card">
                <div class="card-header">
                    <h3>
                        <i class="icon-activity"></i>
                        Protsendipõhised baaspunktid
                    </h3>
                    <p>Põhipunktid tulemuse protsendi järgi</p>
                </div>
                <div class="card-content">
                    <div class="points-table">
                        <div class="points-row high-points">
                            <div class="percentage">70%+</div>
                            <div class="points">12 punkti</div>
                            <div class="grade">Suurepärane</div>
                        </div>
                        <div class="points-row">
                            <div class="percentage">68-69,99%</div>
                            <div class="points">10 punkti</div>
                            <div class="grade">Väga hea</div>
                        </div>
                        <div class="points-row">
                            <div class="percentage">65-67,99%</div>
                            <div class="points">8 punkti</div>
                            <div class="grade">Hea</div>
                        </div>
                        <div class="points-row">
                            <div class="percentage">62-64,99%</div>
                            <div class="points">6 punkti</div>
                            <div class="grade">Rahuldav</div>
                        </div>
                        <div class="points-row">
                            <div class="percentage">60-61,99%</div>
                            <div class="points">5 punkti</div>
                            <div class="grade">Nõrk</div>
                        </div>
                        <div class="points-row">
                            <div class="percentage">58-59,99%</div>
                            <div class="points">4 punkti</div>
                            <div class="grade">Halb</div>
                        </div>
                        <div class="points-row">
                            <div class="percentage">55-57,99%</div>
                            <div class="points">3 punkti</div>
                            <div class="grade">Väga halb</div>
                        </div>
                        <div class="points-row">
                            <div class="percentage">50-54,99%</div>
                            <div class="points">2 punkti</div>
                            <div class="grade">Ebapiisav</div>
                        </div>
                        <div class="points-row low-points">
                            <div class="percentage">Alla 50%</div>
                            <div class="points">1 punkt</div>
                            <div class="grade">Madal</div>
                        </div>
                        <div class="points-row participation">
                            <div class="percentage">Osalemine</div>
                            <div class="points">0,5 punkti</div>
                            <div class="grade">Mitte välja langemine</div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Skeemi raskusastme boonuspunktid -->
            <div class="rules-card">
                <div class="card-header">
                    <h3>
                        <i class="icon-star"></i>
                        Skeemi raskusastme boonuspunktid
                    </h3>
                    <p>Lisapunktid skeemi keerukuse eest</p>
                </div>
                <div class="card-content">
                    <div class="bonus-grid">
                        <div class="bonus-item highest">
                            <div class="scheme-level">L skeemid</div>
                            <div class="scheme-desc">(kõige raskiem)</div>
                            <div class="bonus-points">+3 punkti</div>
                        </div>
                        <div class="bonus-item high">
                            <div class="scheme-level">A skeemid</div>
                            <div class="scheme-desc">(keskmine)</div>
                            <div class="bonus-points">+2 punkti</div>
                        </div>
                        <div class="bonus-item medium">
                            <div class="scheme-level">ABC skeemid</div>
                            <div class="scheme-desc">(lihtne)</div>
                            <div class="bonus-points">+1 punkt</div>
                        </div>
                        <div class="bonus-item medium">
                            <div class="scheme-level">NH4A skeemid</div>
                            <div class="scheme-desc">(noorhobuste skeem)</div>
                            <div class="bonus-points">+1 punkt</div>
                        </div>
                        <div class="bonus-item basic">
                            <div class="scheme-level">ST skeemid</div>
                            <div class="scheme-desc">(kõige kergem)</div>
                            <div class="bonus-points">+0 punkti</div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Koha järgi boonuspunktid -->
            <div class="rules-card">
                <div class="card-header">
                    <h3>
                        <i class="icon-trophy"></i>
                        Koha järgi boonuspunktid
                    </h3>
                    <p>Lisapunktid võistluse lõppkoha eest</p>
                </div>
                <div class="card-content">
                    <div class="placement-grid">
                        <div class="placement-item gold">
                            <div class="placement-rank">
                                <i class="icon-medal"></i>
                                1. koht
                            </div>
                            <div class="placement-points">+5 punkti</div>
                        </div>
                        <div class="placement-item silver">
                            <div class="placement-rank">
                                <i class="icon-medal"></i>
                                2. koht
                            </div>
                            <div class="placement-points">+4 punkti</div>
                        </div>
                        <div class="placement-item bronze">
                            <div class="placement-rank">
                                <i class="icon-medal"></i>
                                3. koht
                            </div>
                            <div class="placement-points">+3 punkti</div>
                        </div>
                        <div class="placement-item">
                            <div class="placement-rank">4. koht</div>
                            <div class="placement-points">+2 punkti</div>
                        </div>
                        <div class="placement-item">
                            <div class="placement-rank">5. koht</div>
                            <div class="placement-points">+1 punkt</div>
                        </div>
                    </div>
                    <div class="placement-note">
                        <i class="icon-info"></i>
                        <span>6. koht ja edasi ei anna lisapunkte</span>
                    </div>
                </div>
            </div>
        </div>

        <!-- Example Calculation -->
        <div class="example-section">
            <h2>
                <i class="icon-calculator"></i>
                Näide punktide arvutamisest
            </h2>
            
            <div class="example-cards">
                <div class="example-card">
                    <div class="example-header">
                        <h4>Näide 1: Suurepärane tulemus</h4>
                        <div class="example-total">Kokku: 20 punkti</div>
                    </div>
                    <div class="example-breakdown">
                        <div class="breakdown-item">
                            <span class="breakdown-label">Tulemus:</span>
                            <span class="breakdown-value">72% → 12 punkti</span>
                        </div>
                        <div class="breakdown-item">
                            <span class="breakdown-label">Skeem:</span>
                            <span class="breakdown-value">L-skeem → +3 punkti</span>
                        </div>
                        <div class="breakdown-item">
                            <span class="breakdown-label">Koht:</span>
                            <span class="breakdown-value">1. koht → +5 punkti</span>
                        </div>
                    </div>
                </div>

                <div class="example-card">
                    <div class="example-header">
                        <h4>Näide 2: Keskmine tulemus</h4>
                        <div class="example-total">Kokku: 11 punkti</div>
                    </div>
                    <div class="example-breakdown">
                        <div class="breakdown-item">
                            <span class="breakdown-label">Tulemus:</span>
                            <span class="breakdown-value">63% → 6 punkti</span>
                        </div>
                        <div class="breakdown-item">
                            <span class="breakdown-label">Skeem:</span>
                            <span class="breakdown-value">A-skeem → +2 punkti</span>
                        </div>
                        <div class="breakdown-item">
                            <span class="breakdown-label">Koht:</span>
                            <span class="breakdown-value">3. koht → +3 punkti</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- Season Rules -->
        <div class="season-rules">
            <div class="rules-card highlight">
                <div class="card-header">
                    <h3>
                        <i class="icon-calendar"></i>
                        Hooaja arvestus
                    </h3>
                </div>
                <div class="card-content">
                    <div class="season-info">
                        <div class="season-highlight">
                            <div class="highlight-number">6</div>
                            <div class="highlight-text">
                                <strong>Parimat tulemust</strong><br>
                                arvestatakse hooaja punktiarvestuses
                            </div>
                        </div>
                        <div class="season-details">
                            <ul>
                                <li>Sportlane võib osaleda rohkematel võistlustel</li>
                                <li>Hooaja lõpus arvestatakse ainult 6 kõrgeimat punktisummat</li>
                                <li>Iga osalemine annab vähemalt 0,5 punkti</li>
                                <li>Punktid liidetakse kokku vanusegruppide kaupa</li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- Navigation -->
        <div class="page-navigation">
            <div class="nav-grid">
                <a href="<?php echo url(); ?>" class="nav-card back">
                    <i class="icon-arrow-left"></i>
                    <div class="nav-content">
                        <h4>Tagasi avalehele</h4>
                        <p>Vaata üldist ülevaadet</p>
                    </div>
                </a>
                
                <a href="<?php echo url('public/jumping-rules.php'); ?>" class="nav-card next">
                    <div class="nav-content">
                        <h4>Takistussõidu reeglid</h4>
                        <p>Vaata järgmist distsipliini</p>
                    </div>
                    <i class="icon-arrow-right"></i>
                </a>
                
                <a href="<?php echo url('public/rankings.php'); ?>" class="nav-card rankings">
                    <i class="icon-list"></i>
                    <div class="nav-content">
                        <h4>Hooaja tabelid</h4>
                        <p>Vaata praeguseid tulemusi</p>
                    </div>
                </a>
            </div>
        </div>
    </div>
</main>

<?php include '../includes/footer.php'; ?>