:root {
    --bg-dark: #131722;
    --sidebar-bg: #1e222d;
    --text-main: #d1d4dc;
    --text-dim: #787b86;
    --accent: #2962ff;
    --green: #089981;
    --red: #f23645;
    --border: #363a45;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Trebuchet MS", Roboto, Ubuntu, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 320px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px;
    z-index: 10;
    overflow-y: auto;
}

.logo {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
}

.status.online {
    background-color: rgba(8, 153, 129, 0.2);
    color: var(--green);
}

.token-selector label {
    display: block;
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 5px;
}

select, input {
    width: 100%;
    background-color: #2a2e39;
    border: 1px solid var(--border);
    color: white;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 14px;
}

.current-price-card {
    background-color: #2a2e39;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 20px;
}

.current-price-card span {
    color: var(--text-dim);
    font-size: 12px;
}

.current-price-card h1 {
    font-size: 28px;
    margin-top: 5px;
}

.market-motion {
    display: flex;
    justify-content: space-between;
    margin-bottom: 25px;
}

.motion-item {
    font-size: 12px;
    color: var(--text-dim);
}

.motion-item span.green { color: var(--green); font-weight: bold; }
.motion-item span.red { color: var(--red); font-weight: bold; }

/* PNL Calculator */
.pnl-calculator h3 {
    margin-bottom: 15px;
    font-size: 16px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 5px;
}

.input-group label {
    font-size: 11px;
    color: var(--text-dim);
    display: block;
    margin-bottom: 4px;
}

button {
    width: 100%;
    padding: 12px;
    background-color: var(--accent);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: filter 0.2s;
}

button:hover {
    filter: brightness(1.1);
}

.calc-results {
    margin-top: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.res-item {
    background-color: #2a2e39;
    padding: 10px;
    border-radius: 4px;
    font-size: 13px;
    color: var(--text-dim);
}

.res-item span {
    display: block;
    color: white;
    font-size: 15px;
    margin-top: 5px;
    font-weight: bold;
}

/* Main Content (Chart) */
.main-content {
    flex-grow: 1;
    position: relative;
}

#chartContainer {
    width: 100%;
    height: 100%;
}

/* Live Signal Alert */
.signal-alert {
    position: absolute;
    bottom: 30px;
    right: 30px;
    width: 320px;
    background-color: var(--sidebar-bg);
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: none;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateY(100px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.signal-header {
    font-size: 12px;
    font-weight: bold;
    color: var(--accent);
    margin-bottom: 10px;
}

.signal-body {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 5px;
}

.signal-footer {
    font-size: 12px;
    color: var(--text-dim);
}

.profit { color: var(--green) !important; }
.loss { color: var(--red) !important; }

/* Sidebar Footer */
.nav-link {
    display: block;
    color: var(--accent);
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
    padding: 10px;
    background: rgba(41, 98, 255, 0.1);
    border-radius: 4px;
    text-align: center;
    transition: all 0.2s;
}

.nav-link:hover {
    background: var(--accent);
    color: white;
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.85);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: var(--sidebar-bg);
    margin: 2% auto;
    padding: 0;
    border: 1px solid var(--border);
    width: 98%;
    max-width: 1600px;
    height: 90vh;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal-header {
    padding: 20px 30px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 { font-size: 20px; color: var(--accent); }

.close-modal {
    color: var(--text-dim);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-modal:hover { color: white; }

.modal-body {
    padding: 30px;
    overflow-y: auto;
    flex-grow: 1;
}

.backtest-controls {
    background: #2a2e39;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.input-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.input-row .input-group {
    flex: 1;
    min-width: 150px;
}

.btn-primary {
    background-color: var(--green);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    font-size: 15px;
}

.btn-secondary {
    background-color: #363a45;
    color: white;
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background-color: #404552;
}

/* Accordion Styling */
.accordion-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
}

.accordion-header {
    background: #2a2e39;
    padding: 15px 25px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.accordion-header:hover { background: #363a45; }

.accordion-header h4 { font-size: 16px; margin: 0; }

.accordion-content {
    display: none;
    padding: 20px;
    background: var(--bg-dark);
    border-top: 1px solid var(--border);
}

.accordion-item.active .accordion-content { display: block; }
.accordion-item.active .accordion-header { border-bottom: 1px solid var(--border); background: var(--border); }

/* Trade Table Styling */
.trade-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    color: var(--text-main);
}

.trade-table th {
    text-align: left;
    padding: 10px;
    border-bottom: 2px solid var(--border);
    color: var(--text-dim);
}

/* Status Badges */
.status-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
}

.status-stoploss { background-color: rgba(242, 54, 69, 0.15); color: var(--red); border: 1px solid rgba(242, 54, 69, 0.3); }
.status-full-target { background-color: rgba(8, 153, 129, 0.15); color: var(--green); border: 1px solid rgba(8, 153, 129, 0.3); }
.status-partial-target { background-color: rgba(41, 98, 255, 0.15); color: var(--accent); border: 1px solid rgba(41, 98, 255, 0.3); }
.status-timeout { background-color: rgba(120, 123, 134, 0.15); color: var(--text-dim); border: 1px solid rgba(120, 123, 134, 0.3); }
.status-partial-timeout { background-color: rgba(120, 123, 134, 0.1); color: var(--text-dim); border: 1px dotted var(--text-dim); }

.trade-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
}

.trade-table tr:hover { background: rgba(255,255,255,0.03); }

.view-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: bold;
    font-size: 11px;
    padding: 3px 8px;
    border: 1px solid var(--accent);
    border-radius: 4px;
    transition: all 0.2s;
}

.view-link:hover {
    background: var(--accent);
    color: white;
}

.placeholder-text {
    text-align: center;
    color: var(--text-dim);
    margin-top: 50px;
    font-size: 18px;
}
