<!-- userapp/templates/template1.html -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{{ resume.title }}</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="p-5 bg-light">

<div class="container bg-white p-4 shadow-sm">

    <!-- Header / Personal Info -->
    <div class="text-center mb-4">
        <h1>{{ personal_info.full_name }}</h1>
        <p>{{ personal_info.email }} | {{ personal_info.phone }} | {{ personal_info.address }}</p>
        {% if personal_info.linkedin %}<a href="{{ personal_info.linkedin }}">LinkedIn</a> {% endif %}
        {% if personal_info.github %} | <a href="{{ personal_info.github }}">GitHub</a> {% endif %}
        {% if personal_info.portfolio %} | <a href="{{ personal_info.portfolio }}">Portfolio</a> {% endif %}
    </div>

    <!-- Summary -->
    {% if resume.summary %}
    <div class="mb-4">
        <h4>Summary</h4>
        <p>{{ resume.summary }}</p>
    </div>
    {% endif %}

    <!-- Education -->
    {% if educations %}
    <div class="mb-4">
        <h4>Education</h4>
        <ul class="list-group">
            {% for edu in educations %}
            <li class="list-group-item">
                <strong>{{ edu.degree }}</strong> - {{ edu.institution }} ({{ edu.start_year }} - {{ edu.end_year }})
                {% if edu.grade %}| Grade: {{ edu.grade }}{% endif %}
            </li>
            {% endfor %}
        </ul>
    </div>
    {% endif %}

    <!-- Experience -->
    {% if experiences %}
    <div class="mb-4">
        <h4>Experience</h4>
        <ul class="list-group">
            {% for exp in experiences %}
            <li class="list-group-item">
                <strong>{{ exp.job_title }}</strong> at {{ exp.company }} ({{ exp.start_date }} - {{ exp.end_date|default:"Present" }})<br>
                Location: {{ exp.location }}<br>
                Responsibilities: {{ exp.responsibilities }}
            </li>
            {% endfor %}
        </ul>
    </div>
    {% endif %}

    <!-- Projects -->
    {% if projects %}
    <div class="mb-4">
        <h4>Projects</h4>
        <ul class="list-group">
            {% for project in projects %}
            <li class="list-group-item">
                <strong>{{ project.title }}</strong> {% if project.organization %} - {{ project.organization }} {% endif %}<br>
                Duration: {{ project.duration }}<br>
                Description: {{ project.description }}<br>
                {% if project.technologies %}Technologies: {{ project.technologies }}{% endif %}
            </li>
            {% endfor %}
        </ul>
    </div>
    {% endif %}

    <!-- Skills -->
    {% if skills %}
    <div class="mb-4">
        <h4>Skills</h4>
        <ul class="list-inline">
            {% for skill in skills %}
            <li class="list-inline-item badge bg-primary m-1">{{ skill.name }} ({{ skill.category }})</li>
            {% endfor %}
        </ul>
    </div>
    {% endif %}

    <!-- Certifications -->
    {% if certifications %}
    <div class="mb-4">
        <h4>Certifications</h4>
        <ul class="list-group">
            {% for cert in certifications %}
            <li class="list-group-item">{{ cert.name }} - {{ cert.issued_by }} ({{ cert.year }})</li>
            {% endfor %}
        </ul>
    </div>
    {% endif %}

    <!-- Achievements -->
    {% if achievements %}
    <div class="mb-4">
        <h4>Achievements</h4>
        <ul class="list-group">
            {% for ach in achievements %}
            <li class="list-group-item"><strong>{{ ach.title }}</strong> {% if ach.description %}- {{ ach.description }}{% endif %}</li>
            {% endfor %}
        </ul>
    </div>
    {% endif %}

    <!-- Extracurricular -->
    {% if extracurriculars %}
    <div class="mb-4">
        <h4>Extracurricular Activities</h4>
        <ul class="list-group">
            {% for extra in extracurriculars %}
            <li class="list-group-item"><strong>{{ extra.activity }}</strong> {% if extra.description %}- {{ extra.description }}{% endif %}</li>
            {% endfor %}
        </ul>
    </div>
    {% endif %}

    <!-- References -->
    {% if references %}
    <div class="mb-4">
        <h4>References</h4>
        <ul class="list-group">
            {% for ref in references %}
            <li class="list-group-item">{{ ref.name }} - {{ ref.designation }} at {{ ref.company }} {% if ref.contact %}| Contact: {{ ref.contact }}{% endif %}</li>
            {% endfor %}
        </ul>
    </div>
    {% endif %}

</div>

</body>
</html>
