<?= $this->extend('layout/template'); ?>

<?= $this->section('content'); ?>

<section class="relative overflow-hidden pt-32 pb-20 bg-white min-h-[60vh] flex items-center">
    <div class="absolute inset-0 z-0">
        <img src="<?= base_url('assets/img/gb_hero/outlet.png') ?>" alt="Outlet Background" class="w-full h-full object-cover opacity-60">
        
        <div class="absolute inset-0 flex items-center justify-end select-none pointer-events-none">
            <h1 class="text-[10rem] md:text-[22rem] font-black leading-none text-[#BA290D] opacity-[0.1] uppercase tracking-tighter translate-x-10 md:translate-x-20">
                OUTLET
            </h1>
        </div>
    </div>

    <div class="container mx-auto px-6 md:px-12 relative z-10">
        <h2 class="text-[#BA290D] text-6xl md:text-[6rem] font-black uppercase leading-[0.8] tracking-tighter italic">
            WHERE<br>
            <span class="text-[#FBBD42] ml-4 md:ml-10">TO FIND</span><br>
            US?
        </h2>

        <div class="mt-12 flex gap-3 overflow-x-auto pb-4 no-scrollbar relative z-20">
            <?php foreach ($list_toko as $tag): ?>
                <span class="border-2 border-[#BA290D] text-[#BA290D] px-6 py-2 rounded-full font-bold text-sm hover:bg-[#BA290D] hover:text-white cursor-pointer transition-all uppercase whitespace-nowrap shadow-sm bg-white/50 backdrop-blur-sm">
                    #<?= esc(strtok($tag->nm_toko, ' ')) ?>
                </span>
            <?php endforeach; ?>
        </div>
    </div>
</section>

<section class="bg-white border-t border-[#BA290D]/10">
    <div class="flex flex-col md:flex-row min-h-50vh md:h-[90vh]">
        
        <div class="hidden md:block md:w-1/2 lg:w-3/5 relative overflow-hidden bg-[#BA290D]">
            <?php foreach ($list_toko as $index => $ot): ?>
                <div id="img-<?= esc($ot->kd_toko) ?>"
                    class="outlet-img absolute inset-0 transition-all duration-1000 transform <?= $index === 0 ? 'opacity-100 scale-100' : 'opacity-0 scale-110' ?>">
                    <img src="<?= base_url('assets/img/gb_toko/' . $ot->foto) ?>"
                        class="w-full h-full object-cover grayscale-[10%] hover:grayscale-0 transition-all duration-700"
                        alt="<?= esc($ot->nm_toko) ?>">
                    <div class="absolute inset-0 bg-gradient-to-r from-[#BA290D]/40 to-transparent"></div>
                </div>
            <?php endforeach; ?>
        </div>

        <div class="w-full md:w-1/2 lg:w-2/5 bg-[#F6F3DE]/30 overflow-y-auto custom-scrollbar">
            <div class="p-6 md:p-12">
                <div class="space-y-1">
                    <?php foreach ($list_toko as $index => $ot): ?>
                        <div class="outlet-item group border-b border-[#BA290D]/10" data-id="<?= esc($ot->kd_toko) ?>">
                            <button onclick="expandOutlet('<?= esc($ot->kd_toko) ?>')"
                                class="w-full py-8 flex items-center justify-between text-left transition-all group-hover:pl-2 focus:outline-none">
                                <div class="flex items-baseline gap-4">
                                    <span class="text-[#FBBD42] font-black text-xl italic"><?= str_pad($index + 1, 2, '0', STR_PAD_LEFT) ?></span>
                                    <h3 class="text-[#BA290D] text-2xl md:text-3xl font-black uppercase group-hover:text-[#BA290D] transition-colors italic">
                                        <?= esc($ot->nm_toko) ?>
                                    </h3>
                                </div>
                                <svg class="w-6 h-6 text-[#FBBD42] transform transition-transform duration-500 accordion-icon"
                                    fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M19 9l-7 7-7-7" />
                                </svg>
                            </button>

                            <div id="content-<?= esc($ot->kd_toko) ?>"
                                class="outlet-content max-h-0 overflow-hidden transition-all duration-500 ease-in-out">
                                <div class="pb-8 space-y-6">
                                    <img src="<?= base_url('assets/img/gb_toko/' . $ot->foto) ?>"
                                        class="w-full h-56 object-cover rounded-2xl md:hidden mb-4 border-2 border-[#FBBD42] shadow-lg"
                                        alt="<?= esc($ot->nm_toko) ?>">

                                    <p class="text-gray-700 font-bold leading-relaxed text-lg italic">
                                        "<?= esc($ot->almt_toko) ?>"
                                    </p>

                                    <div class="grid grid-cols-2 gap-4 text-xs font-black uppercase tracking-tighter">
                                        <div class="bg-white p-4 rounded-2xl border-l-4 border-[#BA290D] shadow-sm">
                                            <span class="block text-[#BA290D]/50 mb-1">Hours</span>
                                            <span class="text-[#BA290D]">10:00 - 22:00</span>
                                        </div>
                                        <div class="bg-white p-4 rounded-2xl border-l-4 border-[#FBBD42] shadow-sm">
                                            <span class="block text-[#BA290D]/50 mb-1">Status</span>
                                            <span class="text-[#BA290D]"><?= ($ot->stat == 2) ? 'BUKA' : 'TUTUP' ?></span>
                                        </div>
                                    </div>

                                    <div class="flex gap-3">
                                        <a href="<?= esc($ot->gmap) ?>" target="_blank"
                                            class="flex-1 bg-[#BA290D] text-white py-4 rounded-xl font-black text-[10px] tracking-widest text-center uppercase hover:bg-[#FBBD42] hover:text-[#BA290D] transition-all active:scale-95">
                                            Google Maps
                                        </a>
                                        <a href="<?= esc($ot->nowa) ?>" target="_blank"
                                            class="w-14 h-14 bg-[#FBBD42] text-[#BA290D] flex items-center justify-center rounded-xl hover:scale-105 transition-all active:scale-95">
                                            <svg class="w-7 h-7" fill="currentColor" viewBox="0 0 24 24">
                                                <path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L0 24l6.335-1.662c1.72.937 3.659 1.432 5.633 1.433h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z" />
                                            </svg>
                                        </a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    <?php endforeach; ?>
                </div>
            </div>
        </div>
    </div>
</section>

<?= $this->endSection(); ?>