<!DOCTYPE html>
<html lang="tr">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="csrf-token" content="<?php echo e(csrf_token()); ?>">
    <title>Acente Seçimi - Acente Pro Max</title>

    <!-- Favicon -->
    <link rel="icon" type="image/svg+xml" href="<?php echo e(asset('favicon.svg')); ?>">
    <link rel="icon" type="image/png" sizes="32x32" href="<?php echo e(asset('favicon-32.png')); ?>">
    <link rel="icon" type="image/png" sizes="16x16" href="<?php echo e(asset('favicon-16.png')); ?>">
    <link rel="alternate icon" href="<?php echo e(asset('favicon.ico')); ?>">
    <link rel="apple-touch-icon" href="<?php echo e(asset('apple-touch-icon.png')); ?>">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
            overflow-x: hidden;
            padding: 40px 20px;
        }

        body::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
            opacity: 0.3;
        }

        .main-wrapper {
            display: flex;
            gap: 30px;
            max-width: 950px;
            width: 100%;
            z-index: 10;
            align-items: flex-start;
        }

        .container {
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(20px);
            border-radius: 24px;
            box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
            padding: 40px;
            flex: 1;
            border: 1px solid rgba(255, 255, 255, 0.2);
            text-align: center;
        }

        .user-card {
            background: rgba(255, 255, 255, 0.15);
            backdrop-filter: blur(10px);
            border-radius: 24px;
            padding: 30px;
            width: 320px;
            border: 1px solid rgba(255, 255, 255, 0.2);
            color: white;
            text-align: center;
            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
        }

        .user-avatar {
            width: 100px;
            height: 100px;
            background: white;
            border-radius: 50%;
            margin: 0 auto 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #2563eb;
            font-size: 45px;
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
            border: 4px solid rgba(255, 255, 255, 0.3);
        }

        .user-name {
            font-size: 20px;
            font-weight: 700;
            margin-bottom: 5px;
        }

        .user-email {
            font-size: 14px;
            opacity: 0.8;
            margin-bottom: 20px;
        }

        .user-stats {
            display: grid;
            grid-template-columns: 1fr;
            gap: 10px;
            text-align: left;
            margin-top: 20px;
            padding-top: 20px;
            border-top: 1px solid rgba(255, 255, 255, 0.1);
        }

        .stat-item {
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 13px;
        }

        .stat-item i {
            width: 24px;
            height: 24px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 6px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .header {
            margin-bottom: 30px;
        }

        .logo-icon {
            width: 70px;
            height: 70px;
            background: linear-gradient(135deg, #2563eb, #3b82f6);
            border-radius: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 32px;
            margin: 0 auto 15px;
            box-shadow: 0 10px 25px rgba(37, 99, 235, 0.3);
        }

        h1 {
            color: #1e293b;
            font-size: 28px;
            font-weight: 800;
            margin-bottom: 8px;
            letter-spacing: -0.5px;
        }

        p.subtitle {
            color: #64748b;
            font-size: 15px;
            font-weight: 500;
        }

        .agency-list {
            display: flex;
            flex-direction: column;
            gap: 12px;
            margin-top: 25px;
            max-height: 400px;
            overflow-y: auto;
            padding: 4px;
        }

        /* Custom Scrollbar */
        .agency-list::-webkit-scrollbar {
            width: 4px;
        }

        .agency-list::-webkit-scrollbar-track {
            background: #f1f5f9;
            border-radius: 10px;
        }

        .agency-list::-webkit-scrollbar-thumb {
            background: #cbd5e1;
            border-radius: 10px;
        }

        .agency-form {
            width: 100%;
            margin: 0;
            padding: 0;
        }

        .agency-item {
            background: white;
            border: 1px solid #e2e8f0;
            border-radius: 16px;
            padding: 16px 20px;
            display: flex;
            align-items: center;
            gap: 15px;
            cursor: pointer;
            transition: all 0.2s ease-in-out;
            text-align: left;
            width: 100%;
            text-decoration: none;
            position: relative;
            outline: none;
            -webkit-appearance: none;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
        }

        .agency-item:hover {
            border-color: #3b82f6;
            background: #f8faff;
            transform: translateY(-2px);
            box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.1);
        }

        .agency-icon-box {
            width: 48px;
            height: 48px;
            background: #f1f5f9;
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #64748b;
            font-size: 18px;
            flex-shrink: 0;
            transition: all 0.2s ease;
        }

        .agency-item:hover .agency-icon-box {
            background: #3b82f6;
            color: white;
        }

        .agency-info {
            flex-grow: 1;
            display: flex;
            flex-direction: column;
            justify-content: center;
        }

        .agency-info h3 {
            font-size: 16px;
            color: #1e293b;
            margin: 0;
            padding: 0;
            font-weight: 700;
            line-height: 1.4;
        }

        .agency-info p {
            font-size: 13px;
            color: #64748b;
            margin: 2px 0 0 0;
            padding: 0;
            line-height: 1;
        }

        .arrow-icon {
            color: #cbd5e1;
            font-size: 14px;
            transition: all 0.2s ease;
        }

        .agency-item:hover .arrow-icon {
            color: #3b82f6;
            transform: translateX(4px);
        }

        .btn-logout {
            display: inline-block;
            margin-top: 30px;
            color: #64748b;
            text-decoration: none;
            font-size: 14px;
            font-weight: 600;
            transition: color 0.3s ease;
        }

        .btn-logout:hover {
            color: #dc2626;
        }

        .alert {
            padding: 12px 18px;
            border-radius: 12px;
            margin-bottom: 20px;
            font-size: 14px;
            font-weight: 500;
            display: flex;
            align-items: center;
            gap: 10px;
            text-align: left;
        }

        .alert-danger {
            background: rgba(239, 68, 68, 0.1);
            color: #dc2626;
            border: 1px solid rgba(239, 68, 68, 0.2);
        }

        @media (max-width: 850px) {
            .main-wrapper {
                flex-direction: column;
                align-items: center;
                gap: 20px;
            }

            .user-card {
                width: 100%;
                order: -1;
            }
        }

        @media (max-width: 480px) {
            .container {
                padding: 30px 20px;
            }

            h1 {
                font-size: 24px;
            }
        }
    </style>
</head>

<body>
    <div class="main-wrapper">
        <div class="container">
            <div class="header">
                <div class="logo-icon">
                    <i class="fas fa-building"></i>
                </div>
                <h1>Acente Seçimi</h1>
                <p class="subtitle">Yönetmek istediğiniz acenteyi seçin</p>
            </div>

            <?php if(session('error')): ?>
                <div class="alert alert-danger" style="margin-bottom: 20px; text-align: left;">
                    <i class="fas fa-exclamation-circle text-danger me-2"></i>
                    <span><?php echo e(session('error')); ?></span>
                </div>
            <?php endif; ?>

            <?php if(session('success')): ?>
                <div class="alert"
                    style="background: rgba(16, 185, 129, 0.1); color: #059669; border: 1px solid rgba(16, 185, 129, 0.2); margin-bottom: 20px; text-align: left;">
                    <i class="fas fa-check-circle me-2"></i>
                    <span><?php echo e(session('success')); ?></span>
                </div>
            <?php endif; ?>

            <?php if(isset($invitations) && $invitations->isNotEmpty()): ?>
                <div
                    style="margin-bottom: 25px; text-align: left; background: #fff8e6; border: 1px solid #fbdc8d; border-radius: 16px; padding: 20px;">
                    <h3 style="font-size: 16px; color: #b45309; margin-bottom: 12px; font-weight: 700;">
                        <i class="fas fa-envelope-open-text me-2"></i> Yeni Davetleriniz Var
                    </h3>
                    <div style="display: flex; flex-direction: column; gap: 10px;">
                        <?php $__currentLoopData = $invitations; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $invitation): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <div
                                style="background: white; border-radius: 12px; padding: 15px; border: 1px solid #fde68a; display: flex; align-items: center; justify-content: space-between; gap: 15px; flex-wrap: wrap;">
                                <div style="flex-grow: 1;">
                                    <div style="font-weight: 700; color: #1e293b; font-size: 15px;">
                                        <?php echo e($invitation->agency->name); ?></div>
                                    <div style="font-size: 13px; color: #64748b; margin-top: 3px;">
                                        Sizi <strong><?php echo e($invitation->role->ui_name); ?></strong> yetkisiyle davet etti.
                                        <?php if($invitation->position): ?>
                                            <br>Pozisyon: <?php echo e($invitation->position); ?>

                                        <?php endif; ?>
                                    </div>
                                </div>
                                <div style="display: flex; gap: 8px;">
                                    <form action="<?php echo e(route('agency.invitations.reject', $invitation->token)); ?>" method="POST">
                                        <?php echo csrf_field(); ?>
                                        <button type="submit" class="agency-item"
                                            style="padding: 8px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; border: 1px solid #ef4444; color: #ef4444; background: white; width: auto;">
                                            Reddet
                                        </button>
                                    </form>
                                    <form action="<?php echo e(route('agency.invitations.accept', $invitation->token)); ?>" method="POST">
                                        <?php echo csrf_field(); ?>
                                        <button type="submit" class="agency-item"
                                            style="padding: 8px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; border: none; background: #10b981; color: white; width: auto;">
                                            Kabul Et
                                        </button>
                                    </form>
                                </div>
                            </div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </div>
                </div>
            <?php endif; ?>

            <div class="agency-list">
                <?php $__currentLoopData = $agencies; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $agency): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <form action="<?php echo e(route('agency.select.post')); ?>" method="POST" id="select-agency-<?php echo e($agency->id); ?>">
                        <?php echo csrf_field(); ?>
                        <input type="hidden" name="agency_id" value="<?php echo e($agency->id); ?>">
                        <button type="submit" class="agency-item">
                            <div class="agency-icon-box">
                                <i class="fas fa-hotel"></i>
                            </div>
                            <div class="agency-info">
                                <h3><?php echo e($agency->name); ?></h3>
                                <p><?php echo e($agency->email ?? $agency->phone ?? 'Acente Paneli'); ?></p>
                            </div>
                            <i class="fas fa-chevron-right arrow-icon"></i>
                        </button>
                    </form>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </div>

            <form action="<?php echo e(route('agency.logout')); ?>" method="POST" id="logout-form" style="display: none;">
                <?php echo csrf_field(); ?>
            </form>
            <a href="#" class="btn-logout"
                onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
                <i class="fas fa-sign-out-alt me-1"></i> Farklı bir hesapla giriş yap
            </a>
        </div>

        <div class="user-card">
            <div class="user-avatar">
                <i class="fas fa-user"></i>
            </div>
            <p style="font-size: 14px; opacity: 0.8; margin-bottom: 5px;">Tekrar Hoşgeldiniz,</p>
            <h2 class="user-name"><?php echo e(auth()->user()->first_name); ?> <?php echo e(auth()->user()->last_name); ?></h2>
            <p class="user-email" style="margin-bottom: 30px;"><?php echo e(auth()->user()->email); ?></p>

            <div
                style="padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, 0.1); font-size: 14px; line-height: 1.6; opacity: 0.9;">
                Lütfen yönetmek istediğiniz acenteyi sol taraftaki listeden seçiniz.
            </div>

            <div style="margin-top: 50px; font-size: 11px; opacity: 0.6; text-align: center;">
                Acente Pro Max - Güvenli Erişim Paneli
            </div>
        </div>
    </div>

    <script>
        // Form submission loading state could be added here
    </script>
</body>

</html><?php /**PATH C:\xampp\htdocs\acente\resources\views/agency/auth/select-agency.blade.php ENDPATH**/ ?>