/* Запрет выделения текста на всех элементах */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Разрешаем выделение только в полях ввода */
input,
textarea,
[contenteditable="true"] {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Убираем синий квадратик (outline) при фокусе на всех элементах */
*:focus {
    outline: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* Убираем синюю подсветку при тапе на мобильных */
button,
div,
span,
a {
    -webkit-tap-highlight-color: transparent !important;
}

/* Убираем outline для кнопок и интерактивных элементов */
button:focus,
button:active,
div:focus,
div:active {
    outline: none !important;
    box-shadow: none !important;
}

/* Для ссылок тоже убираем подсветку */
a {
    -webkit-tap-highlight-color: transparent;
}

/* Убираем стандартный фокус у input, но оставляем возможность ввода */
input:focus,
textarea:focus,
select:focus {
    outline: none !important;
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* CSS переменные для тем */
:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    --text-primary: #ffffff;
    --text-secondary: #9ca3af;
    --border-color: rgba(255, 255, 255, 0.1);
    --card-bg: #1e293b;
    --input-bg: #334155;
    --hover-bg: rgba(255, 255, 255, 0.1);
    --header-bg: rgba(15, 23, 42, 0.95);
    --menu-bg: rgba(30, 41, 59, 0.95);
    --modal-bg: #1e293b;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg-primary: #f3f4f6;
        --bg-secondary: #ffffff;
        --bg-card: #ffffff;
        --text-primary: #111827;
        --text-secondary: #6b7280;
        --border-color: rgba(0, 0, 0, 0.1);
        --card-bg: #ffffff;
        --input-bg: #f9fafb;
        --hover-bg: rgba(0, 0, 0, 0.05);
        --header-bg: rgba(255, 255, 255, 0.95);
        --menu-bg: rgba(255, 255, 255, 0.95);
        --modal-bg: #ffffff;
    }
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    --text-primary: #ffffff;
    --text-secondary: #9ca3af;
    --border-color: rgba(255, 255, 255, 0.1);
    --card-bg: #1e293b;
    --input-bg: #334155;
    --hover-bg: rgba(255, 255, 255, 0.1);
    --header-bg: rgba(15, 23, 42, 0.95);
    --menu-bg: rgba(30, 41, 59, 0.95);
    --modal-bg: #1e293b;
}

[data-theme="light"] {
    --bg-primary: #f3f4f6;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: rgba(0, 0, 0, 0.1);
    --card-bg: #ffffff;
    --input-bg: #f9fafb;
    --hover-bg: rgba(0, 0, 0, 0.05);
    --header-bg: rgba(255, 255, 255, 0.95);
    --menu-bg: rgba(255, 255, 255, 0.95);
    --modal-bg: #ffffff;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
    transition: background-color 0.3s, color 0.3s;
}

.app-header {
    background: var(--header-bg);
    border-color: var(--border-color);
}

.app-title {
    color: var(--text-primary);
}

.header-btn {
    background: var(--hover-bg);
}

.header-icon {
    color: var(--text-secondary);
}

/* Вспомогательный класс для вторичного текста */
.text-secondary {
    color: var(--text-secondary) !important;
}

/* Нижнее меню */
.bottom-menu {
    backdrop-filter: blur(10px);
    background: var(--menu-bg);
    border-top: 1px solid var(--border-color);
    padding: 6px 10px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
}

.menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 10px;
    border-radius: 16px;
    transition: all 0.15s ease;
    cursor: pointer;
    color: var(--text-secondary);
    min-width: 56px;
}

.menu-item i {
    font-size: 18px;
    line-height: 1;
}

.menu-item span {
    font-size: 10px;
    font-weight: 500;
    text-align: center;
    line-height: 1.2;
}

.menu-item.active {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.12);
}

.menu-item:hover {
    color: var(--text-primary);
    background: var(--hover-bg);
}

/* Карточки */
.card-gradient {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
}

.page {
    display: none;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.action-btn {
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    transform: translateY(-2px);
}

/* Модальные окна */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--modal-bg);
    border-radius: 20px;
    padding: 20px;
    max-width: 90%;
    width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    color: var(--text-primary);
}

.modal-item {
    background: var(--input-bg);
}

.modal-date {
    color: var(--text-secondary);
}

.modal-description {
    color: var(--text-secondary);
}

.modal-close-btn {
    background: var(--input-bg);
    color: var(--text-primary);
}

.modal-input {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.modal-input::placeholder {
    color: var(--text-secondary);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    pointer-events: none;
    z-index: 1000;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Loader */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s;
}

.loader-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader {
    text-align: center;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border-color);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loader-text {
    color: var(--text-primary);
    font-size: 16px;
}

/* Кошелёк */
.wallet-address {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: monospace;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Транзакции */
.transaction-item {
    border-bottom: 1px solid var(--border-color);
}

.transaction-item:last-child {
    border-bottom: none;
}

.transaction-date {
    color: var(--text-secondary);
}

/* Инпуты */
input,
select,
textarea {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

input::placeholder {
    color: var(--text-secondary);
}

.input-container {
    background: var(--input-bg);
}

.input-label {
    color: var(--text-secondary);
}

.deposit-input {
    background: var(--bg-primary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

/* Реферальная программа */
.ref-banner {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(147, 51, 234, 0.1));
}

.ref-link-label {
    color: var(--text-secondary);
}

.ref-stat-label {
    color: var(--text-secondary);
}

/* Компактные стили для статистики рефералов */
.ref-stats-container {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 12px 6px;
}

.ref-stat-item {
    text-align: center;
    flex: 1;
}

.ref-stat-value {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 2px;
}

.ref-stat-label-compact {
    font-size: 9px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.ref-stat-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
}

/* Настройки */
.settings-section {
    margin-bottom: 20px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Блок статуса с кнопкой под холдером */
.settings-status-block {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
}

.settings-status-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
}

.status-icon {
    font-size: 16px;
    color: var(--text-secondary);
}

.settings-action-btn-full {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-action-btn-full:hover {
    background: #2563eb;
    transform: translateY(-2px);
}

/* Кнопки языка */
.language-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.lang-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 10px 6px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lang-btn svg {
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.lang-btn:hover {
    background: var(--hover-bg);
    transform: translateY(-2px);
}

/* Кнопки темы */
.theme-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.theme-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 10px 6px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-btn i {
    font-size: 16px;
}

.theme-btn:hover {
    background: var(--hover-bg);
    transform: translateY(-2px);
}

.theme-btn.active,
.lang-btn.active {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

/* Стили для выбора токена */
.token-select-item {
    padding: 14px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.token-select-item:hover {
    background: var(--hover-bg);
    transform: translateY(-2px);
}

/* Вкладки депозитов */
.deposit-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    background: var(--input-bg);
    padding: 4px;
    border-radius: 12px;
}

.deposit-tab {
    flex: 1;
    padding: 8px 4px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
    border: none;
    color: var(--text-secondary);
}

.deposit-tab:hover {
    background: var(--hover-bg);
}

.deposit-tab.active {
    background: #3b82f6;
    color: white;
}

.deposit-list {
    display: none;
}

.deposit-list.active {
    display: block;
}

.deposit-item {
    background: var(--input-bg);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
}

.deposit-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.deposit-item-amount {
    font-weight: 600;
    font-size: 13px;
}

.deposit-item-rate {
    color: #10b981;
    font-size: 12px;
}

.deposit-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
}

.deposit-status {
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 500;
}

.deposit-status.active {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.deposit-status.completed {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.deposit-status.reinvest {
    background: rgba(168, 85, 247, 0.2);
    color: #a855f7;
}

/* Контейнер для двух кнопок */
.deposit-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

/* Кнопка Реинвест */
.reinvest-btn {
    flex: 1;
    background: #a855f7;
    color: white;
    border: none;
    border-radius: 16px;
    padding: 6px 8px;
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reinvest-btn:hover {
    background: #9333ea;
    transform: translateY(-1px);
}

/* Кнопка Вывести (для завершённых депозитов) */
.withdraw-completed-btn {
    flex: 1;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 16px;
    padding: 6px 8px;
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.withdraw-completed-btn:hover {
    background: #dc2626;
    transform: translateY(-1px);
}