/* ---------------------------------------------------------
   calendar.css — LoftigoCalendar custom month view
--------------------------------------------------------- */

.cal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* ── Toolbar ─────────────────────────────────────────────── */
.cal__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    gap: 12px;
}

.cal__nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.cal__nav-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s, color .15s;
    flex-shrink: 0;
}
.cal__nav-btn:hover { background: var(--bg); color: var(--text); }

.cal__today-btn {
    height: 30px;
    padding: 0 11px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-soft);
    font-size: 11.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.cal__today-btn:hover { background: var(--bg); color: var(--text); }

.cal__title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
}

.cal__toolbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── Weekday header ─────────────────────────────────────── */
.cal__wdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid var(--border);
    background: var(--bg-soft);
}
.cal__wday {
    padding: 7px 10px 6px;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-mute);
    text-transform: uppercase;
    letter-spacing: .6px;
}

/* ── Month grid ─────────────────────────────────────────── */
.cal__grid {
    transition: opacity .15s;
}

/* Week row: grid for day cells + absolute overlay for event bars */
.cal__week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    position: relative;
    border-bottom: 1px solid var(--border);
}
.cal__week:last-child { border-bottom: 0; }

/* Day cell */
.cal__day {
    min-height: 92px;
    border-right: 1px solid var(--border-soft);
    padding: 6px 8px 4px;
    position: relative;
    background: var(--surface);
    transition: background .1s;
}
.cal__day:last-child { border-right: 0; }
.cal__day:hover      { background: var(--bg-soft); }

.cal__day--other     { background: var(--bg-soft); }
.cal__day--other:hover { background: #f0f1f4; }

.cal__day--weekend   { background: var(--surface); }

.cal__day-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-soft);
    line-height: 1;
}
.cal__day--other .cal__day-num  { color: var(--text-mute); }
.cal__day--today .cal__day-num  {
    background: var(--brand);
    color: #fff;
    font-weight: 700;
}

/* ── Event bars overlay ─────────────────────────────────── */
.cal__events {
    position: absolute;
    top: 30px;
    left: 0; right: 0; bottom: 4px;
    pointer-events: none;
    overflow: hidden;
}

.cal__evt {
    position: absolute;
    height: 20px;
    border-radius: 3px;
    font-size: 10.5px;
    font-weight: 500;
    color: #fff;
    padding: 0 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    pointer-events: all;
    overflow: hidden;
    white-space: nowrap;
    transition: opacity .1s, filter .1s;
    box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.cal__evt:hover { opacity: .88; filter: brightness(1.05); }

.cal__evt__logo {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    object-fit: contain;
    flex-shrink: 0;
}
.cal__evt__title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    color:#1c1c1c;
    min-width: 0;
}

/* ─────────────────────────────────────────────────────────
   Availability page layout
───────────────────────────────────────────────────────── */
.avail-page {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.avail-page__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}
.avail-page__sub { display: none; }

/* ── Circular apartment picker ──────────────────────────── */
.avail-aps {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
}
.avail-aps::-webkit-scrollbar       { height: 4px; }
.avail-aps::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-pill); }

.avail-ap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 12px;
    transition: background .15s;
    flex-shrink: 0;
    max-width: 72px;
}
.avail-ap:hover { background: var(--bg); }

.avail-ap__img {
    position: relative;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 2.5px solid var(--border);
    overflow: hidden;
    transition: border-color .2s;
    background: var(--bg-soft);
}
.avail-ap__img img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}
.avail-ap__ph {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%; height: 100%;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-mute);
}
.avail-ap__name {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-soft);
    line-height: 1.2;
    text-align: center;
    word-break: break-word;
    max-width: 64px;
}
.avail-ap:hover .avail-ap__img        { border-color: rgba(228,158,0,.45); }
.avail-ap.is-active .avail-ap__img    { border-color: var(--brand); }
.avail-ap.is-active .avail-ap__name   { color: var(--brand); font-weight: 700; }
.avail-ap.is-inactive .avail-ap__img  { filter: grayscale(.55); opacity: .8; }

/* ── Toolbar (legend row) ───────────────────────────────── */
.avail-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

/* ── Legend ─────────────────────────────────────────────── */
.avail-legend {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 11.5px;
    color: var(--text-soft);
}
.avail-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    margin-right: 4px;
    vertical-align: middle;
}
.avail-dot--external   { background: #3B82F6; }
.avail-dot--internal   { background: #22C55E; }
.avail-dot--cleaning   { background: #F59E0B; }
.avail-dot--manual     { background: #6B7280; }
.avail-dot--dependency { background: #A78BFA; }

/* ─────────────────────────────────────────────────────────
   Platform logo (used in event bars + popup)
───────────────────────────────────────────────────────── */
.avail-fc-logo {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    background: var(--surface);
    box-shadow: 0 0 0 1.5px rgba(255,255,255,.85);
}

/* ─────────────────────────────────────────────────────────
   Event popup (click on calendar bar → detail card)
───────────────────────────────────────────────────────── */
.avail-event-popup {
    position: absolute;
    z-index: 9999;
    width: 280px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md), 0 2px 8px rgba(0,0,0,.07);
    font-size: 13px;
    color: var(--text);
    overflow: hidden;
    animation: ep-in .12s ease;
}
@keyframes ep-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ep-head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 13px 10px;
    border-bottom: 1px solid var(--border-soft);
}
.ep-logo { flex: 0 0 auto; }
.ep-logo .avail-fc-logo { width: 28px; height: 28px; margin-top: 1px; }
.ep-head__text { flex: 1; min-width: 0; }
.ep-title {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ep-platform {
    display: block;
    font-size: 11px;
    color: var(--text-soft);
    margin-top: 2px;
}
.ep-close {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    line-height: 22px;
    text-align: center;
    font-size: 12px;
    color: var(--text-mute);
    cursor: pointer;
    border-radius: 4px;
    transition: background .1s, color .1s;
}
.ep-close:hover { background: var(--bg); color: var(--text); }

.ep-table {
    width: 100%;
    border-collapse: collapse;
    padding: 8px 13px;
    display: table;
}
.ep-table tr + tr th,
.ep-table tr + tr td { border-top: 1px solid var(--border-soft); }
.ep-table th {
    padding: 6px 13px;
    text-align: left;
    font-weight: 500;
    color: var(--text-soft);
    font-size: 12px;
    white-space: nowrap;
    width: 100px;
}
.ep-table td {
    padding: 6px 13px 6px 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.ep-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 10px 13px;
    border-top: 1px solid var(--border-soft);
    background: var(--bg-soft);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--brand);
    transition: background .12s;
}
.ep-action:hover { background: var(--brand-soft); }
.ep-action svg   { flex: 0 0 auto; }

.ep-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: .04em;
    vertical-align: middle;
    margin-left: 4px;
}
.ep-badge--green  { background: #dcfce7; color: #15803d; }
.ep-badge--yellow { background: #fef9c3; color: #92400e; }
.ep-badge--red    { background: #fee2e2; color: #b91c1c; }
.ep-badge--grey   { background: var(--bg); color: var(--text-soft); }

/* ─────────────────────────────────────────────────────────
   Popup — delete action (manual block)
───────────────────────────────────────────────────────── */
.ep-delete-action {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 10px 13px;
    border: none;
    border-top: 1px solid var(--border-soft);
    background: #fff5f5;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--danger);
    cursor: pointer;
    transition: background .12s;
}
.ep-delete-action:hover { background: #fee2e2; }

/* ─────────────────────────────────────────────────────────
   "Create block" button (in avail-toolbar)
───────────────────────────────────────────────────────── */
.avail-toolbar {
    justify-content: space-between;
}

.avail-create-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    height: 32px;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
    white-space: nowrap;
    flex-shrink: 0;
}
.avail-create-btn:hover { background: var(--brand-deep); }
.avail-create-btn i { font-size: 14px; }

/* ─────────────────────────────────────────────────────────
   Manual-block create modal
───────────────────────────────────────────────────────── */
.avail-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,.35);
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.avail-modal.is-open { display: flex; }

.avail-modal__box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 440px;
    animation: ep-in .14s ease;
}

.avail-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px 14px;
    border-bottom: 1px solid var(--border-soft);
}
.avail-modal__title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}
.avail-modal__close {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: var(--text-mute);
    font-size: 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: background .1s, color .1s;
}
.avail-modal__close:hover { background: var(--bg); color: var(--text); }

.avail-modal__body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.avail-modal__field label {
    display: block;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-soft);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.avail-modal__field input,
.avail-modal__field textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-size: 13.5px;
    font-family: inherit;
    transition: border-color .15s;
    box-sizing: border-box;
}
.avail-modal__field input:focus,
.avail-modal__field textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(228,158,0,.12);
}
.avail-modal__field textarea {
    min-height: 68px;
    resize: vertical;
}

.avail-modal__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.avail-modal__foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 13px 18px;
    border-top: 1px solid var(--border-soft);
    background: var(--bg-soft);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.avail-modal__cancel {
    padding: 0 14px;
    height: 34px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background .12s, color .12s;
}
.avail-modal__cancel:hover { background: var(--bg); color: var(--text); }
.avail-modal__submit {
    padding: 0 16px;
    height: 34px;
    background: var(--brand);
    border: none;
    border-radius: var(--radius);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .12s;
}
.avail-modal__submit:hover { background: var(--brand-deep); }
