/* assets/css/app.css - V4.0 FIX */

:root {
    --color-dark-bg: #111111; /* Более темный фон для контраста */
    --color-dark-card: #1c1c1c;
    --color-text-primary: #ffffff;
    --color-text-secondary: #aaaaaa;
    --color-primary-green: #00FF66; /* Ярко-зеленый для акцентов */
    --color-primary-dark-green: #00B04A;
    --color-buy: #00FF66;
    --color-sell: #FF5555;
    --color-danger: #f44336;
    --color-border: #333333;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
    --navbar-height: 80px; /* Фиксированная высота для Navbar */
}

/* === GENERAL & STRUCTURE === */

body {
    background-color: var(--color-dark-bg);
    color: var(--color-text-primary);
    font-family: var(--font-family);
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden; 
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Начинаем сверху */
}

.app-container {
    background-color: var(--color-dark-bg);
    width: 100%;
    max-width: 420px; 
    height: 100%;
    position: relative;
    overflow-y: hidden; 
}

.view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    transition: opacity 0.3s ease;
    
    /* ГЛАВНОЕ ИСПРАВЛЕНИЕ: Контент должен быть прокручиваемым и не перекрываться Navbar */
    overflow-y: auto; 
    padding-bottom: calc(var(--navbar-height) + 20px); /* Отступ снизу: Navbar + padding */
}

.view-hidden {
    opacity: 0;
    pointer-events: none;
    z-index: 1;
}

/* === HEADER & CONTENT === */

.header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px 20px;
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text-primary);
    position: sticky;
    top: 0;
    background-color: var(--color-dark-bg);
    z-index: 10;
}

.logo-dot {
    width: 8px;
    height: 8px;
    background-color: var(--color-sell);
    border-radius: 50%;
    margin-right: 8px;
}

.content-area {
    padding: 0 20px 20px 20px; /* Убираем лишний верхний padding, добавляем нижний */
}

/* === CARD COMPONENTS === */

.card {
    background-color: var(--color-dark-card);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* === BUTTONS (Общие) === */

.btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s;
}

.btn-primary {
    background-image: linear-gradient(135deg, var(--color-primary-green) 0%, var(--color-primary-dark-green) 100%);
    color: var(--color-dark-bg);
    margin-bottom: 15px;
}

.btn-secondary {
    background-color: var(--color-dark-card);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}

.btn-disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* === LOGIN VIEW (Настройки для центрирования) === */

#loginView {
    display: flex;
    flex-direction: column;
    justify-content: center; /* Центрируем по вертикали */
    align-items: center;
    text-align: center;
    padding-bottom: 50px; 
}

.login-content {
    width: 100%;
    max-width: 300px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.login-logo {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
}

.login-subtitle {
    color: var(--color-text-secondary);
    margin-bottom: 30px;
}

.input-group {
    width: 100%;
    margin-bottom: 20px;
}

.login-input {
    width: 100%;
    padding: 15px;
    background-color: var(--color-dark-card);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    color: var(--color-text-primary);
    font-size: 16px;
    box-sizing: border-box;
    outline: none;
}

.agreement-group {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--color-text-secondary);
}

.agreement-group input[type="checkbox"] {
    margin-right: 10px;
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--color-border);
    border-radius: 4px;
    position: relative;
    cursor: pointer;
}

.agreement-group input[type="checkbox"]:checked {
    background-color: var(--color-primary-green);
    border-color: var(--color-primary-green);
}

.agreement-group input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--color-dark-bg);
    font-size: 14px;
    font-weight: 700;
}

#loginAgreementLink {
    color: var(--color-text-secondary);
    text-decoration: underline;
    cursor: pointer;
}

.login-error {
    color: var(--color-danger);
    font-size: 14px;
    margin-top: 10px;
    height: 0;
    opacity: 0;
    transition: opacity 0.3s;
}

.login-error.visible {
    height: auto;
    opacity: 1;
}

.login-link {
    font-size: 14px;
    color: var(--color-text-secondary);
    text-decoration: none;
    margin-top: 15px;
    cursor: pointer;
}

/* === LANGUAGE SELECTOR (LOGIN & MENU) === */

.locale-picker {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 20;
}

.language-selector {
    display: flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 8px;
    background-color: var(--color-dark-card);
    cursor: pointer;
    font-size: 14px;
}

.flag-icon {
    width: 24px;
    height: 16px;
    border-radius: 2px;
    margin-right: 5px;
    object-fit: cover;
}

.lang-code {
    font-weight: 600;
    margin-right: 5px;
}

.arrow-down {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--color-text-primary);
    transition: transform 0.2s;
}

.lang-popover {
    position: absolute;
    top: 40px;
    right: 0;
    background-color: var(--color-dark-card);
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease-in-out;
}

.lang-popover.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-option {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    cursor: pointer;
    white-space: nowrap;
}

.lang-option:hover {
    background-color: var(--color-border);
}

/* === MAIN VIEW: ASSETS === */

.asset-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border: 1px solid var(--color-border);
}

.asset-info p:first-child {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin: 0;
}

.asset-info p:last-child {
    font-size: 20px;
    font-weight: 600;
    margin: 5px 0 0 0;
}

.arrow-icon path {
    fill: var(--color-text-primary);
}

.arrow-icon {
    width: 24px;
    height: 24px;
    transform: rotate(0deg); /* Чтобы стрелка смотрела вниз */
}

/* === MAIN VIEW: SCANNING === */

.scanning-card {
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    transition: all 0.5s ease;
    border: 1px solid var(--color-border);
    position: relative;
    overflow: hidden;
}

.scanning-card.do-scan h3 {
    font-size: 24px;
    margin: 0 0 5px 0;
}

.scanning-card.do-scan p {
    font-size: 16px;
    color: var(--color-text-secondary);
    margin: 0;
}

.scanning-status {
    position: absolute;
    top: 15px;
    left: 15px;
    display: flex;
    align-items: center;
    font-size: 16px;
    font-weight: 600;
}

.scanning-status .loader {
    width: 16px;
    height: 16px;
    border: 2px solid var(--color-text-secondary);
    border-top-color: var(--color-primary-green);
    border-radius: 50%;
    margin-left: 8px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.scan-table {
    width: 100%;
    margin-top: 15px;
    border-collapse: collapse;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.scan-table.visible {
    opacity: 1;
}

.scan-table th, .scan-table td {
    padding: 8px 0;
    font-size: 14px;
    border-bottom: 1px solid var(--color-border);
}

.scan-table th {
    text-align: left;
    color: var(--color-text-secondary);
    font-weight: 400;
}

.scan-table tr:last-child td {
    border-bottom: none;
}

.scan-buy {
    color: var(--color-buy);
    font-weight: 600;
    text-align: right;
}

.scan-sell {
    color: var(--color-sell);
    font-weight: 600;
    text-align: right;
}

/* === MAIN VIEW: SIGNAL RESULT === */

#signalOutput {
    height: 80px; 
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    margin-bottom: 20px; /* Добавим отступ перед кнопкой */
}

#signalOutput.waiting-text {
    font-size: 18px;
    color: var(--color-text-secondary);
    font-weight: 500;
}

.result-signal-text {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-bottom: 5px;
}

.result-value-text {
    font-size: 28px;
    font-weight: 800;
}

.result-value-text.buy {
    color: var(--color-buy);
}

.result-value-text.sell {
    color: var(--color-sell);
}

/* === MAIN VIEW: SIGNAL BUTTON (Circular) === */

.signal-button-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    margin-bottom: 20px; /* Отступ от самого низа контента */
    /* Убрано position: sticky, чтобы не было конфликта с оверлеем */
    position: relative; 
    z-index: 5;
}

#signalButton {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background-image: radial-gradient(circle at 50% 50%, var(--color-primary-green) 0%, var(--color-primary-dark-green) 100%);
    color: var(--color-dark-bg);
    font-size: 20px;
    font-weight: 700;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    line-height: 1.2;
    transition: all 0.3s ease;
}

#signalButton.cooldown {
    background-image: radial-gradient(circle at 50% 50%, #333 0%, #1A1A1A 100%);
    color: var(--color-text-primary);
    border: 2px solid var(--color-border);
}

.cooldown-text {
    font-size: 14px;
    font-weight: 500;
}

.cooldown-seconds {
    font-size: 28px;
    font-weight: 700;
    margin-top: 5px;
}

/* === NAVBAR (НИЖНЕЕ МЕНЮ) === */

#navbar {
    position: fixed;
    bottom: 0;
    left: 50%; /* Центрируем, чтобы учесть max-width */
    transform: translateX(-50%); /* Сдвигаем обратно на половину своей ширины */
    width: 100%;
    max-width: 420px; 
    background-color: var(--color-dark-card);
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: var(--navbar-height);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.5);
    z-index: 50; 
    transition: transform 0.3s ease;
    box-sizing: content-box; /* Важно для iOS safe areas */
}

#navbar.view-hidden {
    transform: translate(-50%, 100%); /* Исправлено: скрываем по обеим осям */
    pointer-events: none;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
    flex-grow: 1;
    height: 100%;
    max-width: 120px;
}

.nav-item-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 3px;
}

.nav-item-icon path {
    fill: var(--color-text-secondary);
    transition: fill 0.2s;
}

.nav-item.active {
    color: var(--color-primary-green);
}

.nav-item.active .nav-item-icon path {
    fill: var(--color-primary-green);
}

/* === MENU VIEW & HELP VIEW === */

.menu-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.menu-info p:first-child {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin: 0;
}

.menu-info p:last-child {
    font-size: 18px;
    font-weight: 600;
    margin: 5px 0 0 0;
}

.menu-link-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.menu-telegram-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #0088CC; 
    color: var(--color-text-primary);
    margin-top: 20px;
}

.menu-telegram-btn .icon-svg {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    fill: var(--color-text-primary);
}

/* HELP/FAQ VIEW */
.help-title {
    font-size: 28px;
    font-weight: 700;
    margin: 10px 0 20px 0;
    padding-left: 0; /* Убираем лишний padding */
}

.faq-question-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
}

.faq-question-card .arrow-icon {
    transform: rotate(0deg); 
}

/* === MODAL & SHEETS (Общие стили) === */

.modal-overlay, .sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
}

.modal-overlay.visible, .sheet-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--color-dark-card);
    border-radius: 15px;
    padding: 25px;
    width: 90%;
    max-width: 380px;
    transform: translateY(-20px);
    transition: transform 0.3s;
}

.modal-overlay.visible .modal-content {
    transform: translateY(0);
}

.modal-title {
    font-size: 20px;
    margin-top: 0;
    margin-bottom: 20px;
    font-weight: 700;
    text-align: center;
}

.modal-list {
    list-style: none;
    padding: 0;
    margin-bottom: 20px;
}

.modal-list li {
    margin-bottom: 10px;
    font-size: 15px;
    color: var(--color-text-secondary);
    padding-left: 20px;
    position: relative;
}

.modal-list li:before {
    content: "•";
    color: var(--color-primary-green);
    font-weight: bold;
    display: inline-block;
    width: 1em;
    margin-left: -1em;
    position: absolute;
    left: 0;
}

.modal-promo-block {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--color-dark-bg);
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px dashed var(--color-border);
}

#promoCodeValue {
    font-weight: 700;
    font-size: 16px;
    color: var(--color-text-primary);
}

#copyPromoButton {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
}

#copyPromoButton .icon-svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.faq-answer-text {
    color: var(--color-text-secondary);
    font-size: 15px;
}

/* === ASSET SHEET (Bottom Pop-up) === */

.asset-sheet {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translate(-50%, 100%);
    width: 100%;
    max-width: 420px;
    background-color: var(--color-dark-card);
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
    max-height: 80vh;
    transition: transform 0.3s ease-out;
    padding: 20px;
    box-sizing: border-box;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

.sheet-overlay.visible .asset-sheet {
    transform: translate(-50%, 0);
}

.asset-sheet-header {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 15px;
    text-align: center;
}

.asset-sheet-list {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.asset-item {
    padding: 12px 10px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
}

.asset-item:last-child {
    border-bottom: none;
}

.asset-item:hover {
    background-color: var(--color-dark-bg);
}
/* assets/css/app.css - Стили для прокручиваемого тела модального окна */

.modal-body-scrollable {
    max-height: 70vh; /* Максимальная высота для скролла */
    overflow-y: auto; /* Включение прокрутки */
    color: var(--color-text-secondary);
    padding-right: 10px; /* Отступ для скроллбара */
    margin-bottom: 20px;
}

.modal-body-scrollable p {
    margin-bottom: 1em;
    line-height: 1.4;
    font-size: 15px;
}

.modal-body-scrollable strong {
    color: var(--color-text-primary);
}
