/* Reset и базовые стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: 'Inter', sans-serif;
    background: #4C4C4C;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 0;
    margin: 0;
}

/* Основной контейнер приложения */
#app {
    position: relative;
    width: 100%;
    max-width: 375px;
    height: 100vh;
    max-height: 800px;
    overflow: hidden;
    margin: 0 auto;
}

/* Rectangle 2 - Основной фон */
.background-layer {
    position: absolute;
    width: 100%;
    height: 100%;
    background: #595959;
    z-index: 1;
}

/* Rectangle 3 - Верхняя карточка */
.header-card {
    position: absolute;
    width: calc(100% - 20px);
    left: 10px;
    top: 5px;
    height: 137px;
    background: #6E6E6E;
    border-radius: 10px;
    z-index: 2;
}

/* Rectangle 4 - Фон для заголовка */
.title-background {
    position: absolute;
    width: 151px;
    height: 29px;
    left: 50%;
    transform: translateX(-50%);
    top: 8px;
    background: #595959;
    border-radius: 16px;
}

/* Crypto Battle - Заголовок */
.app-title {
    position: absolute;
    width: 149px;
    height: 29px;
    left: 50%;
    transform: translateX(-50%);
    top: 8px;
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-size: 24px;
    line-height: 120%;
    text-align: center;
    letter-spacing: -0.02em;
    background: linear-gradient(90deg, #00B3FF 0%, #95FF00 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Карточки статистики */
.stat-card {
    position: absolute;
    background: #565656;
    border-radius: 10px;
    height: 95px;
}

.balance-card {
    width: 109px;
    left: 5px;
    top: 40px;
}

.stats-card {
    width: 112px;
    left: 120px;
    top: 40px;
}

.hashrate-card {
    width: 117px;
    left: 237px;
    top: 40px;
}

/* Заголовки статистики */
.stat-title {
    position: absolute;
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-size: 14px;
    line-height: 140%;
    text-align: center;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.balance-title {
    width: 50px;
    left: 35px;
    top: 43px;
    color: #00D0FF;
}

.stats-title {
    width: 80px;
    left: 135px;
    top: 43px;
    background: linear-gradient(90deg, #00FFD5 14.9%, #00FF73 71.63%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hashrate-title {
    width: 60px;
    left: 260px;
    top: 43px;
    color: #51FF00;
}

/* Текстовые значения */
.stat-text {
    position: absolute;
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 600;
    font-size: 11px;
    line-height: 16px;
    text-align: center;
    letter-spacing: 0.5px;
    color: #A4FF88;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.balance-line1 {
    width: 74px;
    left: 20px;
    top: 66px;
}

.balance-line2 {
    width: 60px;
    left: 20px;
    top: 89px;
}

.stats-line1 {
    width: 78px;
    left: 135px;
    top: 66px;
}

.stats-line2 {
    width: 93px;
    left: 130px;
    top: 89px;
}

.hashrate-line {
    width: 43px;
    left: 270px;
    top: 75px;
}

/* Основная контентная область */
.main-content-card {
    position: absolute;
    width: calc(100% - 20px);
    left: 10px;
    top: 149px;
    bottom: 90px; /* Оставляем место для навигации */
    background: #6E6E6E;
    border-radius: 10px;
    z-index: 2;
    overflow-y: auto;
}

/* Фон для заголовка контента */
.rooms-title-bg {
    position: absolute;
    width: 215px;
    height: 40px;
    left: 50%;
    transform: translateX(-50%);
    top: 15px;
    background: #565656;
    border-radius: 10px;
}

/* Заголовок контента */
.rooms-title {
    position: absolute;
    width: 205px;
    height: 29px;
    left: 50%;
    transform: translateX(-50%);
    top: 20px;
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-size: 24px;
    line-height: 120%;
    text-align: center;
    letter-spacing: -0.02em;
    color: #00FF1E;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Разделительная линия */
.divider-line {
    position: absolute;
    width: calc(100% - 30px);
    left: 15px;
    top: 70px;
    border: 1px solid #3F3F3F;
}

/* Область контента */
#content-area {
    position: absolute;
    top: 80px;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 10px;
}

/* Карточка помещения */
.room-card {
    width: 100%;
    height: 129px;
    background: #565656;
    border-radius: 10px;
    position: relative;
    margin-bottom: 5px;
}

/* Информация о помещении */
.room-info {
    position: absolute;
    left: 15px;
    top: 6px;
}

.room-name,
.room-slots,
.room-taxes,
.room-status {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-size: 20px;
    line-height: 100%;
    text-align: center;
    color: #FFFFFF;
    height: 24px;
    display: flex;
    align-items: center;
}

.room-name {
    width: 188px;
    top: 0px;
}

.room-slots {
    width: 188px;
    top: 31px;
}

.room-taxes {
    width: 250px;
    top: 62px;
}

.room-status {
    width: 179px;
    top: 93px;
}

/* Кнопка действия в карточке помещения */
.room-action-btn {
    box-sizing: border-box;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    padding: 12px;
    gap: 8px;
    position: absolute;
    width: 117px;
    height: 117px;
    right: 5px;
    top: 5px;
    background: #454444;
    border: 1px solid #4E4E4E;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    outline: none;
}

/* Карточка навигации (фиксированная внизу) */
.navigation-card {
    position: fixed;
    width: calc(100% - 20px);
    max-width: 355px;
    left: 50%;
    transform: translateX(-50%);
    bottom: 10px;
    background: #6E6E6E;
    border-radius: 10px;
    padding: 15px;
    z-index: 1000;
}

/* Нижняя навигация */
.bottom-navigation {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

/* Кнопки навигации */
.nav-btn {
    box-sizing: border-box;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    padding: 12px;
    gap: 8px;
    flex: 1;
    height: 51px;
    background: #2C2C2C;
    border: 1px solid #2C2C2C;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    outline: none;
    transition: background-color 0.3s;
}

.nav-btn.active {
    background: #404040;
    border-color: #00FF1E;
}

/* Текст кнопки */
.btn-text {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-size: 16px;
    line-height: 100%;
    color: #F5F5F5;
    text-align: center;
    user-select: none;
}

/* Контент вкладок */
.tab-content {
    height: 100%;
}

.shop-content,
.alliance-content {
    padding: 20px;
    color: white;
    text-align: center;
}

/* Стили для ошибок и загрузки */
.error {
    text-align: center;
    padding: 20px;
    color: #ff4444;
    background: #2c2c2c;
    border-radius: 10px;
    margin: 20px;
}

.error h3 {
    margin-bottom: 10px;
}

.error button {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 10px;
}

#loading {
    text-align: center;
    padding: 50px;
    font-size: 18px;
    color: white;
}



/* Стили для магазина */
.market-categories {
    display: flex;
    justify-content: space-between;
    gap: 5px;
    margin-bottom: 15px;
    padding: 0 10px;
}

.market-category-btn {
    flex: 1;
    padding: 10px 5px;
    background: #565656;
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.market-category-btn.active {
    background: #404040;
    border: 1px solid #00FF1E;
}

.market-items {
    padding: 0 10px;
}

.market-item-card {
    background: #565656;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.market-item-info {
    flex: 1;
}

.market-item-name {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-size: 18px;
    color: #FFFFFF;
    margin-bottom: 5px;
}

.market-item-stats {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-size: 12px;
    color: #A4FF88;
}

.market-buy-btn {
    background: #2C2C2C;
    border: 1px solid #2C2C2C;
    border-radius: 8px;
    padding: 10px 15px;
    color: white;
    cursor: pointer;
    font-size: 14px;
}

.market-buy-btn:hover:not(:disabled) {
    background: #404040;
}

/* Стили для выбора помещения */
.room-selection-card {
    background: #565656;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.room-selection-info {
    flex: 1;
    color: white;
}

.room-select-btn {
    background: #2C2C2C;
    border: 1px solid #2C2C2C;
    border-radius: 8px;
    padding: 10px 15px;
    color: white;
    cursor: pointer;
    font-size: 14px;
}

/* Стили для попапов */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.popup-content {
    background: #6E6E6E;
    border-radius: 15px;
    padding: 20px;
    max-width: 90%;
    max-height: 80%;
    overflow-y: auto;
    position: relative;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #3F3F3F;
    padding-bottom: 10px;
}

.popup-header h3 {
    color: white;
    margin: 0;
}

.popup-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
}

.popup-body {
    color: white;
}

/* Стили для статистики дохода */
.income-stats-card {
    background: #565656;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 4px solid #00B3FF;
}

.income-stats-card h4 {
    color: #00B3FF;
    margin-bottom: 15px;
    text-align: center;
}

.income-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.income-stat {
    display: flex;
    justify-content: space-between;
    color: #A4FF88;
    font-size: 14px;
    padding: 5px 0;
    border-bottom: 1px solid #3F3F3F;
}

/* Стили для кнопки оплаты налога */
.pay-tax-btn {
    background: #FF4444 !important;
    color: white !important;
}

.pay-tax-btn:hover {
    background: #CC3333 !important;
}

/* Стили для управления помещением */
.management-stats {
    background: #4A4A4A;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    color: white;
}

.equipment-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: #4A4A4A;
    margin-bottom: 5px;
    border-radius: 5px;
    color: white;
}

.management-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.management-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font-weight: 600;
}

.management-btn:first-child {
    background: #00B3FF;
}

.management-btn:last-child {
    background: #6E6E6E;
}