{% load i18n %}
<!DOCTYPE html>
<html lang="{{ LANGUAGE_CODE|default:'en' }}" dir="{% if LANGUAGE_CODE == 'ar' %}rtl{% else %}ltr{% endif %}">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% trans "Explanation Request" %}</title>
    <style>
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            line-height: 1.6;
            color: #333;
            margin: 0;
            padding: 20px;
            background-color: #f4f4f4;
        }
        .container {
            max-width: 600px;
            margin: 0 auto;
            background: #fff;
            border-radius: 10px;
            overflow: hidden;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }
        .header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: #fff;
            padding: 30px;
            text-align: center;
        }
        .header h1 {
            margin: 0;
            font-size: 28px;
        }
        .content {
            padding: 30px;
        }
        .complaint-box {
            background: #f8f9fa;
            border-left: 4px solid #667eea;
            padding: 15px;
            margin: 20px 0;
            border-radius: 5px;
        }
        .complaint-box h3 {
            margin-top: 0;
            color: #667eea;
        }
        .info-row {
            display: flex;
            margin-bottom: 10px;
        }
        .info-label {
            font-weight: 600;
            min-width: 100px;
            color: #555;
        }
        .info-value {
            flex: 1;
        }
        .button {
            display: inline-block;
            padding: 12px 30px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: #fff;
            text-decoration: none;
            border-radius: 5px;
            font-weight: 600;
            margin: 20px 0;
        }
        .button:hover {
            opacity: 0.9;
        }
        .note {
            background: #fff3cd;
            border: 1px solid #ffc107;
            padding: 15px;
            border-radius: 5px;
            margin: 20px 0;
        }
        .footer {
            background: #f8f9fa;
            padding: 20px;
            text-align: center;
            font-size: 12px;
            color: #666;
            border-top: 1px solid #dee2e6;
        }
        .custom-message {
            background: #e3f2fd;
            border-left: 4px solid #2196f3;
            padding: 15px;
            border-radius: 5px;
            margin: 20px 0;
        }
        .attachment-info {
            font-size: 14px;
            color: #666;
            margin-top: 10px;
        }
        .attachment-info i {
            color: #667eea;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>{% trans "Explanation Request" %}</h1>
        </div>

        <div class="content">
            <p>{% trans "Dear" %} {{ staff_name }},</p>

            <p>{% trans "You have been assigned to provide an explanation for the following patient complaint. Please review the details and submit your response using the link below." %}</p>

            {% if custom_message %}
            <div class="custom-message">
                <strong>{% trans "Note from PX Team:" %}</strong>
                <p>{{ custom_message }}</p>
            </div>
            {% endif %}

            <div class="complaint-box">
                <h3>{% trans "Complaint Details" %}</h3>
                <div class="info-row">
                    <div class="info-label">{% trans "Reference:" %}</div>
                    <div class="info-value">#{{ complaint_id }}</div>
                </div>
                <div class="info-row">
                    <div class="info-label">{% trans "Title:" %}</div>
                    <div class="info-value">{{ complaint_title }}</div>
                </div>
                <div class="info-row">
                    <div class="info-label">{% trans "Patient:" %}</div>
                    <div class="info-value">{{ patient_name }}</div>
                </div>
                <div class="info-row">
                    <div class="info-label">{% trans "Hospital:" %}</div>
                    <div class="info-value">{{ hospital_name }}</div>
                </div>
                <div class="info-row">
                    <div class="info-label">{% trans "Department:" %}</div>
                    <div class="info-value">{{ department_name }}</div>
                </div>
                <div class="info-row">
                    <div class="info-label">{% trans "Category:" %}</div>
                    <div class="info-value">{{ category }}</div>
                </div>
                <div class="info-row">
                    <div class="info-label">{% trans "Status:" %}</div>
                    <div class="info-value">{{ status }}</div>
                </div>
                <div class="info-row">
                    <div class="info-label">{% trans "Date:" %}</div>
                    <div class="info-value">{{ created_date }}</div>
                </div>

                {% if description %}
                <div class="info-row" style="display: block;">
                    <div class="info-label">{% trans "Description:" %}</div>
                    <div class="info-value" style="margin-top: 5px;">{{ description }}</div>
                </div>
                {% endif %}
            </div>

            <div style="text-align: center;">
                <a href="{{ explanation_url }}" class="button">{% trans "Submit Your Explanation" %}</a>
            </div>

            <div class="note">
                <strong>{% trans "Important Information:" %}</strong>
                <ul style="margin-top: 10px; padding-left: 20px;">
                    <li>{% trans "This link is unique and can only be used once" %}</li>
                    <li>{% trans "You can attach supporting documents to your explanation" %}</li>
                    <li>{% trans "Your response will be reviewed by the PX team" %}</li>
                    <li>{% trans "Please submit your explanation at your earliest convenience" %}</li>
                </ul>
            </div>

            <p>{% trans "If you have any questions or concerns, please contact the PX team directly." %}</p>

            <p>{% trans "Thank you for your cooperation." %}</p>
        </div>

        <div class="footer">
            <p><strong>PX360 Complaint Management System</strong></p>
            <p>{% trans "This is an automated email. Please do not reply directly to this message." %}</p>
            <p>{% trans "If you need assistance, contact your PX administrator." %}</p>
        </div>
    </div>
</body>
</html>
