/* webappStock - 前台樣式 */

/* ====== 全域 ====== */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #f8f9fa;
}

main {
    flex: 1;
}

/* ====== 卡片 ====== */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
}

/* ====== 儀表板 ====== */
.dashboard-stat {
    border-left: 4px solid;
    padding: 1rem 1.25rem;
}

.dashboard-stat.border-primary { border-left-color: #0d6efd !important; }
.dashboard-stat.border-success { border-left-color: #198754 !important; }
.dashboard-stat.border-danger  { border-left-color: #dc3545 !important; }
.dashboard-stat.border-warning { border-left-color: #ffc107 !important; }

.dashboard-stat .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.dashboard-stat .stat-label {
    font-size: 0.85rem;
    color: #6c757d;
}

/* ====== 股價顏色 ====== */
.text-up, .price-up    { color: #dc3545 !important; } /* 紅色=漲 (台灣慣例) */
.text-down, .price-down { color: #198754 !important; } /* 綠色=跌 */
.text-flat              { color: #6c757d !important; }

.bg-up   { background-color: rgba(220, 53, 69, 0.1) !important; }
.bg-down { background-color: rgba(25, 135, 84, 0.1) !important; }

/* ====== 股票列表 ====== */
.stock-row {
    cursor: pointer;
    transition: background-color 0.15s;
}

.stock-row:hover {
    background-color: #f0f0f0;
}

.stock-code {
    font-weight: 600;
    font-family: 'Consolas', monospace;
}

/* ====== 下單表單 ====== */
.order-form {
    max-width: 600px;
}

.order-summary {
    background-color: #f8f9fa;
    border-radius: 0.5rem;
    padding: 1rem;
}

/* ====== 持股列表 ====== */
.portfolio-pnl-positive { color: #dc3545; font-weight: 600; }
.portfolio-pnl-negative { color: #198754; font-weight: 600; }

/* ====== 資料表格 ====== */
.table th {
    font-weight: 600;
    white-space: nowrap;
    font-size: 0.9rem;
}

.table td {
    vertical-align: middle;
}

.table .text-end {
    font-family: 'Consolas', 'Courier New', monospace;
}

/* ====== 搜尋列 ====== */
.search-bar {
    max-width: 400px;
}

/* ====== 狀態標籤 ====== */
.badge-status-pending    { background-color: #ffc107; color: #000; }
.badge-status-filled     { background-color: #198754; }
.badge-status-cancelled  { background-color: #6c757d; }
.badge-status-rejected   { background-color: #dc3545; }

/* ====== 走勢分析 ====== */

/* 側欄股票列表項目 */
.sidebar-stock-list .stock-row {
    border-bottom: 1px solid #f0f0f0;
}

.sidebar-stock-list .stock-row:last-child {
    border-bottom: none;
}

/* 已選股票標籤 */
.chart-stock-tag {
    font-size: 0.85rem;
    padding: 0.35em 0.65em;
}

/* 搜尋下拉 */
.search-dropdown {
    position: absolute;
    z-index: 1050;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    box-shadow: 0 0.25rem 0.5rem rgba(0,0,0,0.1);
    max-height: 250px;
    overflow-y: auto;
    display: none;
    width: 300px;
}

.search-dropdown .dropdown-item {
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.search-dropdown .dropdown-item:hover {
    background-color: #f0f0f0;
}

/* 側欄 tabs 緊湊 */
#sidebarTabs .nav-link {
    font-size: 0.8rem;
    padding: 0.4rem 0.5rem;
}

/* 排行榜 pills */
#rankTabs .nav-link {
    font-size: 0.75rem;
    border-radius: 1rem;
}

/* ====== 響應式微調 ====== */
@media (max-width: 768px) {
    .dashboard-stat .stat-value {
        font-size: 1.2rem;
    }

    .table-responsive {
        font-size: 0.85rem;
    }

    /* 走勢分析手機版 */
    #mainChartWrap {
        height: 250px !important;
    }

    .chart-stock-tag {
        font-size: 0.75rem;
    }
}
