/* ========================================
   style.css - Dashboard Styling (Dark Theme)
   ======================================== */

:root {
    --bg: #0f1117;
    --bg-card: #1a1d27;
    --bg-hover: #232733;
    --border: #2d3140;
    --text: #e4e6eb;
    --text-dim: #8b8fa3;
    --accent: #4f9eff;
    --accent-hover: #3a8eef;
    --green: #4ade80;
    --red: #f87171;
    --yellow: #fbbf24;
    --orange: #fb923c;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', 'Microsoft YaHei', system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

#app { max-width: 1400px; margin: 0 auto; padding: 16px; }

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}
.header-left { display: flex; align-items: baseline; gap: 8px; }
.header-left h1 { font-size: 22px; font-weight: 700; }
.version { color: var(--text-dim); font-size: 12px; }
.header-right { display: flex; gap: 12px; align-items: center; }

/* Date picker */
.date-picker { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.date-picker select {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 10px;
    font-size: 13px;
    cursor: pointer;
}

/* Buttons */
.btn {
    padding: 7px 16px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }

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

/* Summary cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.stat-card { padding: 16px; }
.stat-label { color: var(--text-dim); font-size: 12px; margin-bottom: 6px; }
.stat-value { font-size: 24px; font-weight: 700; }

/* Chart sections */
.chart-section { padding: 16px; margin-bottom: 16px; }
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.card-header h2 { font-size: 16px; font-weight: 600; }
.chart-container { height: 320px; position: relative; }
.chart-sm { height: 200px; }

/* Period tabs */
.period-tabs { display: flex; gap: 4px; }
.tab-btn {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--border);
    padding: 4px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}
.tab-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.tab-btn:hover:not(.active) {
    background: var(--bg-hover);
    color: var(--text);
}

/* Table */
.table-section { padding: 16px; margin-bottom: 16px; }
.table-tools { display: flex; gap: 8px; }
.search-input {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 12px;
    font-size: 13px;
    width: 280px;
}
.search-input:focus { outline: none; border-color: var(--accent); }
.table-wrapper { overflow-x: auto; max-height: 600px; overflow-y: auto; }
.date-tag {
    background: var(--bg);
    color: var(--accent);
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 12px;
    margin-left: 8px;
}

table { width: 100%;    border-collapse: collapse; }
thead { position: sticky; top: 0; z-index: 10; }
th {
    background: var(--bg);
    padding: 10px 8px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
td {
    padding: 8px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
tbody tr:hover { background: var(--bg-hover); }
.num-col { text-align: right; }
.sortable { cursor: pointer; user-select: none; }
.sortable:hover { color: var(--accent); }
.product-name { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-id { font-family: monospace; font-size: 12px; color: var(--text-dim); }
.merchant { color: var(--text-dim); font-size: 12px; }
.refund-high { color: var(--red); font-weight: 600; }
.refund-mid { color: var(--orange); }
.refund-low { color: var(--green); }
.link-btn {
    background: transparent;
    color: var(--accent);
    border: none;
    cursor: pointer;
    font-size: 13px;
    text-decoration: underline;
}

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 18px; }
.modal-close {
    background: none;
    color: var(--text-dim);
    border: none;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
}
.modal-body { padding: 16px; }
.modal-info {
    display: flex;
    gap: 24px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.modal-info .info-item { font-size: 13px; }
.modal-info .info-label { color: var(--text-dim); }
.modal-info .info-value { font-weight: 600; }
.modal-tabs { margin-bottom: 12px; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.empty-state h2 { font-size: 20px; margin-bottom: 12px; }
.empty-state p { color: var(--text-dim); margin-bottom: 8px; }
.empty-workflow {
    margin-top: 24px;
    text-align: left;
    max-width: 500px;
    margin: 24px auto 0;
    padding: 20px;
    background: var(--bg);
    border-radius: var(--radius);
}
.empty-workflow ol { padding-left: 20px; }
.empty-workflow li { margin-bottom: 8px; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3d4250; }
