/* Стили для калькулятора iOS 18 */
.calculator-app {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: #000;
    color: #fff;
    position: relative;
    padding: 20px;
}

.calculator-breadcrumb {
    position: absolute;
    top: 20px;
    left: 20px;
    background: none;
    border: none;
    color: #ff9f0a;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    z-index: 2;
}

.calculator-display-container {
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 20px 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.calculator-display-container::-webkit-scrollbar {
    display: none;
}

.calculator-display {
    font-size: 96px;
    font-weight: 200;
    text-align: right;
    white-space: nowrap;
    padding-bottom: 20px;
}

.calculator-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 20px 0;
}

.calculator-button {
    aspect-ratio: 1;
    border-radius: 50%;
    border: none;
    font-size: 32px;
    color: #fff;
    background-color: #333;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calculator-button.zero {
    grid-column: 2 / span 1;
    aspect-ratio: 1;
    border-radius: 50%;
    justify-content: center;
    padding: 0;
}

.calculator-button.calc-type {
    background-color: #333;
}

.calculator-button.calc-type svg {
    width: 24px;
    height: 24px;
    fill: #fff;
}

.calculator-button.operator {
    background-color: #ff9f0a;
    color: #fff;
    font-size: 40px;
}

.calculator-button.function {
    background-color: #a5a5a5;
    color: #000;
}

.calculator-button.equals {
    background-color: #ff9f0a;
    color: #fff;
}

.calculator-button:active {
    opacity: 0.7;
}

.calculator-type-menu {
    position: fixed;
    top: 60px;
    left: 10px;
    background-color: rgba(50, 50, 50, 0.95);
    border-radius: 12px;
    padding: 8px;
    z-index: 1000;
}

.calculator-type-menu .menu-option {
    display: block;
    width: 100%;
    padding: 12px 24px;
    text-align: left;
    background: none;
    border: none;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    border-radius: 8px;
}

.calculator-type-menu .menu-option.active {
    background-color: rgba(255, 255, 255, 0.1);
}

.calculator-type-menu .menu-option:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.swipe-area {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(to bottom, rgba(255,255,255,0.1), transparent);
    border-radius: 12px 12px 0 0;
}

/* Зона отображения результата */
.calculator-display {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    padding: 20px;
    font-size: 80px;
    font-weight: 200;
    min-height: 120px;
    word-break: break-all;
    text-align: right;
}

.result-value {
    font-size: 70px;
    font-weight: 200;
    line-height: 1;
    margin-bottom: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    min-height: 70px;
}

.operation-history {
    color: rgba(255, 255, 255, 0.6);
    font-size: 28px;
    font-weight: 300;
    margin-bottom: 10px;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    height: 34px;
    opacity: 0;
    transition: opacity 0.2s;
}

.operation-history.visible {
    opacity: 1;
}

/* Кнопка меню */
.menu-btn {
    font-size: 24px;
    background-color: #333333;
}

/* Типы кнопок */
.number {
    background-color: #333333;
}

.operator {
    background-color: #FF9F0A;
    font-size: 35px;
}

.function {
    background-color: #A5A5A5;
    color: #000;
}

/* Меню переключения режимов */
.calculator-menu {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(150%);
    background-color: rgba(60, 60, 60, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    padding: 10px;
    transition: transform 0.3s ease;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

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

.menu-option {
    background: none;
    border: none;
    color: white;
    padding: 12px 24px;
    font-size: 18px;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s;
    border-radius: 10px;
}

.menu-option:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.menu-option.active {
    background-color: #FF9F0A;
    color: #000;
    font-weight: 500;
}

/* Кнопка "Назад" */
.calculator-back-button {
    position: absolute;
    top: 20px;
    left: 20px;
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    padding: 10px;
    z-index: 10;
    display: none;
}

/* Показываем кнопку "Назад" только в полноэкранном режиме */
.app-container.open .calculator-back-button {
    display: block;
}

/* Адаптация к полноэкранному режиму */
.app-container.open .calculator-app {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    height: 100vh;
    height: calc(100vh - env(safe-area-inset-bottom, 0));
    display: flex;
    flex-direction: column;
}

/* Скрываем заголовок приложения в полноэкранном режиме калькулятора */
.app-container.open[data-app-id="calculator"] .app-header {
    display: none;
}

/* Адаптивность */
@media (max-width: 380px) {
    .calculator-display {
        font-size: 72px;
    }
    
    .calculator-button {
        font-size: 28px;
    }
    
    .calculator-button.operator {
        font-size: 36px;
    }
}

@media (max-height: 700px) {
    .calculator-display {
        font-size: 64px;
        padding-bottom: 10px;
    }
    
    .calculator-buttons {
        gap: 8px;
        padding: 10px 0;
    }
} 