<!DOCTYPE html>
<html>
<head>
    <title>নোটিশ তালিকা - Somoti</title>
    <meta charset="utf-8">
    <style>
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            margin: 0;
            padding: 20px;
            background: #f8f9fa;
            color: #333;
        }
        .container {
            max-width: 1200px;
            margin: 0 auto;
            background: white;
            padding: 30px;
            border-radius: 10px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }
        h1 {
            color: #2c3e50;
            border-bottom: 3px solid #3498db;
            padding-bottom: 15px;
            margin-bottom: 30px;
        }
        .alert {
            padding: 15px;
            margin-bottom: 20px;
            border-radius: 5px;
        }
        .alert-success {
            background: #d4edda;
            color: #155724;
            border: 1px solid #c3e6cb;
        }
        .alert-error {
            background: #f8d7da;
            color: #721c24;
            border: 1px solid #f5c6cb;
        }
        .notice-card {
            border: 1px solid #e0e0e0;
            border-left: 4px solid #3498db;
            padding: 20px;
            margin-bottom: 20px;
            border-radius: 5px;
            background: #fff;
            transition: transform 0.2s;
        }
        .notice-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        }
        .notice-title {
            color: #2c3e50;
            font-size: 20px;
            margin-bottom: 10px;
            font-weight: 600;
        }
        .notice-meta {
            color: #7f8c8d;
            font-size: 14px;
            margin-bottom: 10px;
        }
        .badge {
            display: inline-block;
            padding: 4px 8px;
            border-radius: 4px;
            font-size: 12px;
            font-weight: bold;
            margin-right: 5px;
        }
        .badge-primary { background: #3498db; color: white; }
        .badge-success { background: #27ae60; color: white; }
        .badge-warning { background: #f39c12; color: white; }
        .badge-danger { background: #e74c3c; color: white; }
        .badge-info { background: #17a2b8; color: white; }
        .notice-content {
            color: #555;
            line-height: 1.6;
            margin: 15px 0;
        }
        .action-buttons {
            margin-top: 15px;
            display: flex;
            gap: 10px;
        }
        .btn {
            padding: 8px 15px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            text-decoration: none;
            font-size: 14px;
            display: inline-block;
        }
        .btn-primary {
            background: #3498db;
            color: white;
        }
        .btn-secondary {
            background: #95a5a6;
            color: white;
        }
        .empty-state {
            text-align: center;
            padding: 50px 20px;
            color: #7f8c8d;
        }
        .empty-state h3 {
            color: #95a5a6;
        }
        .pagination {
            display: flex;
            justify-content: center;
            list-style: none;
            padding: 20px 0;
            margin-top: 30px;
        }
        .pagination li {
            margin: 0 5px;
        }
        .pagination a, .pagination span {
            display: inline-block;
            padding: 8px 15px;
            border: 1px solid #ddd;
            border-radius: 4px;
            text-decoration: none;
            color: #3498db;
        }
        .pagination .active span {
            background: #3498db;
            color: white;
            border-color: #3498db;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>নোটিশ তালিকা</h1>
        
        @if(session('success'))
            <div class="alert alert-success">
                {{ session('success') }}
            </div>
        @endif
        
        @if(session('error'))
            <div class="alert alert-error">
                {{ session('error') }}
            </div>
        @endif
        
        @if(isset($notices) && $notices->count() > 0)
            @foreach($notices as $notice)
                <div class="notice-card">
                    <div class="notice-title">
                        {{ $notice->title }}
                        
                        @if($notice->pin_to_top)
                            <span class="badge badge-warning">📌 পিন করা</span>
                        @endif
                        
                        @if($notice->is_important)
                            <span class="badge badge-danger">⚠️ গুরুত্বপূর্ণ</span>
                        @endif
                        
                        <span class="badge badge-info">
                            @if($notice->notice_type == 'meeting')
                                মিটিং
                            @elseif($notice->notice_type == 'event')
                                ইভেন্ট
                            @elseif($notice->notice_type == 'payment')
                                পেমেন্ট
                            @else
                                সাধারণ
                            @endif
                        </span>
                    </div>
                    
                    <div class="notice-meta">
                        <span>📅 তারিখ: {{ $notice->created_at->format('d/m/Y h:i A') }}</span>
                        |
                        <span>👤 তৈরিকারী: {{ $notice->creator->name ?? 'অজানা' }}</span>
                        |
                        <span>🎯 টার্গেট: 
                            @if($notice->target_audience == 'all')
                                সবাই
                            @elseif($notice->target_audience == 'members')
                                সদস্যরা
                            @elseif($notice->target_audience == 'committee')
                                কমিটি
                            @else
                                নির্দিষ্ট সদস্য
                            @endif
                        </span>
                        |
                        <span>📊 স্ট্যাটাস: 
                            @if($notice->status == 'published')
                                <span class="badge badge-success">প্রকাশিত</span>
                            @elseif($notice->status == 'draft')
                                <span class="badge badge-secondary">খসড়া</span>
                            @else
                                <span class="badge badge-warning">মেয়াদোত্তীর্ণ</span>
                            @endif
                        </span>
                    </div>
                    
                    <div class="notice-content">
                        {{ Str::limit(strip_tags($notice->content), 300) }}
                    </div>
                    
                    <div class="action-buttons">
                        <a href="{{ url('/notices/' . $notice->id) }}" class="btn btn-primary">
                            বিস্তারিত দেখুন
                        </a>
                        
                        @if(auth()->user()->user_type == 'admin' || auth()->user()->user_type == 'committee')
                            <a href="{{ url('/notices/' . $notice->id . '/edit') }}" class="btn btn-secondary">
                                সম্পাদনা
                            </a>
                        @endif
                    </div>
                </div>
            @endforeach
            
            {{-- Pagination --}}
            @if($notices->hasPages())
                <div class="pagination">
                    {{ $notices->links() }}
                </div>
            @endif
        @else
            <div class="empty-state">
                <h3>😊 কোন নোটিশ পাওয়া যায়নি</h3>
                <p>এখনো কোন নোটিশ যোগ করা হয়নি। প্রথম নোটিশ তৈরি করুন।</p>
                
                @if(auth()->user()->user_type == 'admin' || auth()->user()->user_type == 'committee')
                    <a href="{{ url('/notices/create') }}" class="btn btn-primary" style="margin-top: 15px;">
                        + নতুন নোটিশ তৈরি করুন
                    </a>
                @endif
            </div>
        @endif
    </div>
</body>
</html>