{% extends "base.html" %}

{% block title %}Confirm Your Character - Code of Conquest{% endblock %}

{% block content %}
<div class="creation-container">
    <!-- Progress Indicator -->
    <div class="creation-progress">
        <div class="progress-step completed">
            <div class="step-number">✓</div>
            <div class="step-label">Origin</div>
        </div>
        <div class="progress-line"></div>
        <div class="progress-step completed">
            <div class="step-number">✓</div>
            <div class="step-label">Class</div>
        </div>
        <div class="progress-line"></div>
        <div class="progress-step completed">
            <div class="step-number">✓</div>
            <div class="step-label">Customize</div>
        </div>
        <div class="progress-line"></div>
        <div class="progress-step active">
            <div class="step-number">4</div>
            <div class="step-label">Confirm</div>
        </div>
    </div>

    <!-- Page Header -->
    <h1 class="page-title">Your Hero Awaits</h1>
    <p class="page-subtitle">Review your character and begin your adventure</p>

    <div class="decorative-line"></div>

    <!-- Character Summary Card -->
    <div class="confirm-card">
        <!-- Character Header -->
        <div class="character-header">
            <div class="character-name-display">
                <span class="name-label">Hero Name:</span>
                <h2 class="character-name">{{ character_name }}</h2>
            </div>
            <div class="character-class-origin">
                <span class="class-badge">{{ player_class.name }}</span>
                <span class="origin-badge">{{ origin.name }}</span>
            </div>
        </div>

        <div class="decorative-line"></div>

        <!-- Two Column Layout -->
        <div class="confirm-content">
            <!-- Left Column: Character Details -->
            <div class="details-column">
                <!-- Origin Story -->
                <div class="detail-section">
                    <h3 class="section-title">Your Origin</h3>
                    <p class="origin-story">{{ origin.description }}</p>
                </div>

                <!-- Starting Location -->
                <div class="detail-section">
                    <h3 class="section-title">Starting Location</h3>
                    <div class="location-info">
                        <div class="location-name">{{ origin.starting_location.name }}</div>
                        <p class="location-description">{{ origin.starting_location.description }}</p>
                    </div>
                </div>

                <!-- Starting Bonus -->
                {% if origin.starting_bonus %}
                <div class="detail-section">
                    <h3 class="section-title">Starting Bonus</h3>
                    <div class="bonus-item">
                        <span class="bonus-icon">✨</span>
                        <div>
                            <div class="bonus-text"><strong>{{ origin.starting_bonus.trait }}</strong></div>
                            <div class="bonus-description">{{ origin.starting_bonus.description }}</div>
                            <div class="bonus-effect">Effect: {{ origin.starting_bonus.effect }}</div>
                        </div>
                    </div>
                </div>
                {% endif %}
            </div>

            <!-- Right Column: Class & Stats -->
            <div class="stats-column">
                <!-- Class Info -->
                <div class="detail-section">
                    <h3 class="section-title">{{ player_class.name }}</h3>
                    <p class="class-description">{{ player_class.description }}</p>
                </div>

                <!-- Base Stats -->
                <div class="detail-section">
                    <h3 class="section-title">Base Attributes</h3>
                    <div class="stats-grid">
                        <div class="stat-box">
                            <div class="stat-name">Strength</div>
                            <div class="stat-value">{{ player_class.base_stats.strength }}</div>
                        </div>
                        <div class="stat-box">
                            <div class="stat-name">Dexterity</div>
                            <div class="stat-value">{{ player_class.base_stats.dexterity }}</div>
                        </div>
                        <div class="stat-box">
                            <div class="stat-name">Constitution</div>
                            <div class="stat-value">{{ player_class.base_stats.constitution }}</div>
                        </div>
                        <div class="stat-box">
                            <div class="stat-name">Intelligence</div>
                            <div class="stat-value">{{ player_class.base_stats.intelligence }}</div>
                        </div>
                        <div class="stat-box">
                            <div class="stat-name">Wisdom</div>
                            <div class="stat-value">{{ player_class.base_stats.wisdom }}</div>
                        </div>
                        <div class="stat-box">
                            <div class="stat-name">Charisma</div>
                            <div class="stat-value">{{ player_class.base_stats.charisma }}</div>
                        </div>
                    </div>
                </div>

                <!-- Skill Trees -->
                <div class="detail-section">
                    <h3 class="section-title">Available Specializations</h3>
                    <p class="spec-note">Choose your path as you level up</p>
                    <div class="tree-list">
                        {% for tree in player_class.skill_trees %}
                        <div class="tree-preview">
                            <div class="tree-header">
                                <span class="tree-icon">🌲</span>
                                <span class="tree-name">{{ tree.name if tree is mapping else tree }}</span>
                            </div>
                        </div>
                        {% endfor %}
                    </div>
                </div>

                <!-- Starting Equipment -->
                {% if player_class.starting_equipment %}
                <div class="detail-section">
                    <h3 class="section-title">Starting Equipment</h3>
                    <div class="gear-list">
                        {% for item_id in player_class.starting_equipment %}
                        <div class="gear-item">⚔️ {{ item_id|replace('_', ' ')|title }}</div>
                        {% endfor %}
                    </div>
                </div>
                {% endif %}
            </div>
        </div>

        <div class="decorative-line"></div>

        <!-- Final Confirmation -->
        <div class="confirmation-section">
            <div class="warning-box">
                <div class="warning-icon">⚠️</div>
                <div class="warning-content">
                    <strong>Ready to begin?</strong>
                    <p>Once created, your character's class and origin cannot be changed. You can create additional characters based on your subscription tier.</p>
                </div>
            </div>

            <form method="POST" action="{{ url_for('character_views.create_confirm') }}" id="confirm-form">
                <!-- Navigation Buttons -->
                <div class="creation-nav">
                    <a href="{{ url_for('character_views.create_customize') }}" class="btn btn-secondary">
                        ← Back to Customize
                    </a>
                    <button type="submit" class="btn btn-primary btn-create">
                        Create Character & Begin Adventure ⚔️
                    </button>
                </div>
            </form>
        </div>
    </div>
</div>

<style>
/* ===== PROGRESS INDICATOR ===== */
.creation-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    padding: 1.5rem 0;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    min-width: 80px;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 2px solid var(--border-primary);
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: var(--text-sm);
}

.progress-step.completed .step-number {
    background: var(--accent-gold);
    border-color: var(--accent-gold);
    color: var(--bg-primary);
}

.progress-step.active .step-number {
    background: var(--bg-primary);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
    box-shadow: 0 0 10px rgba(243, 156, 18, 0.3);
}

.step-label {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    text-align: center;
}

.progress-step.active .step-label {
    color: var(--accent-gold);
}

.progress-step.completed .step-label {
    color: var(--text-secondary);
}

.progress-line {
    width: 60px;
    height: 2px;
    background: var(--border-primary);
    margin: 0 0.5rem;
    margin-bottom: 1.5rem;
}

.progress-step.completed ~ .progress-line {
    background: var(--accent-gold);
}

/* ===== CONFIRM CARD ===== */
.confirm-card {
    background: var(--bg-secondary);
    border: 2px solid var(--border-ornate);
    border-radius: 8px;
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    position: relative;
}

/* Ornate corners */
.confirm-card::before,
.confirm-card::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 40px;
    border: 2px solid var(--accent-gold);
}

.confirm-card::before {
    top: -2px;
    left: -2px;
    border-right: none;
    border-bottom: none;
}

.confirm-card::after {
    bottom: -2px;
    right: -2px;
    border-left: none;
    border-top: none;
}

/* ===== CHARACTER HEADER ===== */
.character-header {
    text-align: center;
    margin-bottom: 2rem;
}

.character-name-display {
    margin-bottom: 1rem;
}

.name-label {
    display: block;
    font-family: var(--font-heading);
    font-size: var(--text-sm);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
}

.character-name {
    font-family: var(--font-heading);
    font-size: var(--text-4xl);
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin: 0;
}

.character-class-origin {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
}

.class-badge,
.origin-badge {
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
    font-size: var(--text-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.class-badge {
    background: linear-gradient(135deg, var(--accent-gold) 0%, var(--accent-gold-hover) 100%);
    color: var(--bg-primary);
}

.origin-badge {
    background: var(--bg-input);
    border: 1px solid var(--border-primary);
    color: var(--text-primary);
}

/* ===== CONFIRM CONTENT LAYOUT ===== */
.confirm-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

/* ===== DETAIL SECTIONS ===== */
.detail-section {
    margin-bottom: 2rem;
}

.detail-section:last-child {
    margin-bottom: 0;
}

.section-title {
    font-family: var(--font-heading);
    font-size: var(--text-lg);
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-primary);
}

/* ===== ORIGIN STORY ===== */
.origin-story {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0;
}

/* ===== LOCATION INFO ===== */
.location-name {
    font-size: var(--text-lg);
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.location-description {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ===== BONUS LIST ===== */
.bonus-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.bonus-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-input);
    border-radius: 4px;
}

.bonus-icon {
    font-size: var(--text-xl);
    flex-shrink: 0;
}

.bonus-text {
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.bonus-description {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    margin: 0.25rem 0;
}

.bonus-effect {
    color: var(--text-muted);
    font-size: var(--text-xs);
    font-style: italic;
}

/* ===== CLASS INFO ===== */
.class-description {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.stat-box {
    padding: 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    text-align: center;
}

.stat-name {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: var(--text-2xl);
    color: var(--accent-gold);
    font-weight: 700;
}

/* ===== SKILL TREES ===== */
.spec-note {
    font-size: var(--text-sm);
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 1rem;
}

.tree-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tree-preview {
    padding: 1rem;
    background: var(--bg-input);
    border-radius: 4px;
    border-left: 3px solid var(--accent-gold);
}

.tree-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.tree-icon {
    font-size: var(--text-lg);
}

.tree-name {
    font-weight: 600;
    color: var(--text-primary);
}

.tree-description {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ===== STARTING GEAR ===== */
.gear-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.gear-item {
    padding: 0.75rem;
    background: var(--bg-input);
    border-radius: 4px;
    color: var(--text-primary);
}

/* ===== WARNING BOX ===== */
.confirmation-section {
    margin-top: 2rem;
}

.warning-box {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    background: rgba(243, 156, 18, 0.1);
    border: 2px solid var(--accent-gold);
    border-radius: 4px;
    margin-bottom: 2rem;
}

.warning-icon {
    font-size: var(--text-3xl);
    flex-shrink: 0;
}

.warning-content {
    font-size: var(--text-sm);
    color: var(--text-primary);
    line-height: 1.6;
}

.warning-content strong {
    display: block;
    font-size: var(--text-base);
    color: var(--accent-gold);
    margin-bottom: 0.5rem;
}

/* ===== CREATE BUTTON ===== */
.btn-create {
    font-size: var(--text-lg);
    padding: 1rem 2rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .confirm-card {
        padding: 1.5rem;
    }

    .character-name {
        font-size: var(--text-2xl);
    }

    .confirm-content {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .character-class-origin {
        flex-direction: column;
        gap: 0.5rem;
    }

    .warning-box {
        flex-direction: column;
        text-align: center;
    }
}
</style>
{% endblock %}
