body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background-color: #f7f7f7;
}

header {
    padding: 10px 20px;
    background-color: #ffffff;
    border-bottom: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

header .logo a {
    text-decoration: none;
    font-weight: bold;
    color: #333;
}

header nav a {
    margin-left: 10px;
    text-decoration: none;
    color: #555;
}

header nav a:hover {
    text-decoration: underline;
}

main {
    padding: 20px;
}

/* Kalendorius */

.calendar-header-bar {
    margin-bottom: 10px;
}

.calendar-month-nav {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
}

.calendar-month-nav a {
    text-decoration: none;
    color: #0077b6;
    font-weight: bold;
}

.calendar-month-nav span {
    font-weight: 600;
}

.calendar-wrapper {
    overflow-x: auto;
    background-color: #fff;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.calendar-grid {
    display: grid;
    grid-auto-rows: 40px;
    grid-template-columns: 220px repeat(31, 1fr); /* max 31 diena */
    min-width: 900px;
}

/* Header cells */

.calendar-header-cell {
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    padding: 4px;
    border-bottom: 1px solid #eee;
    border-right: 1px solid #eee;
    background-color: #fafafa;
}

.calendar-cell-room-header {
    text-align: left;
    padding-left: 10px;
}

/* Room label column */

.calendar-room-label {
    padding: 4px 8px;
    border-right: 1px solid #eee;
    border-bottom: 1px solid #eee;
    background-color: #fcfcfc;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.calendar-room-label .property-name {
    font-size: 11px;
    color: #777;
}

.calendar-room-label .room-name {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

/* Day cells */

/* ===== Rezervacijų juostos ===== */

.calendar-day-cell {
    border-right: 1px solid #eee;
    border-bottom: 1px solid #eee;
    position: relative; /* reikalinga absolute juostai */
    cursor: pointer;
}

.calendar-day-cell:hover .cell-inner {
    background-color: #f0f8ff;
}

.cell-inner {
    width: 100%;
    height: 100%;
    padding: 2px;
    box-sizing: border-box;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    font-size: 10px;
    color: #999;
}

/* Viena juosta per visą rezervaciją */
.res-range {
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 50%;
    width: calc(100% * var(--nights));
    background-color: #008489;
    border-radius: 999px;
    z-index: 10;

    display: flex;
    align-items: center;
    padding: 0 8px;
    box-sizing: border-box;
    overflow: hidden;

    text-decoration: none; /* nes tai <a> */
    cursor: pointer;       /* rankytė */
}


/* Tekstas juostoje */
.res-label {
    font-size: 10px;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
    text-shadow: 0 0 2px rgba(0,0,0,0.4);
}

/* Pažymėjimo (drag-to-select) vizualas */
.calendar-day-cell.range-select {
    background-color: #e0f7fa; /* šviesiai melsva */
}

.calendar-day-cell.range-select .cell-inner {
    background-color: transparent; /* kad nepermuštų */
}

/* Kad pažymėjimo spalva matytųsi per 4 kampus */
.calendar-day-cell.range-select .need-cell {
    background: transparent;
}

.calendar-day-cell.range-select {
    background-color: #e0f7fa;
    box-shadow: inset 0 0 0 2px #00acc1;
}


/* ===== Kambarių poreikių kampai (4 dalys kiekviename langelyje) ===== */

.day-needs {
    position: absolute;
    inset: 0; /* top:0; right:0; bottom:0; left:0 */
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    pointer-events: none; /* kad netrukdytų dragʼui ir clickʼams */
    z-index: 1; /* žemiau rezervacijos juostos (z-index:10), bet virš fono */
}

.need-cell {
    box-sizing: border-box;
    border: 1px solid transparent;
    background: white; /* default – balta */
}

/* Kampų vietos (2x2 tinklelis) */
.need-cleaning { grid-area: 1 / 1 / 2 / 2; } /* viršutinis kairys */
.need-supplies { grid-area: 1 / 2 / 2 / 3; } /* viršutinis dešinys */
.need-tasks    { grid-area: 2 / 1 / 3 / 2; } /* apatinis kairys */
.need-note     { grid-area: 2 / 2 / 3 / 3; } /* apatinis dešinys */

/* SPALVOS pagal logiką:
   cleaning_status: 0 - balta, 1 - raudona, 2 - mėlyna, 3 - žalia
   supplies_missing: 0 - balta, 1 - ruda
   tasks_needed: 0 - balta, 1 - juoda
   has_note: 0 - balta, 1 - geltona
*/

.calendar-day-cell[data-cleaning="1"] .need-cleaning { background: red; }
.calendar-day-cell[data-cleaning="2"] .need-cleaning { background: blue; }
.calendar-day-cell[data-cleaning="3"] .need-cleaning { background: green; }

.calendar-day-cell[data-supplies="1"] .need-supplies { background: brown; }

.calendar-day-cell[data-tasks="1"] .need-tasks { background: black; }

.calendar-day-cell[data-note="1"] .need-note { background: yellow; }

/* ===== Poreikių modalas ===== */

.needs-modal.hidden {
    display: none;
}

.needs-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.needs-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
}

.needs-modal-dialog {
    position: relative;
    background: #ffffff;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    width: 420px;
    max-width: 95%;
    z-index: 1001;
    box-sizing: border-box;
}

.needs-modal-dialog h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 18px;
}

.needs-modal-close {
    position: absolute;
    right: 8px;
    top: 8px;
    border: none;
    background: transparent;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.needs-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
}

.needs-tabs button {
    flex: 1;
    padding: 6px 4px;
    font-size: 12px;
    border: 1px solid #ddd;
    background: #f5f5f5;
    cursor: pointer;
}

.needs-tabs button.active {
    background: #0077b6;
    color: #fff;
    border-color: #0077b6;
}

.needs-tab-content.hidden {
    display: none;
}

.needs-tab-content label {
    display: block;
    font-size: 13px;
    margin-top: 6px;
    margin-bottom: 2px;
}

.needs-tab-content textarea,
.needs-tab-content select {
    width: 100%;
    box-sizing: border-box;
    font-size: 13px;
    padding: 4px;
}

.needs-tab-content textarea {
    resize: vertical;
}

.needs-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

.needs-modal-actions button {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 4px;
    border: 1px solid #ccc;
    cursor: pointer;
    background: #f5f5f5;
}

.needs-modal-actions button[type="submit"],
.needs-modal-actions button:not(#needs-cancel) {
    background: #0077b6;
    border-color: #0077b6;
    color: #fff;
}
