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

{% block title %}{% trans "Create Zoom Meeting" %} - {{ block.super }}{% endblock %}

{% block customCSS %}
<style>
    /* UI Variables for the KAAT-S Theme */
    :root {
        --kaauh-teal: #00636e;
        --kaauh-teal-dark: #004a53;
        --kaauh-border: #eaeff3;
        --kaauh-primary-text: #343a40;
        --kaauh-gray: #6c757d;

        /* Status Colors are mostly for list views, but included for completeness */
        --kaauh-success: var(--kaauh-teal);
        --kaauh-warning: #ffc107;
        --kaauh-danger: #dc3545;
        --kaauh-secondary: #6c757d;
    }

    /* CARD STYLING */
    .card {
        border: 1px solid var(--kaauh-border);
        border-radius: 0.75rem;
        box-shadow: 0 4px 12px rgba(0,0,0,0.06);
        max-width: 600px; /* Constrain width for a better form layout */
        margin: 2rem auto; /* Center the form card */
    }

    /* HEADER STYLING */
    .card-header {
        background-color: white; /* Ensure header background is white */
        border-bottom: 1px solid var(--kaauh-border);
        padding: 1.5rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-top-left-radius: 0.75rem;
        border-top-right-radius: 0.75rem;
    }
    .card-header h1 {
        font-size: 1.5rem;
        color: var(--kaauh-teal-dark);
        font-weight: 700;
        margin: 0;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
    .card-header h1 svg {
        width: 1.25rem;
        height: 1.25rem;
    }

    /* FORM STYLING */
    form {
        padding: 1.5rem;
    }
    .form-row {
        margin-bottom: 1.5rem;
    }
    .form-label {
        display: block;
        font-weight: 600;
        color: var(--kaauh-gray);
        margin-bottom: 0.5rem;
        font-size: 0.9rem;
    }
    /* Style for Django form fields (assuming they render as input/select) */
    .form-row input,
    .form-row select {
        display: block;
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 1rem;
        line-height: 1.5;
        color: var(--kaauh-primary-text);
        background-color: #fff;
        background-clip: padding-box;
        border: 1px solid var(--kaauh-border);
        border-radius: 0.5rem;
        transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    }
    .form-row input:focus,
    .form-row select:focus {
        border-color: var(--kaauh-teal);
        outline: 0;
        box-shadow: 0 0 0 0.1rem rgba(0, 99, 110, 0.25);
    }
    /* Ensure the datetime picker input is styled correctly */
    input[type="datetime-local"] {
        font-family: inherit; /* Fixes font for datetime-local */
    }

    /* BUTTON STYLING */
    /* Base style for all buttons */
    .btn-base {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        text-align: center;
        vertical-align: middle;
        cursor: pointer;
        user-select: none;
        padding: 0.5rem 1rem;
        font-size: 1rem;
        line-height: 1.5;
        border-radius: 0.5rem;
        font-weight: 600;
        border: 1px solid transparent;
        transition: all 0.2s ease;
        text-decoration: none; /* Remove underline from anchor buttons */
    }

    /* Primary Action Button (Create/Submit) */
    .btn-main-action {
        background-color: var(--kaauh-teal);
        border-color: var(--kaauh-teal);
        color: white;
    }
    .btn-main-action:hover {
        background-color: var(--kaauh-teal-dark);
        border-color: var(--kaauh-teal-dark);
        box-shadow: 0 4px 8px rgba(0,0,0,0.15);
        color: white;
    }

    /* Outline Secondary (Cancel/Back) */
    .btn-kaats-outline-secondary {
        color: var(--kaauh-secondary);
        border-color: var(--kaauh-secondary);
        background-color: transparent;
    }
    .btn-kaats-outline-secondary:hover {
        background-color: var(--kaauh-secondary);
        color: white;
        border-color: var(--kaauh-secondary);
    }
</style>
{% endblock %}

{% block content %}
<div class="card">
    <div class="card-header">
        <h1>
            <svg class="heroicon" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                <path d="M12 4v16m8-8H4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
            </svg>
            {% trans "Create New Zoom Meeting" %}
        </h1>
        {# Using custom secondary button for 'Back to Meetings' link #}
        <a href="{% url 'list_meetings' %}" class="btn-base btn-kaats-outline-secondary">
            {% trans "Back to Meetings" %}
        </a>
    </div>

    <form method="post">
        {% csrf_token %}
        <div class="form-row">
            <label class="form-label" for="{{ form.topic.id_for_label }}">{% trans "Topic" %}</label>
            {{ form.topic }}
        </div>
        <div class="form-row">
            <label class="form-label" for="{{ form.start_time.id_for_label }}">{% trans "Start Time" %}</label>
            {{ form.start_time }}
        </div>
        <div class="form-row">
            <label class="form-label" for="{{ form.duration.id_for_label }}">{% trans "Duration (minutes)" %}</label>
            {{ form.duration }}
        </div>
        
        {# Action Buttons at the bottom #}
        <div class="form-row d-flex gap-3">
            <button type="submit" class="btn-base btn-main-action">
                <svg class="heroicon" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" style="width: 1.25rem;">
                    <path d="M5 13l4 4L19 7" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
                </svg>
                {% trans "Create Meeting" %}
            </button>
            {# Using custom secondary button for 'Cancel' link #}
            <a href="{% url 'list_meetings' %}" class="btn-base btn-kaats-outline-secondary">
                {% trans "Cancel" %}
            </a>
        </div>
    </form>
</div>
{% endblock %}