{% extends "base.html" %}
{% load i18n static %}

{% block title %}
    {% if LANGUAGE_CODE == 'ar' %}{{ subject.name_ar }}{% else %}{{ subject.name_en }}{% endif %} | EduPlatform
{% endblock %}

{% block content %}
<div class="container py-5">
    <nav aria-label="breadcrumb" class="mb-4">
        <ol class="breadcrumb">
            <li class="breadcrumb-item"><a href="{% url 'index' %}">{% trans "Home" %}</a></li>
            <li class="breadcrumb-item active" aria-current="page">
                {% if LANGUAGE_CODE == 'ar' %}{{ subject.level.name_ar }}{% else %}{{ subject.level.name_en }}{% endif %}
            </li>
        </ol>
    </nav>

    <div class="row g-5">
        <div class="col-lg-8">
            <div class="glass-card mb-4 overflow-hidden p-0">
                <div style="height: 300px; background: #f8f9fa; display: flex; align-items: center; justify-content: center; position: relative;">
                    {% if subject.image %}
                    <img src="{{ subject.image.url }}" class="img-fluid w-100 h-100 object-fit-cover" alt="{{ subject.name_en }}">
                    {% else %}
                    <span class="display-1" style="opacity: 0.1;">📚</span>
                    {% endif %}
                    <div class="position-absolute top-0 end-0 m-4">
                        <span class="badge bg-primary fs-6 px-3 py-2 shadow-sm">
                            {% if LANGUAGE_CODE == 'ar' %}{{ subject.level.name_ar }}{% else %}{{ subject.level.name_en }}{% endif %}
                        </span>
                    </div>
                </div>
                <div class="p-4 p-md-5">
                    <h1 class="fw-bold mb-4">
                        {% if LANGUAGE_CODE == 'ar' %}{{ subject.name_ar }}{% else %}{{ subject.name_en }}{% endif %}
                    </h1>
                    
                    <div class="d-flex align-items-center mb-5 p-3 rounded-3 bg-light">
                        <div class="avatar-placeholder me-3" style="width: 50px; height: 50px; background: var(--primary-color); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white;">
                            {{ subject.teacher.user.username|first|upper }}
                        </div>
                        <div>
                            <p class="mb-0 text-muted small">{% trans "Teacher" %}</p>
                            <h6 class="fw-bold mb-0">{{ subject.teacher }}</h6>
                        </div>
                    </div>

                    <h4 class="fw-bold mb-3">{% trans "About this Subject" %}</h4>
                    <div class="lead text-muted mb-5">
                        {% if LANGUAGE_CODE == 'ar' %}
                            {{ subject.description_ar|linebreaks }}
                        {% else %}
                            {{ subject.description_en|linebreaks }}
                        {% endif %}
                    </div>

                    <div class="row g-4 mb-5">
                        <div class="col-md-6">
                            <div class="p-4 border rounded-4 h-100">
                                <div class="h3 mb-3 text-primary">🎥</div>
                                <h5 class="fw-bold">{% trans "Live Sessions" %}</h5>
                                <p class="text-muted small mb-0">{% trans "Interactive online classes and group discussions." %}</p>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="p-4 border rounded-4 h-100">
                                <div class="h3 mb-3 text-primary">📁</div>
                                <h5 class="fw-bold">{% trans "Study Materials" %}</h5>
                                <p class="text-muted small mb-0">{% trans "Comprehensive guides, notes, and practice exams." %}</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="col-lg-4">
            <div class="sticky-top" style="top: 2rem; z-index: 10;">
                <div class="glass-card shadow-lg border-primary border-top border-4">
                    <div class="p-4">
                        <h3 class="fw-bold text-primary mb-4">${{ subject.price }}</h3>
                        
                        <ul class="list-unstyled mb-4">
                            <li class="mb-3 d-flex align-items-center">
                                <span class="text-success me-2">✓</span> {% trans "Full lifetime access" %}
                            </li>
                            <li class="mb-3 d-flex align-items-center">
                                <span class="text-success me-2">✓</span> {% trans "Access on mobile and desktop" %}
                            </li>
                            <li class="mb-3 d-flex align-items-center">
                                <span class="text-success me-2">✓</span> {% trans "Certificate of completion" %}
                            </li>
                        </ul>

                        <button class="btn btn-primary btn-lg w-100 py-3 fw-bold mb-3 shadow-sm">
                            {% trans "Enroll Now" %}
                        </button>
                        <p class="text-center text-muted small mb-0">
                            {% trans "30-Day Money-Back Guarantee" %}
                        </p>
                    </div>
                </div>
                
                <div class="glass-card mt-4">
                    <div class="p-4 text-center">
                        <h6 class="fw-bold mb-3">{% trans "Share this course" %}</h6>
                        <div class="d-flex justify-content-center gap-2">
                            <button class="btn btn-light btn-sm rounded-circle" style="width: 40px; height: 40px;">f</button>
                            <button class="btn btn-light btn-sm rounded-circle" style="width: 40px; height: 40px;">t</button>
                            <button class="btn btn-light btn-sm rounded-circle" style="width: 40px; height: 40px;">in</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}