:root {
    --bg-color: #121212;
    --card-bg: #1c1c1e;
    --bg-color-alt: #0F0F0F; /* Исправил дубликат bg-color */
    --text-white: #ffffff;
    --primary-blue: #007aff;
    --text-gray: #8A8A8A;
    --accent-blue: #3E9CF5;
    --btn-dark: #202020;
    --spacing: 16px;
    --btn-blue: #3390EC;
    --nav-bg: #1C1C1E;
    --text-muted: #8e8e93;
    
    /* --- ДОБАВЛЕНЫ НЕДОСТАЮЩИЕ ПЕРЕМЕННЫЕ ДЛЯ POP-UP --- */
    --input-bg: #2c2c2e; 
    --text-main: #ffffff;
    
    /* Новые цвета для Pop-up фильтров */
    --modal-bg: #212121;
    --modal-overlay-bg: rgba(0, 0, 0, 0.7);
    --separator-color: #2A2A2A;
    --radio-border: #3A3A3A;
    --btn-clean-bg: #333333;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-white);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* --- Global Header & Nav --- */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
}
.header-title { font-size: 20px; font-weight: 600; }
.header-icons { display: flex; gap: 20px; font-size: 18px; color: #ccc; }

.wallet-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
}
.balance-pill {
    background-color: var(--btn-dark);
    padding: 6px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
}
.ton-pill {
    background-color: var(--btn-blue);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}
.plus-icon {
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

/* --- DRX Page Styles (History List) --- */
.drx-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px 16px 20px;
}
.drx-title-text { font-size: 28px; font-weight: 700; }
.drx-filter-button {
    background-color: var(--btn-dark); color: #ddd; padding: 8px 16px;
    border-radius: 20px; border: none; display: flex; align-items: center;
    gap: 8px; font-size: 14px; cursor: pointer;
}

.drx-main-wrapper {
    flex: 1; display: flex; flex-direction: column; overflow-y: auto;
    padding-bottom: 80px; position: relative;
}

/* --- Стили для кота (Загрузка) --- */
.drx-view-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
}
.drx-img-cat {
    width: 150px;
    height: auto;
    margin-bottom: 20px;
    display: block;
}
.drx-text-empty {
    font-size: 16px;
    margin-bottom: 12px;
    color: #eee;
}
.drx-link-back {
    color: var(--accent-blue);
    text-decoration: none;
    font-size: 16px;
    cursor: pointer;
}

/* --- Список истории --- */
.drx-view-list { width: 100%; }
.drx-date-label {
    color: var(--text-gray); font-size: 13px; padding: 0 20px 8px 20px; font-weight: 500;
}
.drx-card-item {
    display: flex;          /* Оставляем как было! */
    align-items: center;    /* Оставляем как было! */
    padding: 12px 20px;     /* Оставляем как было! */
    
    position: relative;     /* Добавили: чтобы время "липло" к этой карточке */
    transition: background-color 0.2s ease; /* Добавили: плавность */
    text-decoration: none;  /* Сброс стилей ссылки */
    color: inherit;         /* Сброс цвета ссылки */
}
.drx-card-item:hover {
    /* Цвет затемнения. rgba(0,0,0, 0.2) - это полупрозрачный черный */
    background-color: rgba(0, 0, 0, 0.2); 
}
.timestamp {
    position: absolute;   /* Вырываем из потока, чтобы прижать в угол */
    right: 12px;          /* Отступ справа */
    top: 12px;            /* Отступ сверху */
    font-size: 10px;      /* Маленький шрифт */
    color: var(--text-gray); /* Твой цвет из переменных */
    opacity: 0.8;         /* Чуть приглушаем */
    pointer-events: none; /* Чтобы не мешало кликать */
}
.drx-card-thumb {
    width: 48px; height: 48px; border-radius: 12px; overflow: hidden;
    margin-right: 16px; background-color: var(--btn-dark); flex-shrink: 0;
}
.drx-card-img { width: 100%; height: 100%; object-fit: cover; }
.drx-card-info {
    flex: 1; display: flex; flex-direction: column; gap: 4px; margin-right: 12px;
}
.drx-info-title { font-size: 16px; font-weight: 600; color: var(--text-white); }
.drx-info-sub { font-size: 14px; color: var(--text-gray); }
.withdraw-btn {
    background-color: var(--btn-blue); color: white; border: none; padding: 8px 16px;
    border-radius: 20px; font-size: 14px; font-weight: 500; display: flex;
    align-items: center; gap: 8px; cursor: pointer; white-space: nowrap;
}

.currency-bar {
    display: flex;
    justify-content: space-between;
    padding: 0 var(--spacing);
    margin-bottom: 15px;
}
.currency-pill {
    background: #2c2c2e;
    padding: 6px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.048),
                inset 0 -1px 1px rgba(34, 34, 34, 0.1);
}
.custom-star-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    margin-right: 2px;
    vertical-align: middle; 
}

/* --- Bottom Nav --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255,255,255,0.05);
    display: flex;
    justify-content: space-around;
    padding: 10px 0 32px 0;
    z-index: 100;
}
.nav-icon.svg-icon {
    width: 26px; 
    height: 26px;
    margin-bottom: 3px;
    fill: currentColor; 
    display: block; 
    transition: fill 0.2s ease;
}
.nav-item {
    display: flex;
    flex-direction: column; 
    justify-content: flex-start;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted); 
    flex: 1;
    position: relative; 
    padding: 6px 0;
}
.nav-item span {
    font-size: 10px;
    font-weight: 500;
    margin-top: 2px;
}
.nav-item.active {
    color: var(--primary-blue);
}
.text-badge {
    display: inline-flex; 
    align-items: center;
    justify-content: center;
    background: var(--primary-blue);
    color: white;
    font-size: 2px; 
    height: 12px;
    min-width: 12px; 
    padding: 6 6px;
    border-radius: 80px;
    font-weight: 200;
    margin-left:1px; 
    vertical-align: top;
    line-height: 1;
}

/* =========================================
   POP-UP FILTERS (Фильтры)
   ========================================= */
.drx-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-overlay-bg);
    z-index: 100;
    display: none; 
    justify-content: center;
    align-items: flex-end; 
    padding: 6px; 
    padding-bottom: 24px; 
}
.drx-modal-container {
    background-color: var(--modal-bg);
    width: 100%; 
    max-width: none; 
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: slideUp 0.2s ease-out;
}
@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.drx-modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.drx-modal-title { font-size: 24px; font-weight: 700; color: var(--text-white); }
.drx-modal-close-btn { background: none; border: none; color: var(--text-white); font-size: 26px; cursor: pointer; padding: 4px; }
.drx-modal-body { display: flex; flex-direction: column; margin-bottom: 14px; }
.drx-filter-item { display: flex; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--separator-color); cursor: pointer; }
.drx-filter-item:last-child { border-bottom: none; }
.drx-filter-radio { display: none; }
.drx-radio-circle { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--radio-border); background-color: transparent; margin-right: 16px; position: relative; flex-shrink: 0; transition: all 0.2s ease; }
.drx-filter-label { font-size: 18px; font-weight: 400; color: var(--text-white); }
.drx-modal-footer { display: flex; gap: 4px; }
.drx-btn-clean, .drx-btn-show { flex: 1; padding: 14px; border-radius: 14px; border: none; font-size: 16px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.drx-btn-clean { background-color: var(--btn-clean-bg); color: var(--text-white); }
.drx-btn-show { background-color: var(--btn-blue); color: var(--text-white); }


/* =======================================================
   СТИЛИ ДЛЯ WITHDRAW POP-UP (Исправленные)
   ======================================================= */

/* 1. Задний фон (Затемнение) */
.popup-backdrop { 
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); 
    display: none; /* Скрыто по умолчанию */
    justify-content: center;
    align-items: center; /* Центрируем окно */
    z-index: 1000;
    backdrop-filter: blur(5px);
    padding-bottom: max(30px, env(safe-area-inset-bottom));
}

/* Класс для отображения через JS */
.popup-backdrop.visible {
    display: flex;
}

/* 2. Само модальное окно (Карточка) */
.modal {
    background-color: var(--card-bg); /* #1c1c1e */
    width: 90%;             /* Адаптивная ширина */
    max-width: 400px;       /* Максимальная ширина (как в Gifts) */
    border-radius: 20px;    /* Скругление углов */
    padding: 16px;          /* Внутренние отступы */
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 1001;
}

/* Кнопка закрытия (крестик) */
.close-btn {
    position: absolute;
    top: 4px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 32px;
    cursor: pointer;
    z-index: 10;
}

/* Главная картинка */
.main-image-container {
    width: 60%;
    margin: 0 auto 16px auto; 
    aspect-ratio: 1 / 1; 
    border-radius: 16px;
    overflow: hidden;
    background-color: var(--input-bg);
    position: relative; 
}
.main-image-container img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Текст поверх картинки */
.image-title-overlay {
    position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%);
    text-align: center; width: 100%; z-index: 5;
}
.overlay-title { font-size: 22px; font-weight: 600; color: white; line-height: 1.2; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.overlay-subtitle { font-size: 14px; color: rgba(255, 255, 255, 0.8); margin-top: 2px; }

/* Кнопки действий (Send, List, Withdraw) */
.actions-grid {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 16px;
}
.action-btn {
    background-color: var(--input-bg); border: none; border-radius: 12px; padding: 12px 0;
    color: var(--text-white); display: flex; flex-direction: column; align-items: center;
    justify-content: center; cursor: pointer;
}
.action-btn svg, .action-btn i { margin-bottom: 6px; font-size: 18px; }
.action-label { font-size: 13px; font-weight: 500; }

/* Таблица информации */
.info-table {
    background-color: var(--input-bg); border-radius: 12px; overflow: hidden; margin-bottom: 16px;
}
.info-row {
    display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid #3a3a3a;
}
.info-row:last-child { border-bottom: none; }
.info-label { width: 30%; color: var(--text-gray); font-size: 14px; }
.info-value { flex-grow: 1; font-size: 14px; display: flex; align-items: center; color: var(--text-white); }
.link-text { color: var(--btn-blue); text-decoration: none; margin-right: 8px; }
.percent-badge {
    background-color: rgba(51, 144, 236, 0.15); color: var(--btn-blue);
    padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: bold;
}

/* Ошибка */
.error-box {
    background-color: rgba(235, 77, 61, 0.15); border-radius: 12px; padding: 12px;
    display: flex; align-items: flex-start; gap: 12px; margin-bottom: 20px;
}
.error-icon {
    width: 20px; height: 20px; background-color: #eb4d3d; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; color: white;
    font-weight: bold; font-size: 12px; flex-shrink: 0;
}
.error-text { color: #eb4d3d; font-size: 13px; line-height: 1.4; }

/* Футер попапа */
.footer-info {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px; font-size: 13px; color: var(--text-gray);
}
.reward-val { color: var(--text-white); display: flex; align-items: center; font-weight: 600; }
.footer-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-large { padding: 14px; border-radius: 12px; border: none; font-size: 15px; font-weight: 600; cursor: pointer; }
.btn-cancel { background-color: var(--input-bg); color: var(--text-white); }
.btn-auth { background-color: var(--btn-blue); color: white; }

/* Эффекты нажатия */
button:active, .action-btn:active {
    transform: scale(0.96);
    opacity: 0.8;
}

/* Основной контейнер плашки */
.card {
    position: relative; /* Обязательно: чтобы время позиционировалось относительно этой плашки */
    background-color: #ffffff; /* Исходный цвет */
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: background-color 0.3s ease, transform 0.2s ease; /* Плавность */
    cursor: pointer; /* Курсор превращается в указатель */
    overflow: hidden; /* Чтобы ничего не вылезало за края */
}

/* 1. Эффект затемнения при наведении */
.card:hover {
    background-color: #e0e0e0; /* Цвет становится темнее */
    /* Альтернативный вариант (если есть картинка): filter: brightness(0.9); */
}

/* 2. Стили для надписи времени */
.timestamp {
    position: absolute; /* Позиционируем свободно внутри родителя */
    bottom: 8px;        /* Отступ снизу */
    right: 12px;        /* Отступ справа (край) */
    font-size: 10px;    /* Маленькие буквы */
    color: #888888;     /* Ненавязчивый серый цвет */
    font-weight: 500;
}