/* === CSS Reset === */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* === Базовая типографика (Apple Style) === */
html {
    font-size: 17px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
    line-height: 1.47059;
    font-weight: 400;
    letter-spacing: -0.022em;
    color: #1d1d1f;
    background-color: #f5f5f7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.panel-open {
    overflow: hidden;
}

/* === Контейнер === */
.container {
    width: 100%;
    max-width: 980px;
    margin: 0 auto;
    padding: 0 22px;
}

/* === Header === */
.header {
    padding: 48px 0 24px;
    text-align: center;
}

.header__logo {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: #1d1d1f;
    margin-bottom: 8px;
}

.header__notice {
    display: inline-block;
    margin: 12px 0;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 400;
    color: #1d1d1f;
    background-color: #fff3cd;
    border-radius: 12px;
    line-height: 1.5;
    max-width: 500px;
}

.header__notice strong {
    color: #856404;
}

.header__tel {
    font-size: 14px;
    font-weight: 400;
    color: #86868b;
    line-height: 1.5;
}

.header__tel a {
    color: #0066cc;
    text-decoration: none;
}

.header__tel a:hover {
    text-decoration: underline;
}

.header__bot-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    background: linear-gradient(135deg, #0088cc 0%, #0066cc 100%);
    border: none;
    border-radius: 980px;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.3);
}

.header__bot-btn:hover {
    background: linear-gradient(135deg, #0099dd 0%, #0077dd 100%);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.4);
    transform: translateY(-1px);
}

.header__bot-btn:active {
    transform: translateY(0) scale(0.98);
}

.header__bot-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* === Help Icon (подсказки) === */
.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #86868b;
    background-color: rgba(0, 0, 0, 0.06);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    vertical-align: middle;
    font-family: inherit;
    line-height: 1;
}

.help-icon:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: #1d1d1f;
}

.help-icon:active {
    transform: scale(0.95);
}

/* === Alert Icon (кнопка !) === */
.help-icon.alert-icon {
    background-color: #f44336;
    color: #fff;
    font-weight: 700;
    animation: pulse 2s infinite ease-in-out;
}

.help-icon.alert-icon:hover {
    background-color: #d32f2f;
    color: #fff;
    animation: none;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.7);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(244, 67, 54, 0);
    }
}

/* === Tooltip === */
.tooltip-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.tooltip-overlay--visible {
    opacity: 1;
    visibility: visible;
}

.tooltip-box {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: calc(100% - 44px);
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    background-color: #fff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 201;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.tooltip-box--visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.tooltip-box__title {
    font-size: 17px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 12px;
}

.tooltip-box__text {
    font-size: 14px;
    color: #6e6e73;
    line-height: 1.5;
}

.tooltip-box__text p {
    margin-bottom: 10px;
}

.tooltip-box__text p:last-child {
    margin-bottom: 0;
}

.tooltip-box__text strong {
    color: #1d1d1f;
}

/* === Elevator Status Tooltip === */
.tooltip-box--elevator {
    max-width: 600px;
}

.tooltip-box--elevator .tooltip-box__text {
    max-height: 60vh;
    overflow-y: auto;
}

#elevatorStatusContent {
    margin-bottom: 16px;
}

.elevator-status-mini-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    margin-bottom: 16px;
}

.elevator-status-mini-table thead {
    background: #f5f5f7;
}

.elevator-status-mini-table th {
    padding: 10px 8px;
    text-align: center;
    font-weight: 600;
    color: #1d1d1f;
    border-bottom: 2px solid #e0e0e0;
    font-size: 14px;
}

.elevator-status-mini-table td {
    padding: 8px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.elevator-status-mini-table tbody tr:hover {
    background-color: #fafafa;
}

.elevator-status-mini-table td:first-child {
    font-weight: 600;
    color: #1d1d1f;
}

.elevator-mini-cell {
    display: inline-block;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    margin: 0 auto;
}

.elevator-mini-cell.grey {
    background: #9E9E9E;
}

.elevator-mini-cell.green {
    background: #4CAF50;
}

.elevator-mini-cell.red {
    background: #F44336;
}

.elevator-mini-cell.red-blink {
    background: #F44336;
    animation: blink-mini 1s infinite ease-in-out;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #FFD700;
}

.elevator-mini-cell.long-broken {
    background: #D32F2F;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #FFFFFF;
    border: 2px solid #B71C1C;
}

@keyframes blink-mini {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.tooltip-elevator-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 500;
    color: #0066cc;
    text-decoration: none;
    transition: color 0.2s ease;
    margin-top: 8px;
}

.tooltip-elevator-link::after {
    content: '→';
    font-size: 16px;
    transition: transform 0.2s ease;
}

.tooltip-elevator-link:hover {
    text-decoration: underline;
    color: #0051a8;
}

.tooltip-elevator-link:hover::after {
    transform: translateX(3px);
}

/* === Main === */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 24px 0 48px;
}

/* === Блок кнопок === */
.buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
}

.buttons__item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 50px;
    padding: 14px 28px;
    font-size: 17px;
    font-weight: 400;
    letter-spacing: -0.022em;
    font-family: inherit;
    color: #fff;
    background-color: #0071e3;
    border: none;
    border-radius: 980px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.buttons__item:hover {
    background-color: #0077ed;
}

.buttons__item:active {
    transform: scale(0.98);
    background-color: #006edb;
}

.buttons__item:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(0, 125, 250, 0.6);
}

/* === Оверлей === */
.overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.48);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(0.25, 0.1, 0.25, 1),
        visibility 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
    z-index: 100;
}

.overlay.overlay--visible {
    opacity: 1;
    visibility: visible;
}

/* === Панель (Bottom Sheet) === */
.panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: auto;
    max-height: 70vh;
    background-color: rgba(255, 255, 255, 0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-radius: 18px 18px 0 0;
    transform: translateY(100%);
    transition: transform 0.5s cubic-bezier(0.32, 0.72, 0, 1);
    z-index: 101;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel.panel--visible {
    transform: translateY(0);
}

.panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 8px;
    flex-shrink: 0;
}

.panel__title {
    font-size: 21px;
    font-weight: 600;
    letter-spacing: 0.011em;
    color: #1d1d1f;
    word-wrap: break-word;
    overflow-wrap: break-word;
    flex: 1;
    min-width: 0;
}

.panel__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    font-size: 20px;
    line-height: 1;
    color: #86868b;
    background-color: rgba(0, 0, 0, 0.06);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.panel__close:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: #1d1d1f;
}

.panel__close:active {
    background-color: rgba(0, 0, 0, 0.15);
}

.panel__body {
    flex: 1;
    padding: 8px 24px 20px;
    overflow: hidden;
}

.panel__text {
    font-size: 14px;
    font-weight: 400;
    color: #6e6e73;
    line-height: 1.42859;
    letter-spacing: -0.016em;
    margin-bottom: 16px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.panel__link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 400;
    color: #0066cc;
    text-decoration: none;
    transition: color 0.2s ease;
}

.panel__link::after {
    content: '›';
    font-size: 18px;
    transition: transform 0.2s ease;
}

.panel__link:hover {
    text-decoration: underline;
}

.panel__link:hover::after {
    transform: translateX(2px);
}

.panel__list {
    list-style: none;
    padding: 0;
    margin: 0 0 16px 0;
}

.panel__list li {
    position: relative;
    padding-left: 16px;
    margin-bottom: 8px;
    font-size: 14px;
    color: #1d1d1f;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.panel__list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: #0066cc;
}

.panel__date {
    font-size: 12px;
    color: #86868b;
    margin-bottom: 12px;
}

/* === Footer === */
.footer {
    padding: 20px 0;
    text-align: center;
    font-size: 12px;
    color: #86868b;
    border-top: 1px solid #d2d2d7;
    background-color: #f5f5f7;
}

/* === Media Queries === */
@media (min-width: 734px) {
    .container {
        padding: 0 44px;
    }

    .header {
        padding: 64px 0 32px;
    }

    .header__logo {
        font-size: 40px;
        margin-bottom: 12px;
    }

    .header__tel {
        font-size: 17px;
    }

    .header__bot-btn {
        font-size: 15px;
        padding: 12px 24px;
    }

    .main {
        padding: 32px 0 64px;
    }

    .buttons {
        gap: 14px;
        max-width: 320px;
    }

    .buttons__item {
        min-height: 56px;
        padding: 16px 32px;
        font-size: 17px;
    }

    .panel {
        left: 50%;
        right: auto;
        transform: translateX(-50%) translateY(100%);
        width: 100%;
        max-width: 540px;
        border-radius: 18px 18px 0 0;
    }

    .panel.panel--visible {
        transform: translateX(-50%) translateY(0);
    }

    .panel__header {
        padding: 24px 32px 12px;
    }

    .panel__title {
        font-size: 24px;
    }

    .panel__body {
        padding: 12px 32px 24px;
    }

    .panel__text {
        font-size: 17px;
        line-height: 1.47059;
    }

    .panel__link {
        font-size: 17px;
    }

    .footer {
        padding: 24px 0;
    }
}

@media (min-width: 1068px) {
    .header__logo {
        font-size: 48px;
    }

    .buttons {
        max-width: 360px;
    }

    .panel {
        max-width: 600px;
    }
}
