/* ===================================
   CURRENCY MODALS
   Модалы валют (Credits, Gems, Stars, TON)
   =================================== */

/* ===================================
   MODAL POSITIONING
   Используют универсальную систему from variables.css
   =================================== */

#creditsModal .profile-compact-panel,
#gemsModal .profile-compact-panel,
#starsModal .profile-compact-panel,
#tonModal .profile-compact-panel {
    top: var(--panel-top-offset) !important;
    bottom: var(--bottom-nav-height) !important;
    transform: translateX(-50%) !important;
    height: auto !important;
    max-height: none !important;
}

/* ===================================
   CURRENCY INFO & BALANCE DISPLAY
   =================================== */

.currency-info {
    padding: var(--spacing-md);
    text-align: center;
}

.current-balance {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.currency-info-centered {
    text-align: center;
    padding: 20px 20px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

.current-balance-large > span {
    display: block;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
}

.balance-display {
    font-size: 24px;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.income-info {
    margin-bottom: 15px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

/* ===================================
   CURRENCY ACTIONS & EXCHANGE
   =================================== */

.currency-actions {
    padding: var(--spacing-lg);
}

.currency-actions-centered {
    padding: 20px;
}

.currency-actions-centered h3 {
    text-align: center;
    margin: 0 0 16px 0;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
}

.currency-description-small {
    margin-bottom: 20px;
}

.currency-description-small p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    margin: 0;
}

/* ===================================
   EXCHANGE SECTIONS
   =================================== */

.exchange-section-improved {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.exchange-section-improved .exchange-rate {
    text-align: center;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 12px;
}

.exchange-input-group {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.exchange-input-group input {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 10px 12px;
    color: white;
    font-size: 14px;
}

.exchange-input-group input:focus {
    outline: none;
    border-color: rgba(76, 175, 255, 0.5);
    background: rgba(255, 255, 255, 0.15);
}

.exchange-btn-improved {
    background: linear-gradient(135deg, #4CAFFF, #8A2BE2);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.exchange-btn-improved:hover {
    background: linear-gradient(135deg, #5BBFFF, #9B3BF3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 255, 0.3);
}

.exchange-btn-improved:active {
    transform: translateY(0);
}

.exchange-result {
    text-align: center;
    margin-top: 12px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

.exchange-result span {
    font-weight: bold;
    color: #4CAFFF;
}

/* ===================================
   STARS MODAL - PURCHASE GRID
   =================================== */

.stars-purchase-container {
    padding: 20px;
}

.purchase-grid-compact {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.purchase-card-compact {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 14px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.3s ease;
}

.purchase-card-compact:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.15);
}

.purchase-amount {
    font-size: 18px;
    font-weight: bold;
    color: #FFD700;
    margin-bottom: 4px;
}

.purchase-price {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 6px;
}

.purchase-btn-compact {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #1a1a1a;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.purchase-btn-compact:hover {
    background: linear-gradient(135deg, #FFE55C, #FFB347);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.purchase-btn-compact:active {
    transform: scale(0.98);
}

/* Stars Modal Pagination */
.header-pagination {
    display: flex;
    gap: 6px;
    align-items: center;
}

.header-pagination-btn {
    background: none;
    border: none;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    padding: 4px;
    transition: all 0.2s ease;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.header-pagination-btn:hover {
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.08);
}

.header-pagination-btn.active {
    color: #FFD700;
    background: rgba(255, 215, 0, 0.15);
}

/* ===================================
   TON WALLET MODAL
   =================================== */

/* TON Connect Section */
.ton-connect-compact {
    text-align: center;
    padding: 20px;
}

.ton-connect-compact p {
    margin-bottom: 15px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
}

.ton-connect-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #0088cc, #0066aa);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 136, 204, 0.3);
}

.ton-connect-button:hover {
    background: linear-gradient(135deg, #0099dd, #0077bb);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 136, 204, 0.4);
}

.ton-connect-button:active {
    transform: translateY(0);
}

.ton-connect-button .button-icon {
    font-size: 16px;
}

.ton-connect-button .button-text {
    font-size: 14px;
}

/* Connected Wallet Display */
.wallet-info-centered {
    padding: 20px;
}

.wallet-address-centered {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.wallet-address-centered span:first-child {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    min-width: 80px;
}

.address-value-full {
    flex: 1;
    font-family: monospace;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.08);
    padding: 8px 12px;
    border-radius: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 200px;
}

.wallet-balance-centered {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.wallet-balance-centered span:first-child {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}

.wallet-balance-centered .balance-value {
    font-size: 18px;
    font-weight: bold;
    color: #0088cc;
}

/* TON Actions */
.ton-actions-improved {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.ton-action-btn-improved {
    flex: 1;
    min-width: 100px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.ton-action-btn-improved:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

.ton-action-btn-improved:active {
    transform: translateY(0);
}

.ton-action-btn-improved.deposit {
    border-color: rgba(76, 175, 80, 0.4);
}

.ton-action-btn-improved.deposit:hover {
    background: rgba(76, 175, 80, 0.15);
    border-color: rgba(76, 175, 80, 0.6);
}

.ton-action-btn-improved.withdraw {
    border-color: rgba(255, 152, 0, 0.4);
}

.ton-action-btn-improved.withdraw:hover {
    background: rgba(255, 152, 0, 0.15);
    border-color: rgba(255, 152, 0, 0.6);
}

.ton-action-btn-improved.disconnect {
    border-color: rgba(244, 67, 54, 0.4);
}

.ton-action-btn-improved.disconnect:hover {
    background: rgba(244, 67, 54, 0.15);
    border-color: rgba(244, 67, 54, 0.6);
}

.ton-action-btn-improved .btn-icon {
    font-size: 20px;
}

.ton-action-btn-improved .btn-text {
    font-size: 12px;
}

/* Currency Icon in TON Modal */
.currency-icon {
    width: 1em;
    height: 1em;
    vertical-align: baseline;
    display: inline-block;
}

/* ===================================
   RESPONSIVE
   =================================== */

@media (max-width: 480px) {
    .purchase-grid-compact {
        grid-template-columns: 1fr;
        max-width: 220px;
        margin: 0 auto 16px;
    }

    .purchase-card-compact {
        padding: 12px;
    }

    .purchase-amount {
        font-size: 16px;
    }

    .purchase-price {
        font-size: 12px;
    }

    .ton-actions-improved {
        flex-direction: column;
    }

    .ton-action-btn-improved {
        min-width: auto;
        width: 100%;
    }

    .exchange-input-group {
        flex-direction: column;
    }
}

@media (max-width: 400px) {
    .currency-actions-centered {
        padding: 16px;
    }

    .wallet-address-centered {
        flex-direction: column;
        align-items: stretch;
    }

    .address-value-full {
        min-width: auto;
        text-align: center;
        font-size: 12px;
    }
}
