<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{ environment.name }} - Orchestration Portal</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background: #f5f5f5;
            color: #333;
        }
        
        .header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 2rem;
        }
        
        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 2rem;
        }
        
        .card {
            background: white;
            border-radius: 8px;
            padding: 1.5rem;
            margin-bottom: 1rem;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        
        .card h2 {
            color: #667eea;
            margin-bottom: 1rem;
        }
        
        .info-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 1rem;
        }
        
        .info-item {
            padding: 0.5rem;
            background: #f9f9f9;
            border-radius: 4px;
        }
        
        .info-item label {
            font-size: 0.9rem;
            color: #666;
            display: block;
            margin-bottom: 0.25rem;
        }
        
        .info-item value {
            font-size: 1.1rem;
            font-weight: 600;
            color: #333;
        }
        
        .btn {
            padding: 0.75rem 1.5rem;
            background: #667eea;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 1rem;
            margin-top: 1rem;
        }
        
        .btn:hover {
            background: #5568d3;
        }
    </style>
</head>
<body>
    <div class="header">
        <h1>{{ environment.name }}</h1>
        <p>{{ environment.location }}</p>
    </div>
    
    <div class="container">
        <div class="card">
            <h2>Environment Information</h2>
            <div class="info-grid">
                <div class="info-item">
                    <label>Provider</label>
                    <value>{{ environment.provider|upper }}</value>
                </div>
                <div class="info-item">
                    <label>Region</label>
                    <value>{{ environment.region }}</value>
                </div>
                <div class="info-item">
                    <label>Role</label>
                    <value>{{ environment.role|title }}</value>
                </div>
                <div class="info-item">
                    <label>Type</label>
                    <value>{{ environment.type|upper }}</value>
                </div>
                <div class="info-item">
                    <label>Status</label>
                    <value>{{ status.status|title }}</value>
                </div>
            </div>
        </div>
        
        <div class="card">
            <h2>Deployment Status</h2>
            <div class="info-grid">
                <div class="info-item">
                    <label>Cluster Health</label>
                    <value>{{ status.cluster_health|title }}</value>
                </div>
                <div class="info-item">
                    <label>Nodes</label>
                    <value>{{ status.node_count }}</value>
                </div>
                <div class="info-item">
                    <label>Pods Running</label>
                    <value>{{ status.pods_running }}/{{ status.pods_total }}</value>
                </div>
                <div class="info-item">
                    <label>Last Deployed</label>
                    <value>{{ status.last_deployed }}</value>
                </div>
            </div>
        </div>
        
        <div class="card">
            <h2>Actions</h2>
            <button class="btn" onclick="deploy()">Deploy to Environment</button>
        </div>
    </div>
    
    <script>
        function deploy() {
            fetch(`/api/environments/{{ environment.name }}/deploy`, {
                method: 'POST'
            })
            .then(response => response.json())
            .then(data => {
                alert(`Deployment queued: ${data.deployment_id}`);
            })
            .catch(error => {
                alert(`Error: ${error.message}`);
            });
        }
    </script>
</body>
</html>

