/* =====================================================
   UbyCalendar – vlastní víceměsíční rezervační kalendář
   ===================================================== */

.uby-calendar {
    position: relative;
    display: block;
    font-family: inherit;
    -webkit-user-select: none;
    user-select: none;
    box-sizing: border-box;
}

/* ---- Navigace ---- */
.uby-cal-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.uby-cal-nav-months {
    display: none;
}

.uby-cal-prev,
.uby-cal-next {
    background: #fff;
    border: 1px solid #d8d8d8;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-transition: background 200ms ease, border-color 200ms ease;
    transition: background 200ms ease, border-color 200ms ease;
    padding: 0;
}

.notouch .uby-cal-prev:hover,
.notouch .uby-cal-next:hover {
    background: #f0f0f0;
    border-color: #b0b0b0;
}

/* ---- Wrapper pro měsíce ---- */
.uby-cal-months {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
    align-items: flex-start;
}

/* ---- Jeden měsíc ---- */
/* Default (6 měsíců): 3 per row */
.uby-cal-month {
    flex: 0 0 calc(33.33% - 22px);
    min-width: 260px;
}

/* 2 měsíce: roztáhnout na celou šířku (každý 50%) */
.uby-months-2 .uby-cal-month {
    flex: 1 1 calc(50% - 16px);
    min-width: 260px;
}

/* Název měsíce nad každým kalendářem */
.uby-cal-month-header {
    display: block;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    color: #1a1a1a;
    text-transform: capitalize;
    letter-spacing: 0.02em;
    margin-bottom: 10px;
}


/* ---- Tabulka ---- */
.uby-cal-table {
    border-collapse: separate !important;
    border-spacing: 3px 3px !important;
    table-layout: fixed;
    width: 100%;
}

.uby-cal-table thead th {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #999;
    padding: 0 0 8px;
    letter-spacing: 0.04em;
    width: calc(100% / 7);
}

/* ---- Řádky dnů – pevná výška ---- */
.uby-day-row {
    height: 38px;
}

/* ---- Buňky dnů ---- */
.uby-day {
    text-align: center;
    height: 38px;
    font-size: 13px;
    font-weight: 400;
    position: relative;
    cursor: default;
    border-radius: 4px;
    -webkit-transition: background 150ms ease, color 150ms ease;
    transition: background 150ms ease, color 150ms ease;
    padding: 0;
    vertical-align: middle;
    box-sizing: border-box;
}

/* Číslo dne */
.uby-date-num {
    display: block;
    line-height: 38px;
}

.uby-empty {
    background: transparent !important;
}

/* Dostupné dny */
.uby-day.uby-available {
    cursor: pointer;
    background: #e8f4e8;
    color: #12422e;
    /*color: #1a1a1a;*/
}

.notouch .uby-day.uby-available:hover {
    background: #e8f4e8;
    color: #12422e;
}

/* Nedostupné / past */
.uby-day.uby-unavailable {
    cursor: not-allowed;
}

/* Dnes */
.uby-day.uby-today {
    font-weight: 700;
}
.uby-day.uby-today::after {
    content: '';
    display: block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #12422e;
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
}

/* ---- Stavy dostupnosti ---- */

/* Plně obsazeno */
.uby-day.red {
    background: #fdecec;
    color: #c0392b;
}

.uby-day.red .uby-date-num {
    font-weight: 700;
}
.uby-day.grey {
    background: #f0f0f0;
    color: #999;
}
.uby-day.blue {
    background: #dbeafe;
    color: #1e40af;
}
.uby-day.purple {
    background: #fdf0f6;
    color: #8e44ad;
}

/* Částečná rezervace – alespoň jeden pokoj obsazen, alespoň jeden volný */
.uby-day.partial {
    background: #fef3b4;
    color: #8a7000;
}

.uby-day.partial .uby-date-num {
    font-weight: 700;
}

/* Minulé dny */
.uby-day.old-date,
.uby-day.uby-unavailable:not(.red):not(.grey):not(.blue):not(.purple):not([class*="half-"]) {
    background: #f4f4f4;
    color: #cacaca;
}

/* Půldenní přechody (příjezd/odjezd ve stejný den) */
/* half-end = odjezd ráno → levý horní trojúhelník obsazen, pravý dolní volný (zelený) */
.uby-day.half-end-red {
    background: linear-gradient(to bottom right, #fdecec 50%, #e8f4e8 50%);
    color: #1a1a1a;
}
/* half-start = příjezd odpoledne → levý horní volný (zelený), pravý dolní obsazen */
.uby-day.half-start-red {
    background: linear-gradient(to bottom right, #e8f4e8 50%, #fdecec 50%);
    color: #1a1a1a;
}
.uby-day.half-end-grey {
    background: linear-gradient(to bottom right, #f0f0f0 50%, #e8f4e8 50%);
    color: #1a1a1a;
}
.uby-day.half-start-grey {
    background: linear-gradient(to bottom right, #e8f4e8 50%, #f0f0f0 50%);
    color: #1a1a1a;
}
.uby-day.half-end-blue {
    background: linear-gradient(to bottom right, #dbeafe 50%, #e8f4e8 50%);
    color: #1a1a1a;
}
.uby-day.half-start-blue {
    background: linear-gradient(to bottom right, #e8f4e8 50%, #dbeafe 50%);
    color: #1a1a1a;
}
.uby-day.half-end-blue-partial {
    background: linear-gradient(to bottom right, #dbeafe 50%, #fef3b4 50%);
    color: #1a1a1a;
}
.uby-day.half-end-red-partial {
    background: linear-gradient(to bottom right, #fdecec 50%, #fef3b4 50%);
    color: #1a1a1a;
}
.uby-day.half-end-purple {
    background: linear-gradient(to bottom right, #fdf0f6 50%, #e8f4e8 50%);
    color: #1a1a1a;
}
.uby-day.half-start-purple {
    background: linear-gradient(to bottom right, #e8f4e8 50%, #fdf0f6 50%);
    color: #1a1a1a;
}
.uby-day.half-end-partial {
    background: linear-gradient(to bottom right, #fef3b4 50%, #e8f4e8 50%);
    color: #1a1a1a;
}
.uby-day.half-start-partial {
    background: linear-gradient(to bottom right, #e8f4e8 50%, #fef3b4 50%);
    color: #1a1a1a;
}
.uby-day.half-end-partial-red {
    background: linear-gradient(to bottom right, #fef3b4 50%, #fdecec 50%);
    color: #1a1a1a;
}
.uby-day.half-end-partial-blue {
    background: linear-gradient(to bottom right, #fef3b4 50%, #dbeafe 50%);
    color: #1a1a1a;
}

/* ---- Vybraný rozsah ---- */
.uby-day.uby-range-start,
.uby-day.uby-in-range,
.uby-day.uby-range-end {
    background: #12422e !important;
    color: #fff !important;
    font-weight: 700;
    border-radius: 4px;
    z-index: 1;
}

.uby-day.uby-range-start .uby-date-num,
.uby-day.uby-range-end .uby-date-num {
    font-weight: 700;
}

.uby-day.uby-in-range {
    background: #e5f0ea;
    color: #12422e;
}

.uby-day.uby-in-range .uby-date-num {
    font-weight: 700;
}

/* ---- Instrukce pro výběr ---- */
.uby-calendar.uby-selecting .uby-day.uby-available {
    cursor: crosshair;
}

/* ---- Tooltip pro jméno klienta (jen na /reservation/) ---- */
.uby-day[data-tooltip]:hover::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26, 26, 26, 0.92);
    color: #fff;
    padding: 6px 12px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 500;
    white-space: pre;
    text-align: left;
    z-index: 100;
    pointer-events: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* ---- JS Tooltip pro místnosti ---- */
.uby-tooltip-popup {
    position: fixed;
    display: none;
    background: rgba(26, 26, 26, 0.92);
    color: #fff;
    padding: 6px 12px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.7;
    text-align: left;
    white-space: nowrap;
    z-index: 9999;
    pointer-events: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transform: translate(-50%, calc(-100% - 6px));
}

.uby-tooltip-popup.uby-tooltip-visible {
    display: block;
}

.uby-dot {
    font-size: 10px;
}

.uby-dot-occ {
    color: #e74c3c;
}

.uby-dot-free {
    color: #27ae60;
}

/* ---- Legenda ---- */
.uby-cal-legend {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    flex-wrap: wrap;
    font-size: 12px;
    color: #555;
}

.uby-cal-legend span {
    display: flex;
    align-items: center;
    gap: 7px;
}

.uby-cal-legend span::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}

.uby-leg-avail::before    { background: #fff; border: 1px solid #d0d0d0; }
.uby-leg-selected::before { background: #12422e; }
.uby-leg-occ::before      { background: #fdecec; border: 1px solid #f0c0c0; }
.uby-leg-partial::before  { background: #fef3b4; border: 1px solid #e0c800; }
.uby-leg-half::before     { background: linear-gradient(to bottom right, #e8f4e8 50%, #fef3b4 50%); border: 1px solid #d0d8d0; }
.uby-leg-blue::before     { background: #dbeafe; border: 1px solid #93c5fd; }
.uby-leg-grey::before     { background: #f0f0f0; border: 1px solid #d8d8d8; }

/* ---- Reset wrapper interference (admin dashboard) ---- */
.uby-cal-table {
    display: table !important;
    width: 100% !important;
}
.uby-cal-table thead,
.uby-cal-table tbody {
    display: table-row-group !important;
}
.uby-cal-table tr {
    display: table-row !important;
}
.uby-cal-table td,
.uby-cal-table th {
    display: table-cell !important;
    padding: 0 !important;
    border: none !important;
    vertical-align: middle !important;
    text-align: center !important;
}

/* ---- Responsive ---- */
@media screen and (max-width: 700px) {
    /* Na mobilu skryj skupinový nadpis v navigaci */
    .uby-cal-nav-months {
        display: none;
    }

    .uby-cal-months {
        gap: 24px;
        flex-direction: column;
    }

    /* Na mobilu zobraz jen první dva měsíce (pouze pro 2-měsíční kalendář) */
    .uby-months-2 .uby-cal-month:nth-child(n+3) {
        display: none;
    }

    .uby-cal-month {
        flex: 0 0 100%;
        min-width: 0;
        width: 100%;
    }

    /* 6-měsíční kalendář (/reservation/): všechny měsíce zobrazit, menší mezery */
    .uby-months-6 .uby-cal-months {
        gap: 16px;
    }

    .uby-day-row {
        height: 34px;
    }
    .uby-day {
        height: 34px;
        font-size: 12px;
    }
}

@media screen and (max-width: 400px) {
    .uby-cal-month {
        min-width: 100%;
    }
    .uby-cal-table thead th {
        font-size: 10px;
        padding: 0 0 6px;
    }
}
