/* Основной фон и стили для body */
@import url(base.css);

body {
    position: relative;
    font-family: Arial, sans-serif;
    background-color: #5655558d;
    margin: 0;
    padding: 0;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/avicenaImage2.png');
    background-size: cover;
    background-position: center;
    z-index: -1;
    opacity: 0.8;
}

header {
    background-color: #0c4601;
    color: #fff;
    padding: 1px 0;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 10px 12px 14px rgba(0.30, 0.30, 0.30, 0.30);
    text-align: center;
    opacity: 0.98;
    margin-top: 60px;
}

/* Контейнер для основного контента */
.hospital {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    min-height: 100vh;
    padding: 20px;
    margin: 0px 50px 50px 50px;
    box-sizing: border-box;
    gap: 20px;
    background: rgba(219, 255, 230, 0.95);
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 77, 0, 0.2);
    border: #0e680e 2px solid;
}

.hospital-duties {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 400px;
    max-width: 400px;
    min-height: 100px;
    padding: 20px;
    background: linear-gradient(135deg, #efffea, #f9fff9);
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 77, 0, 0.2);
    border: 2px solid #4CAF50;
    opacity: 0.95;
    position: relative;
    margin-top: 280px;
    /* Позиционируем напротив второй палаты */
}

/* =============== ОБЩИЕ СТИЛИ =============== */
.hospital-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 15px;
    max-width: 450px;
    min-width: 450px;
    opacity: 0.95;
    order: 2;
    /* Палаты справа */
}

/* =============== ПАЛАТА =============== */
.hospital-chamber {
    background: linear-gradient(135deg, #e8f5e8, #f0f8f0);
    border: 2px solid #4CAF50;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    width: 100%;
    display: flex;
    min-height: 220px;
}



/* Палаты 3 и 4 - койки горизонтально (специальный класс) */
.hospital-chamber.chamber-horizontal {
    display: flex;
    gap: 5px;
    justify-content: space-between;
    padding-right: 15px;
    padding-bottom: 40%;
    align-items: flex-start;
    min-height: 220px;
}

/* Палата 4 - койки внизу */
.hospital-chamber.chamber-horizontal.chamber-bottom {
    align-items: flex-end;
    padding-bottom: 15px;
    padding-top: 40%;
}

.hospital-chamber::before {
    content: "Палата " attr(data-chamber);
    position: absolute;
    top: -8px;
    left: 15px;
    background: #4CAF50;
    color: white;
    padding: 3px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
}

/* Заголовок для hospital-duties */
.hospital-duties::before,
.hospital-dutyes::before {
    content: "Пост";
    position: absolute;
    top: -8px;
    left: 15px;
    background: #4CAF50;
    color: white;
    padding: 3px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
}







/* =============== КОЙКА =============== */
.hospital-bed {
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 12px;
    transition: all 0.3s ease;
    position: relative;
    margin-bottom: 10px;
    box-sizing: border-box;
}

/* Вертикальные койки для палат 1, 2, 5 */
.hospital-chamber[data-chamber="1"],
.hospital-chamber[data-chamber="2"],
.hospital-chamber[data-chamber="5"] {
    flex-direction: column;
    align-items: flex-end;
}

.hospital-chamber[data-chamber="1"] .hospital-bed,
.hospital-chamber[data-chamber="2"] .hospital-bed,
.hospital-chamber[data-chamber="5"] .hospital-bed {
    width: calc(65% - 2px);
    margin-bottom: 10px;
}

.hospital-chamber[data-chamber="1"] .hospital-bed:last-child,
.hospital-chamber[data-chamber="2"] .hospital-bed:last-child,
.hospital-chamber[data-chamber="5"] .hospital-bed:last-child {
    margin-bottom: 0;
}


.hospital-bed.occupied {
    border-color: #4CAF50;
    background: linear-gradient(135deg, #e3fde3, #f4fff1);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.2);
}

.hospital-bed.occupied::before {
    content: "Зайняте";
    position: absolute;
    top: -8px;
    right: 10px;
    background: #4CAF50;
    color: white;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
}

.hospital-bed.free {
    border-color: #5399d3;
    background: linear-gradient(135deg, #e3f2fd, #f1f8ff);
}

.hospital-bed.free::before {
    content: "Вільне";
    position: absolute;
    top: -8px;
    right: 10px;
    background: #5399d3;
    color: white;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
}

/* =============== НОМЕР КОЙКИ =============== */
.bed-number {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin: 0 0 8px 0;
    text-align: center;
}

/* =============== ИНФОРМАЦИЯ О ПАЦИЕНТЕ =============== */
.patient-info {
    margin-bottom: 10px;
}

.patient-info p {
    margin: 3px 0;
    font-size: 12px;
    color: #555;
}

.patient-name {
    font-weight: bold;
    color: #2196F3;
    font-size: 14px;
}

.operation-type {
    color: #666;
    font-style: italic;
}

.surgeon-name {
    color: #4CAF50;
    font-weight: 500;
    font-size: 12px;
}

.date-info {
    color: #2196F3;
    font-size: 12px;
    font-weight: 500;
}

.days-info {
    color: #FF9800;
    font-weight: bold;
}

.days-info.critical {
    color: #F44336;
}

/* =============== СЕЛЕКТОР ПАЦИЕНТОВ =============== */
.patient-selector {
    width: 100%;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    background: white;
    margin-bottom: 10px;
    transition: border-color 0.3s ease;
}

.patient-selector:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 5px rgba(33, 150, 243, 0.3);
}

.patient-selector option {
    padding: 5px;
}

/* =============== КНОПКИ =============== */
.btn-assign {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s ease;
    margin-right: 2px;
    width: 100%;
}

.btn-assign:hover {
    background: #45a049;
}

.btn-remove {
    background: #5399d3;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s ease;
    width: 100%;
}

.btn-remove:hover {
    background: #386d97;
}



/* =============== ЗАВАНТАЖЕННЯ =============== */
.loading {
    text-align: center;
    padding: 50px;
    font-size: 18px;
    color: #666;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* =============== АДАПТИВНОСТЬ =============== */
@media (min-width: 1400px) {
    .hospital {
        max-width: 1400px;
        margin: 0px auto;
    }

    .hospital-duties,
    .hospital-dutyes {
        margin-top: 300px;
        /* Больший отступ для больших экранов */
    }
}

@media (max-width: 1400px) {
    .hospital-container {
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    .hospital {
        flex-direction: column;
        align-items: center;
        padding: 10px;
        margin: 20px;
        gap: 15px;
    }

    .hospital-duties,
    .hospital-dutyes {
        width: 100%;
        max-width: 100%;
        margin-top: 0;
        order: 1;
        /* На мобильных duties сверху */
        padding: 15px;
        width: 90%;
    }

    .hospital-container {
        max-width: 100%;
        min-width: auto;
        order: 2;
        /* Палаты снизу */
        margin-left: 0;
        transform: none;
        margin-right: 17px;
    }

    .hospital-chamber {
        min-width: auto;
        width: 100%;
        padding: 12px;
        min-height: 180px;
        margin-right: 17px;
    }

    /* Убираем выравнивание по правому краю для палат 1, 2, 5 на планшетах */
    .hospital-chamber[data-chamber="1"],
    .hospital-chamber[data-chamber="2"],
    .hospital-chamber[data-chamber="5"] {
        align-items: stretch;
    }

    .hospital-chamber[data-chamber="1"] .hospital-bed,
    .hospital-chamber[data-chamber="2"] .hospital-bed,
    .hospital-chamber[data-chamber="5"] .hospital-bed {
        width: 100%;
        box-sizing: border-box;
    }

    .hospital-bed {
        padding: 8px;
        margin-bottom: 8px;
        box-sizing: border-box;
    }

    .bed-controls {
        flex-direction: column;
        gap: 5px;
    }

    .btn-assign,
    .btn-remove {
        width: 100%;
        margin-right: 0;
        padding: 6px 12px;
        font-size: 13px;
    }

    .page-title {
        font-size: 24px;
        margin-top: 80px;
        margin-bottom: 20px;
    }

    .current-date {
        margin-top: 80px;
        font-size: 16px;
        padding: 8px;
        margin-bottom: 15px;
    }
}

/* =============== АДАПТАЦИЯ ДЛЯ МОБИЛЬНЫХ 480PX =============== */
@media (max-width: 480px) {
    .hospital {
        flex-direction: column;
        padding: 8px;
        margin: 10px;
        gap: 12px;
    }

    .hospital-duties,
    .hospital-dutyes {
        padding: 15px;
        order: 1;
        /* Сверху на мобильных */
        width: 90%;
    }

    .hospital-container {
        padding: 8px;
        max-width: 100%;
        gap: 12px;
        order: 2;
        /* Снизу на мобильных */
        margin-right: 17px;
    }

    .hospital-chamber {
        padding: 10px;
        min-height: 160px;
        border-width: 1px;
        margin-right: 17px;
    }

    .hospital-chamber::before {
        font-size: 11px;
        padding: 2px 10px;
        top: -6px;
    }

    .hospital-duties::before,
    .hospital-dutyes::before {
        font-size: 11px;
        padding: 2px 10px;
        top: -6px;
    }

    /* Адаптация горизонтальных палат для мобильных */
    .hospital-chamber.chamber-horizontal {
        flex-direction: column;
        padding-bottom: 15px;
        padding-top: 15px;
        justify-content: flex-start;
        align-items: stretch;
    }

    .hospital-chamber.chamber-horizontal.chamber-bottom {
        align-items: stretch;
        padding-bottom: 15px;
        padding-top: 15px;
    }

    /* Все койки вертикально на мобильных */
    .hospital-chamber[data-chamber="1"],
    .hospital-chamber[data-chamber="2"],
    .hospital-chamber[data-chamber="5"] {
        align-items: stretch;
    }

    .hospital-chamber[data-chamber="1"] .hospital-bed,
    .hospital-chamber[data-chamber="2"] .hospital-bed,
    .hospital-chamber[data-chamber="5"] .hospital-bed {
        width: 100%;
        margin-bottom: 8px;
        box-sizing: border-box;
    }

    .hospital-bed {
        padding: 6px;
        margin-bottom: 6px;
        border-width: 1px;
        box-sizing: border-box;
    }

    .bed-number {
        font-size: 16px;
        margin-bottom: 6px;
    }

    .patient-info p {
        font-size: 11px;
        margin: 2px 0;
    }

    .patient-name {
        font-size: 13px;
    }

    .surgeon-name,
    .date-info {
        font-size: 11px;
    }

    .patient-selector {
        padding: 6px;
        font-size: 13px;
        margin-bottom: 8px;
    }

    .bed-controls {
        gap: 4px;
        margin-top: 8px;
    }

    .btn-assign,
    .btn-remove {
        padding: 5px 10px;
        font-size: 12px;
    }

    .page-title {
        font-size: 20px;
        margin-top: 70px;
        margin-bottom: 15px;
    }

    .page-subtitle {
        font-size: 14px;
        margin-bottom: 8px;
    }

    .current-date {
        margin-top: 70px;
        font-size: 14px;
        padding: 6px;
        margin-bottom: 12px;
        border-width: 1px;
    }
}

/* =============== СПЕЦИАЛЬНАЯ АДАПТАЦИЯ ДЛЯ 400PX =============== */
@media (max-width: 400px) {
    .hospital {
        flex-direction: column;
        padding: 5px;
        margin-right: 12px;
        gap: 10px;
    }



    .hospital-duties,
    .hospital-dutyes {
        padding: 10px;
        min-height: 100px;
        margin-right: 15px;
        margin-left: 15px;
        width: 90%;
        order: 1;
        /* Над первой палатой */
    }

    .hospital-container {
        padding: 5px;
        max-width: 100%;
        gap: 10px;
        order: 2;
        /* Палаты снизу */
        margin-right: 17px;
    }

    .hospital-chamber {
        padding: 8px;
        min-height: 140px;
        margin-bottom: 8px;
        margin-right: 10px;
    }

    .hospital-chamber::before {
        font-size: 10px;
        padding: 1px 8px;
        left: 10px;
    }

    .hospital-duties::before,
    .hospital-dutyes::before {
        font-size: 10px;
        padding: 1px 8px;
        left: 10px;
    }

    /* Убираем выравнивание по правому краю для всех палат на 400px */
    .hospital-chamber[data-chamber="1"],
    .hospital-chamber[data-chamber="2"],
    .hospital-chamber[data-chamber="5"] {
        align-items: stretch;
    }

    .hospital-bed {
        padding: 5px;
        margin-bottom: 5px;
        box-sizing: border-box;
    }

    .bed-number {
        font-size: 14px;
        margin-bottom: 4px;
    }

    .patient-info p {
        font-size: 10px;
        margin: 1px 0;
    }

    .patient-name {
        font-size: 12px;
    }

    .surgeon-name,
    .date-info,
    .operation-type {
        font-size: 10px;
    }

    .patient-selector {
        padding: 4px;
        font-size: 12px;
        margin-bottom: 6px;
    }

    .bed-controls {
        gap: 3px;
        margin-top: 6px;
    }

    .btn-assign,
    .btn-remove {
        padding: 4px 8px;
        font-size: 11px;
        border-radius: 3px;
    }

    .hospital-bed.occupied::before,
    .hospital-bed.free::before {
        font-size: 10px;
        padding: 1px 6px;
        top: -6px;
        right: 6px;
    }

    .page-title {
        font-size: 18px;
        margin-top: 60px;
        margin-bottom: 12px;
        padding: 0 10px;
    }

    .page-subtitle {
        font-size: 13px;
        padding: 0 10px;
    }

    .current-date {
        margin-top: 60px;
        font-size: 13px;
        padding: 5px;
        margin-bottom: 10px;
        margin-left: 5px;
        margin-right: 25px;
    }
}

/* =============== АНИМАЦИИ =============== */
.hospital-bed {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.patient-selector:invalid {
    border-color: #F44336;
}

/* =============== ЗАГОЛОВОК СТРАНИЦЫ =============== */
.page-title {
    text-align: center;
    color: #000000;
    margin-top: 100px;
    margin-bottom: 30px;
    font-size: 28px;
    font-weight: bold;
}

.page-subtitle {
    text-align: center;
    color: #000000;
    margin-bottom: 10px;
    font-size: 16px;
}

.current-date {
    text-align: center;
    color: #0e680e;
    margin-top: 180px;


    font-size: 18px;
    font-weight: bold;
    background: linear-gradient(135deg, #e3fde4, #f1fff2);
    padding: 10px;
    border-radius: 10px;
    border: 2px solid #21f333;
    box-shadow: 0 2px 8px rgba(33, 243, 44, 0.2);
    margin-left: 10%;
    margin-right: 10%;
    opacity: 0.95;
}