{% extends "base.html" %}

{% block title %}UI/UX Feedback - X-IPE{% endblock %}

{% block extra_css %}
<link rel="stylesheet" href="{{ url_for('static', filename='css/uiux-feedback.css') }}">
{% endblock %}

{% block body %}
<div class="app-container">
    <!-- ROW 1: Top Bar -->
    <header class="top-bar">
        <div class="d-flex align-items-center gap-3">
            <a href="/" class="top-bar-brand text-decoration-none">
                <i class="bi bi-journal-code me-2"></i>X-IPE
            </a>
        </div>
        <div class="d-flex align-items-center gap-2">
            <a href="/settings" class="btn btn-link text-light" title="Settings">
                <i class="bi bi-gear-fill"></i>
            </a>
        </div>
    </header>

    <!-- Browser Simulator Container -->
    <div class="uiux-container">
        <!-- Browser Chrome -->
        <div class="browser-chrome">
            <div class="browser-dots">
                <span class="browser-dot red"></span>
                <span class="browser-dot yellow"></span>
                <span class="browser-dot green"></span>
            </div>
            <div class="url-bar">
                <input type="text" id="url-input" class="url-input" placeholder="http://localhost:3000" />
                <button id="go-btn" class="go-btn">Go</button>
            </div>
        </div>

        <!-- Browser Viewport -->
        <div class="browser-viewport-container">
            <div class="browser-viewport" id="browser-viewport">
                <!-- Iframe for proxied content -->
                <iframe id="viewport-iframe" class="viewport-iframe"></iframe>
                
                <!-- Empty State (shown when no URL loaded) -->
                <div class="empty-state" id="empty-state">
                    <div class="empty-state-icon">
                        <i class="bi bi-globe2"></i>
                    </div>
                    <div class="empty-state-title">Browser Simulator</div>
                    <div class="empty-state-description">
                        Enter a localhost URL above to preview your application.
                        <br><br>
                        <small class="text-muted">Supported: localhost, 127.0.0.1</small>
                    </div>
                </div>
                
                <!-- Loading Overlay -->
                <div class="loading-overlay" id="loading-overlay">
                    <div class="loading-spinner"></div>
                    <div class="loading-text">Loading page...</div>
                </div>
                
                <!-- Error Overlay -->
                <div class="error-overlay" id="error-overlay">
                    <div class="error-icon">
                        <i class="bi bi-exclamation-triangle-fill"></i>
                    </div>
                    <div class="error-message" id="error-message">Connection failed</div>
                    <div class="error-hint">Click to dismiss</div>
                </div>
            </div>
        </div>

        <!-- Status Bar -->
        <div class="browser-status">
            <div class="status-indicator"></div>
            <div class="status-text" id="status-text">Ready - Enter a localhost URL to begin</div>
        </div>
    </div>
</div>
{% endblock %}

{% block extra_js %}
<script src="{{ url_for('static', filename='js/uiux-feedback.js') }}"></script>
{% endblock %}
