/* Hermes Mini App — Dark Trading Theme */
:root {
    --bg: #0d1117;
    --bg-card: #161b22;
    --bg-card-hover: #1c2333;
    --border: #30363d;
    --text: #e6edf3;
    --text-muted: #8b949e;
    --accent: #58a6ff;
    --green: #3fb950;
    --red: #f85149;
    --yellow: #d29922;
    --purple: #bc8cff;
    --gradient-green: linear-gradient(135deg, #238636, #2ea043);
    --gradient-red: linear-gradient(135deg, #da3633, #f85149);
    --gradient-blue: linear-gradient(135deg, #1f6feb, #58a6ff);
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding: 0 0 40px 0;
    -webkit-font-smoothing: antialiased;
}

/* Telegram theme adaptation */
body.tg-theme {
    --bg: var(--tg-theme-bg-color, #0d1117);
    --bg-card: var(--tg-theme-secondary-bg-color, #161b22);
    --text: var(--tg-theme-text-color, #e6edf3);
    --accent: var(--tg-theme-link-color, #58a6ff);
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(180deg, rgba(88, 166, 255, 0.08) 0%, transparent 100%);
    border-bottom: 1px solid var(--border);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    font-size: 32px;
    filter: drop-shadow(0 0 8px rgba(88, 166, 255, 0.3));
}

.header h1 {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, #58a6ff, #bc8cff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.market-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(63, 185, 80, 0.1);
    border: 1px solid rgba(63, 185, 80, 0.2);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.market-status .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    animation: pulse 2s infinite;
}

.market-status.closed .dot { background: var(--red); animation: none; }
.market-status.closed { background: rgba(248, 81, 73, 0.1); border-color: rgba(248, 81, 73, 0.2); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Cards */
.card {
    margin: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    font-size: 15px;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

.badge {
    background: var(--accent);
    color: #000;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 24px;
    text-align: center;
}

/* Portfolio Card */
.portfolio-card { border-color: rgba(88, 166, 255, 0.3); }

.portfolio-stats { padding: 18px; }

.stat.big .stat-value {
    font-size: 28px;
    font-weight: 700;
    display: block;
}

.stat-row {
    display: flex;
    gap: 16px;
    margin-top: 14px;
}

.stat {
    flex: 1;
    text-align: center;
}

.stat-value {
    font-size: 18px;
    font-weight: 600;
    display: block;
}

.stat-value.accent { color: var(--accent); }
.stat-value.muted { color: var(--text-muted); }

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
    display: block;
}

.risk-bar {
    display: flex;
    border-top: 1px solid var(--border);
}

.risk-item {
    flex: 1;
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 500;
    border-right: 1px solid var(--border);
}

.risk-item:last-child { border-right: none; }
.risk-green span:last-child { color: var(--green); font-weight: 700; }
.risk-red span:last-child { color: var(--red); font-weight: 700; }

/* Positions */
.position-item {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.position-item:last-child { border-bottom: none; }
.position-item:active { background: var(--bg-card-hover); }

.pos-direction {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    margin-right: 12px;
    flex-shrink: 0;
}

.pos-direction.long {
    background: rgba(63, 185, 80, 0.15);
    color: var(--green);
}

.pos-direction.short {
    background: rgba(248, 81, 73, 0.15);
    color: var(--red);
}

.pos-info { flex: 1; }

.pos-ticker {
    font-size: 15px;
    font-weight: 600;
}

.pos-pattern {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.pos-right { text-align: right; }

.pos-capital {
    font-size: 14px;
    font-weight: 600;
}

.pos-pct {
    font-size: 11px;
    color: var(--accent);
    margin-top: 2px;
}

.pos-levels {
    display: flex;
    gap: 8px;
    font-size: 10px;
    margin-top: 4px;
    color: var(--text-muted);
}

.sl { color: var(--red); }
.tp { color: var(--green); }

/* Signals */
.signal-item {
    display: flex;
    align-items: center;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
}

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

.signal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 12px;
    flex-shrink: 0;
}

.signal-dot.buy { background: var(--green); box-shadow: 0 0 8px rgba(63, 185, 80, 0.4); }
.signal-dot.watch { background: var(--yellow); }
.signal-dot.skip { background: var(--text-muted); }

.signal-info { flex: 1; }

.signal-ticker {
    font-size: 14px;
    font-weight: 600;
}

.signal-detail {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.signal-score {
    font-size: 16px;
    font-weight: 700;
    min-width: 40px;
    text-align: right;
}

/* Season bar */
.season-bar {
    margin: 12px 16px;
    padding: 12px 18px;
    background: linear-gradient(135deg, rgba(63, 185, 80, 0.1), rgba(88, 166, 255, 0.05));
    border: 1px solid rgba(63, 185, 80, 0.2);
    border-radius: var(--radius-sm);
    font-size: 13px;
    text-align: center;
}

/* Settings Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    align-items: flex-end;
    justify-content: center;
}

.modal.show { display: flex; }

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
    width: 100%;
    max-width: 500px;
    padding: 24px;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 { font-size: 18px; }

.btn-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
}

.btn-edit {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    outline: none;
}

.form-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

.leverage-buttons {
    display: flex;
    gap: 8px;
}

.lev-btn {
    flex: 1;
    padding: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.lev-btn.active, .lev-btn:active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

.btn-save {
    width: 100%;
    padding: 14px;
    background: var(--gradient-blue);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: opacity 0.2s;
}

.btn-save:active { opacity: 0.8; }

.loading {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* Empty state */
.empty {
    padding: 32px 18px;
    text-align: center;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 40px;
    margin-bottom: 8px;
}

/* Add button */
.btn-add {
    background: var(--gradient-blue);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}
.btn-add:active { transform: scale(0.9); }

/* Form row (2 columns) */
.form-row {
    display: flex;
    gap: 12px;
}
.form-row .form-group { flex: 1; }

/* Close trade button */
.btn-close-trade {
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid rgba(248, 81, 73, 0.3);
    color: var(--red);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    margin-top: 6px;
    transition: all 0.2s;
}
.btn-close-trade:active {
    background: rgba(248, 81, 73, 0.3);
}

