<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>إنشاء جدول عضوية المونتيسوري</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 20px;
        }
        
        .container {
            background: white;
            border-radius: 20px;
            padding: 40px;
            max-width: 600px;
            width: 100%;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
            text-align: center;
        }
        
        h1 {
            color: #333;
            margin-bottom: 30px;
            font-size: 28px;
        }
        
        .status-box {
            padding: 20px;
            border-radius: 10px;
            margin: 20px 0;
            font-size: 18px;
        }
        
        .success {
            background: #d4edda;
            color: #155724;
            border: 2px solid #c3e6cb;
        }
        
        .error {
            background: #f8d7da;
            color: #721c24;
            border: 2px solid #f5c6cb;
        }
        
        .info {
            background: #d1ecf1;
            color: #0c5460;
            border: 2px solid #bee5eb;
        }
        
        .icon {
            font-size: 48px;
            margin-bottom: 15px;
        }
        
        .success .icon {
            color: #28a745;
        }
        
        .error .icon {
            color: #dc3545;
        }
        
        .info .icon {
            color: #17a2b8;
        }
        
        .message {
            font-size: 18px;
            line-height: 1.6;
            margin-bottom: 15px;
        }
        
        .table-name {
            background: #f8f9fa;
            padding: 10px;
            border-radius: 5px;
            margin-top: 15px;
            font-family: monospace;
            font-size: 14px;
            color: #495057;
        }
        
        .output {
            background: #1e1e1e;
            color: #d4d4d4;
            padding: 15px;
            border-radius: 5px;
            margin-top: 20px;
            text-align: left;
            font-family: 'Courier New', monospace;
            font-size: 12px;
            max-height: 300px;
            overflow-y: auto;
            display: none;
        }
        
        .output.show {
            display: block;
        }
        
        .toggle-output {
            margin-top: 15px;
            background: #6c757d;
            color: white;
            border: none;
            padding: 8px 16px;
            border-radius: 5px;
            cursor: pointer;
            font-size: 14px;
        }
        
        .toggle-output:hover {
            background: #5a6268;
        }
        
        .refresh-btn {
            margin-top: 20px;
            background: #007bff;
            color: white;
            border: none;
            padding: 12px 24px;
            border-radius: 5px;
            cursor: pointer;
            font-size: 16px;
            text-decoration: none;
            display: inline-block;
        }
        
        .refresh-btn:hover {
            background: #0056b3;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>إنشاء جدول عضوية المونتيسوري</h1>
        
        @if($success)
            <div class="status-box success">
                <div class="icon">✓</div>
                <div class="message">{!! nl2br(e($message)) !!}</div>
                @if(!$tableExists)
                    <div class="table-name">اسم الجدول: {{ $tableName }}</div>
                @endif
            </div>
        @else
            <div class="status-box error">
                <div class="icon">✗</div>
                <div class="message">{!! nl2br(e($message)) !!}</div>
            </div>
        @endif
        
        @if($tableExists && $success)
            <div class="status-box info">
                <div class="icon">ℹ</div>
                <div class="message">الجدول موجود بالفعل في قاعدة البيانات</div>
                <div class="table-name">{{ $tableName }}</div>
            </div>
        @endif
        
        @if(!empty($output))
            <button class="toggle-output" onclick="toggleOutput()">عرض/إخفاء التفاصيل</button>
            <div class="output" id="output">
                {{ $output }}
            </div>
        @endif
        
        <a href="{{ url()->current() }}" class="refresh-btn">تحديث الصفحة</a>
    </div>
    
    <script>
        function toggleOutput() {
            const output = document.getElementById('output');
            output.classList.toggle('show');
        }
    </script>
</body>
</html>
