/* =========================================================
   BASE
========================================================= */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background: #f4f7fb;
    font-family:
        "Segoe UI",
        Tahoma,
        Geneva,
        Verdana,
        sans-serif;
    color: #1f2937;
}

/* =========================================================
   TOP INFO
========================================================= */
.top-info {
    height: 40px;
    background: #0d5ea6;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    font-size: 14px;
}

/* =========================================================
   HEADER
========================================================= */
.main-header {
    background: white;
    box-shadow:
        0 2px 12px rgba(0,0,0,0.06);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1600px;
    margin: 0 auto;
    height: 88px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
}

/* =========================================================
   LOGO
========================================================= */
.logo-block {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hospital-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.hospital-name {
    font-size: 24px;
    font-weight: 700;
    color: #0d5ea6;
    letter-spacing: 0.5px;
}

.hospital-subtitle {
    font-size: 13px;
    color: #6b7280;
    margin-top: 2px;
}

/* =========================================================
   CONTAINER
========================================================= */
.container {
    max-width: 1600px;
    margin: 20px auto;
    padding: 0 20px;
}

.calendar-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow:
        0 4px 20px rgba(0,0,0,0.05);
}

/* =========================================================
   CALENDAR
========================================================= */
#calendar {
    height: 85vh;
}

/* =========================================================
   TODAY
========================================================= */
.fc .fc-day-today {
    background: #eef6ff !important;
}

.fc-timegrid-col.fc-day-today {
    background: #eef6ff !important;
}

.fc-col-header-cell.fc-day-today {
    background: #dcecff !important;
}

.fc-col-header-cell.fc-day-today
.fc-col-header-cell-cushion {
    color: #0d5ea6;
    font-weight: 700;
}

/* =========================================================
   TOOLBAR
========================================================= */
.fc-toolbar-title {
    font-size: 22px !important;
    font-weight: 700 !important;
    color: #0d5ea6;
}

.fc-button {
    background: #0d5ea6 !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 8px 14px !important;
    transition: 0.2s;
}

.fc-button:hover {
    background: #0a4d87 !important;
}

/* =========================================================
   TIME GRID
========================================================= */
.fc-timegrid-slot {
    height: 32px !important;
}

.fc-timegrid-slot-label-cushion {
    font-size: 12px;
    color: #6b7280;
}

/* =========================================================
   RESOURCE HEADER
========================================================= */
.fc-datagrid-cell-main,
.fc-col-header-cell-cushion {
    font-weight: 700;
    color: #0d5ea6;
}

/* =========================================================
   FREE EVENTS
========================================================= */
.free-event {
    background: #22c55e !important;
    border: 1px solid #16a34a !important;
    color: white !important;
}

/* =========================================================
   BUSY EVENTS
========================================================= */
.busy-event {
    background: #ef4444 !important;
    border: 1px solid #dc2626 !important;
    color: white !important;
}

/* =========================================================
   EVENT STYLE
========================================================= */
.fc-event {
    border-radius: 8px !important;
    padding: 2px 4px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    cursor: pointer !important;
    opacity: 1 !important;
    overflow: hidden !important;
    box-shadow:
        0 2px 4px rgba(0,0,0,0.08);
}

/* Контейнер */
.fc-event-main {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 100% !important;
    overflow: hidden !important;
}

/* Текст */
.fc-event-title {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    word-break: keep-all !important;
    line-height: 1 !important;
    color: inherit !important;
}

/* =========================================================
   SCROLLER
========================================================= */
.fc-scroller {
    overflow: auto !important;
}

/* =========================================================
   TABLET
========================================================= */
@media (max-width: 1024px) {
    .top-info {
        padding: 0 20px;
    }
	
    .header-container {
        padding: 0 20px;
    }

    .hospital-name {
        font-size: 20px;
    }

    .calendar-card {
        padding: 12px;
    }

    .fc-toolbar {
        flex-direction: column;
        gap: 10px;
    }

    .fc-toolbar-title {
        font-size: 18px !important;
    }

    .fc-button {
        padding: 6px 10px !important;
        font-size: 13px !important;
    }
}

/* =========================================================
   MOBILE
========================================================= */
@media (max-width: 768px) {
    .top-info {
        padding: 0 12px;
        font-size: 12px;
    }

    .header-container {
        height: auto;
        padding: 14px;
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }

    .logo-block {
        gap: 12px;
    }

    .hospital-logo {
        width: 48px;
        height: 48px;
    }

    .hospital-name {
        font-size: 16px;
    }

    .hospital-subtitle {
        font-size: 11px;
    }

    .container {
        padding: 5px;
    }

    .calendar-card {
        border-radius: 10px;
        padding: 6px;
    }

    #calendar {
        height: 80vh;
    }

    .fc-header-toolbar {
        display: flex !important;
        flex-direction: column;
        gap: 10px;
    }

    .fc-toolbar-chunk {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 6px;
    }

    .fc-toolbar-title {
        font-size: 16px !important;
    }

    .fc-button {
        font-size: 12px !important;
        padding: 5px 8px !important;
    }

    .fc-col-header-cell-cushion {
        font-size: 12px !important;
    }

    .fc-timegrid-slot-label-cushion {
        font-size: 11px !important;
    }

    .fc-event {
        font-size: 10px !important;
    }
}

/* =========================================================
   SMALL MOBILE
========================================================= */
@media (max-width: 480px) {
    .hospital-name {
        font-size: 14px;
    }

    .hospital-subtitle {
        display: none;
    }

    .fc-toolbar-title {
        font-size: 14px !important;
    }

    .fc-button {
        font-size: 11px !important;
        padding: 4px 6px !important;
    }

    .fc-event {
        font-size: 9px !important;
    }
}

/* =========================================================
   MOBILE CALENDAR HEADER
========================================================= */
@media (max-width: 768px) {
    .fc-header-toolbar {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
        margin-bottom: 10px !important;
    }

    .fc-toolbar-chunk {
        display: flex !important;
        justify-content: center !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
    }

    .fc-toolbar-title {
        font-size: 15px !important;
        text-align: center !important;
        line-height: 1.2 !important;
    }

    .fc-button {
        padding: 4px 8px !important;
        font-size: 11px !important;
        border-radius: 6px !important;
    }

    .fc-button-group {
        display: flex !important;
        gap: 4px !important;
    }
}

/* =========================================================
   RESOURCE HEADER WRAP
========================================================= */
.fc-datagrid-cell-main {
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    line-height: 1.2 !important;
    text-align: center !important;
    padding: 4px !important;
}

@media (max-width: 768px) {
    .fc-datagrid-cell-main {
        font-size: 11px !important;
        max-width: 120px !important;
    }
}