@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Syne:wght@400;600;700;800&display=swap');

/* ── Variables ── */
:root {
    --bg:        #0d0f14;
    --surface:   #151820;
    --border:    #1f2430;
    --accent:    #00e5a0;
    --accent2:   #0084ff;
    --danger:    #ff4d6a;
    --text:      #e8eaf0;
    --muted:     #5a6070;
    --success:   #00e5a0;
    --error:     #ff4d6a;
    --radius:    10px;
    --mono:      'DM Mono', monospace;
    --sans:      'Syne', sans-serif;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
}

/* ── Nav ── */
nav {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 32px;
    height: 60px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav::before {
    content: "◈ PORTFOLIO";
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 500;
    color: var(--accent);
    letter-spacing: 0.15em;
    margin-right: auto;
}

nav a {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--muted);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid transparent;
    letter-spacing: 0.05em;
    transition: all 0.2s ease;
}

nav a:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(0, 229, 160, 0.06);
}

hr { display: none; }

/* ── Flash Messages ── */
.success, .error {
    font-family: var(--mono);
    font-size: 13px;
    padding: 12px 20px;
    margin: 16px 32px 0;
    border-radius: var(--radius);
    border-left: 3px solid;
    animation: slideIn 0.3s ease;
}

.success {
    background: rgba(0, 229, 160, 0.08);
    border-color: var(--success);
    color: var(--success);
}

.error {
    background: rgba(255, 77, 106, 0.08);
    border-color: var(--danger);
    color: var(--danger);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Page Wrapper ── */
.content, body > h2, body > form, body > p {
    max-width: 1100px;
    margin: 0 auto;
}

h2 {
    font-family: var(--sans);
    font-size: 26px;
    font-weight: 800;
    color: var(--text);
    padding: 36px 32px 24px;
    letter-spacing: -0.02em;
    max-width: 1100px;
    margin: 0 auto;
}

/* ── Dashboard Stats ── */
p {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--muted);
    padding: 4px 32px;
    max-width: 1100px;
    margin: 0 auto;
}

p b {
    color: var(--text);
    font-weight: 500;
}

/* ── Table ── */
table {
    width: calc(100% - 64px);
    margin: 24px 32px;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

thead tr {
    background: var(--border);
}

th {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 500;
    color: var(--muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

td {
    font-family: var(--mono);
    font-size: 13px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

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

tbody tr {
    transition: background 0.15s ease;
}

tbody tr:hover {
    background: rgba(255,255,255,0.02);
}

/* ── Table Action Links ── */
td a {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--accent2);
    text-decoration: none;
    padding: 4px 10px;
    border: 1px solid var(--accent2);
    border-radius: 5px;
    transition: all 0.2s;
}

td a:hover {
    background: rgba(0, 132, 255, 0.1);
}

/* ── Forms ── */
form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 32px;
    max-width: 480px;
    margin: 24px 32px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

label {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    display: block;
    margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
input[type="number"] {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 14px;
    color: var(--text);
    font-family: var(--mono);
    font-size: 13px;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 229, 160, 0.1);
}

/* ── Buttons ── */
button[type="submit"] {
    background: var(--accent);
    color: #0d0f14;
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    align-self: flex-start;
}

button[type="submit"]:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

/* Delete button (inside table) */
td form {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    display: inline;
}

td form button[type="submit"] {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
    border-radius: 5px;
    padding: 4px 10px;
    font-size: 12px;
    transition: all 0.2s;
}

td form button[type="submit"]:hover {
    background: rgba(255, 77, 106, 0.1);
    transform: none;
    opacity: 1;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ── Stats Bar ── */
.stats-bar {
    display: flex;
    gap: 16px;
    padding: 28px 32px 0;
    max-width: 1100px;
    margin: 0 auto;
}

.stat-card {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: border-color 0.2s;
}

.stat-card:hover { border-color: var(--muted); }

.stat-card.positive { border-color: rgba(0,229,160,0.3); }
.stat-card.negative { border-color: rgba(255,77,106,0.3); }

.stat-label {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.stat-value {
    font-family: var(--mono);
    font-size: 22px;
    font-weight: 500;
    color: var(--text);
}

.stat-card.positive .stat-value { color: var(--accent); }
.stat-card.negative .stat-value { color: var(--danger); }

/* ── Charts Grid ── */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 24px 32px 0;
    max-width: 1100px;
    margin: 0 auto;
}

.chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
}

.chart-title {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 16px;
}

.chart-wrap {
    position: relative;
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-wrap canvas {
    max-height: 220px;
}

/* ── Table Header + Search ── */
.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 28px 32px 12px;
    max-width: 1100px;
    margin: 0 auto;
}

.section-title {
    font-family: var(--sans);
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
    padding: 0;
}

.search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: var(--muted);
    font-size: 18px;
    pointer-events: none;
    line-height: 1;
}

.search-wrap input {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 14px 9px 36px;
    width: 260px;
    color: var(--text);
    font-family: var(--mono);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-wrap input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0,229,160,0.1);
}

.search-wrap input::placeholder { color: var(--muted); }

/* ── Table Wrap ── */
.table-wrap {
    padding: 0 32px 32px;
    max-width: 1100px;
    margin: 0 auto;
}

/* ── Profit/Loss colors in table ── */
td.positive { color: var(--accent); }
td.negative { color: var(--danger); }

/* ── Symbol Badge ── */
.symbol-badge {
    display: inline-block;
    background: rgba(0,132,255,0.1);
    color: var(--accent2);
    border: 1px solid rgba(0,132,255,0.2);
    border-radius: 5px;
    padding: 2px 8px;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.05em;
}

/* ── No Results ── */
.no-results {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--muted);
    text-align: center;
    padding: 32px;
    border: 1px dashed var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    background: var(--surface);
}

/* ── Responsive ── */
@media (max-width: 700px) {
    .charts-grid { grid-template-columns: 1fr; }
    .stats-bar   { flex-direction: column; }
    .table-header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .search-wrap input { width: 100%; }
}
