/* ATGL Strategy Performance Dashboard — Phase 1 styles v1.1 */

/* ── Dashboard container ── */
.atgl-dashboard {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1a1a1a;
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem;
    background: #f2f4f7;
    border-radius: 10px;
}

/* ── Header ── */
.atgl-dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 1.5rem;
}
.atgl-dash-title {
    font-size: 17px;
    font-weight: 600;
    color: #1a1a1a;
}

/* ── Period buttons ── */
.atgl-period-btns {
    display: flex;
    gap: 4px;
}
.atgl-period-btn {
    padding: 5px 13px;
    font-size: 12px;
    border: 1px solid #d0d4dc;
    border-radius: 6px;
    background: #ffffff;
    color: #555;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    font-weight: 500;
}
.atgl-period-btn:hover {
    background: #e8eaf0;
    color: #1a1a1a;
    border-color: #b0b6c4;
}
.atgl-period-btn.active {
    background: #1a6b3c;
    color: #ffffff;
    border-color: #1a6b3c;
}

/* ── Metric cards ── */
.atgl-metric-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 1.5rem;
}
@media (max-width: 640px) {
    .atgl-metric-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 380px) {
    .atgl-metric-row { grid-template-columns: 1fr; }
}
.atgl-metric-card {
    background: #ffffff;
    border-radius: 8px;
    padding: 16px 18px;
    border: 1px solid #dde0e8;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.atgl-metric-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
    font-weight: 600;
}
.atgl-metric-value {
    font-size: 26px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.15;
}
.atgl-metric-value.positive { color: #0e7c4b; }
.atgl-metric-value.negative { color: #c0392b; }
.atgl-metric-sub {
    font-size: 11px;
    color: #aaa;
    margin-top: 4px;
}

/* ── Section labels ── */
.atgl-section-label {
    font-size: 11px;
    font-weight: 700;
    color: #777;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
    padding-left: 2px;
}

/* ── Table wrappers ── */
.atgl-table-wrap {
    overflow-x: auto;
    margin-bottom: 1.5rem;
    border: 1px solid #dde0e8;
    border-radius: 10px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.07);
    background: #ffffff;
}

/* ── Scorecard table ── */
.atgl-scorecard,
.atgl-recent-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: #ffffff;
    border-radius: 10px;
    overflow: hidden;
}
.atgl-scorecard th,
.atgl-recent-table th {
    text-align: left;
    padding: 11px 16px;
    font-size: 11px;
    font-weight: 700;
    color: #777;
    border-bottom: 1px solid #e8eaf0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    background: #f7f8fb;
}
.atgl-scorecard td,
.atgl-recent-table td {
    padding: 13px 16px;
    border-bottom: 1px solid #f0f2f5;
    color: #1a1a1a;
    vertical-align: middle;
}
.atgl-scorecard tbody tr:last-child td,
.atgl-recent-table tbody tr:last-child td {
    border-bottom: none;
}
.atgl-scorecard tbody tr {
    cursor: pointer;
    transition: background 0.12s;
}
.atgl-scorecard tbody tr:hover td {
    background: #f4f6fb;
}
.atgl-scorecard tbody tr.selected td {
    background: #eaf2ff;
    border-left: 3px solid #1a56db;
}
.atgl-scorecard tbody tr:not(.selected) td:first-child {
    border-left: 3px solid transparent;
}

/* ── Win rate bar ── */
.atgl-win-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}
.atgl-win-bar-track {
    flex: 1;
    height: 6px;
    background: #e4e6ec;
    border-radius: 3px;
    overflow: hidden;
    min-width: 60px;
    max-width: 100px;
}
.atgl-win-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.45s ease;
}

/* ── Trend indicators ── */
.atgl-trend-up   { color: #0e7c4b; font-weight: 800; font-size: 17px; }
.atgl-trend-down { color: #c0392b; font-weight: 800; font-size: 17px; }
.atgl-trend-flat { color: #bbb;    font-weight: 800; font-size: 17px; }

/* ── Return colors ── */
.atgl-pos { color: #0e7c4b; font-weight: 600; }
.atgl-neg { color: #c0392b; font-weight: 600; }

/* ── Loading states ── */
.atgl-loading { color: #ccc; font-size: 14px; }
.atgl-loading-row {
    text-align: center;
    color: #aaa;
    padding: 24px !important;
    font-size: 13px;
}
.atgl-error-row {
    text-align: center;
    color: #c0392b;
    padding: 24px !important;
    font-size: 13px;
}

/* ── Recent trades section ── */
.atgl-recent-wrap {
    margin-top: 0.25rem;
}

/* ── Strategy name emphasis ── */
.atgl-scorecard tbody td:first-child strong {
    font-size: 13.5px;
    color: #1a1a1a;
}

/* ── Divider between scorecard and recent trades ── */
.atgl-recent-wrap .atgl-section-label {
    margin-top: 0.5rem;
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .atgl-dashboard         { padding: 1rem; }
    .atgl-dash-header       { flex-direction: column; align-items: flex-start; }
    .atgl-metric-value      { font-size: 22px; }
    .atgl-scorecard th,
    .atgl-scorecard td,
    .atgl-recent-table th,
    .atgl-recent-table td   { padding: 10px 10px; }
}
