<div class="d-flex justify-content-between align-items-center mb-3 calendar-nav">
    <button type="button" class="btn btn-sm btn-light rounded-circle cal-nav-btn"
        onclick="changeMonth({{ $prevMonth->month }}, {{ $prevMonth->year }})">
        <i class="bi bi-chevron-left"></i>
    </button>

    <span class="cal-month-label">{{ $currentMonthLabel }}</span>

    <button type="button" class="btn btn-sm btn-light rounded-circle cal-nav-btn"
        onclick="changeMonth({{ $nextMonth->month }}, {{ $nextMonth->year }})">
        <i class="bi bi-chevron-right"></i>
    </button>
</div>

<div class="detailfoto-date-grid">
    @foreach (['Minggu', 'Senin', 'Selasa', 'Rabu', 'Kamis', 'Jumat', 'Sabtu'] as $hari)
        <div class="day-name">{{ substr($hari, 0, 2) }}</div> {{-- Mengambil 2 huruf depan (Mi, Se, Sl..) --}}
    @endforeach
    {{-- <div class="day-name">Su</div>
    <div class="day-name">Mo</div>
    <div class="day-name">Tu</div>
    <div class="day-name">We</div>
    <div class="day-name">Th</div>
    <div class="day-name">Fr</div>
    <div class="day-name">Sa</div> --}}

    {{-- Offset Spasi --}}
    @for ($i = 0; $i < $start->copy()->startOfMonth()->dayOfWeek; $i++)
        <div class="date-item empty"></div>
    @endfor

    {{-- Loop Tanggal --}}
    @php $daysInMonth = $start->copy()->daysInMonth; @endphp
    @for ($day = 1; $day <= $daysInMonth; $day++)
        @php
            $dateFull = $start->copy()->day($day);
            // Logic Disabled: Lewat hari ini ATAU lebih dari 30 hari ke depan
            $isPast = $dateFull->isPast() && !$dateFull->isToday();
            $isTooFar = $dateFull->diffInDays(\Carbon\Carbon::now()) > 30;
            $isDisabled = $isPast || $isTooFar;
        @endphp

        <div class="date-item {{ $isDisabled ? 'disabled' : '' }}" data-date="{{ $dateFull->format('Y-m-d') }}">
            {{ $day }}
        </div>
    @endfor
</div>
