/* =========================================
   VestX Pro Monitor - Futu-Style Dark Theme
   ========================================= */
:root {
    --bg-dark: #12151c;          /* 背景深色 */
    --bg-panel: #1e222d;         /* 面板底色 */
    --text-main: #d1d4dc;        /* 主要文字 */
    --text-muted: #787b86;       /* 次要文字 */
    --futu-red: #ff333a;         /* 賣盤/跌 */
    --futu-green: #00b969;       /* 買盤/漲 */
    --border-color: #2b313f;     /* 邊框線條 */
    --accent-blue: #2962ff;      /* 按鈕主色 */
}

body {
    font-family: "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    margin: 0;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 搜尋列 (Search Bar) */
.search-bar {
    background: var(--bg-panel);
    padding: 15px 20px;
    border-radius: 8px;
    display: flex;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    margin-bottom: 20px;
    width: 100%;
    max-width: 600px;
    box-sizing: border-box;
}

select, input, button {
    background: var(--bg-dark);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 15px;
    outline: none;
}

input:focus, select:focus {
    border-color: var(--accent-blue);
}

button {
    background: var(--accent-blue);
    color: white;
    border: none;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
    white-space: nowrap;
}

button:hover {
    background: #1e4bd8;
}

/* 錯誤提示橫幅 (Error Banner) */
#error-banner {
    color: var(--futu-red);
    background: rgba(255, 51, 58, 0.1);
    border: 1px solid var(--futu-red);
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    display: none;
    width: 100%;
    max-width: 600px;
    box-sizing: border-box;
    font-weight: bold;
}

/* 報價卡片 (Quote Card) */
.quote-card {
    background: var(--bg-panel);
    border-radius: 8px;
    width: 100%;
    max-width: 900px;
    padding: 20px 25px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    box-sizing: border-box;
    display: none; /* 初始隱藏 */
}

.monitor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 900px;
    margin-top: 20px;
}

.ticker-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    margin-bottom: 20px;
}

.ticker-name {
    font-size: 22px;
    font-weight: bold;
    letter-spacing: 1px;
}

.update-time {
    font-size: 12px;
    color: var(--text-muted);
}

/* 現價顯示 (Last Price) */
.price-section {
    text-align: center;
    margin-bottom: 30px;
}

.price-label {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.price-large {
    font-size: 48px;
    font-weight: bold;
    font-family: Monaco, monospace;
    line-height: 1;
}

/* 買賣盤區塊 (Order Book) */
.order-book {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.book-side {
    flex: 1;
    background: var(--bg-dark);
    border-radius: 6px;
    padding: 15px;
    border: 1px solid var(--border-color);
}

.book-side h4 {
    margin: 0 0 15px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.book-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 18px;
    font-family: Monaco, monospace;
    font-weight: bold;
}

.bid-color { color: var(--futu-green); }
.ask-color { color: var(--futu-red); }

/* =========================================
   UI 升級：字體放大與細節優化
   ========================================= */

/* 1. 放大表單元件與基礎字體 */
select, input, button {
    font-size: 16px !important; /* 從 15px 放大 */
}

/* 2. 放大標頭與價格顯示 */
.ticker-name {
    font-size: 26px !important; /* 從 22px 放大 */
}
.price-large {
    font-size: 56px !important; /* 從 48px 放大 */
}
.book-row {
    font-size: 22px !important; /* 從 18px 放大 */
}
.book-side h4 {
    font-size: 16px !important; /* 從 14px 放大 */
}

/* 3. 放大持倉與訂單表格的字體與間距 */
.quote-card table {
    font-size: 15px !important; /* 從 13px 放大 */
}
.quote-card table th, .quote-card table td {
    padding: 12px 6px !important; /* 增加儲存格的呼吸空間 */
}

/* =========================================
   按鈕高亮：撤單按鈕 (Cancel Button)
   ========================================= */
.btn-cancel {
    background-color: transparent !important;
    color: #ff9800 !important; /* 顯眼的橘黃色 */
    border: 1px solid #ff9800 !important;
    border-radius: 4px;
    padding: 6px 12px !important;
    font-size: 14px !important;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.btn-cancel:hover {
    background-color: rgba(255, 152, 0, 0.15) !important;
    box-shadow: 0 0 8px rgba(255, 152, 0, 0.5) !important;
    color: #ffb74d !important;
}

/* =========================================
   非阻塞 UI：Toast 通知與 Confirm 彈窗
   ========================================= */

/* Toast 浮動通知容器 */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    min-width: 250px;
    padding: 15px 20px;
    border-radius: 6px;
    color: white;
    font-size: 15px;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    animation: slideIn 0.3s ease-out forwards;
    opacity: 0.95;
    line-height: 1.4;
}

.toast.success { background-color: var(--futu-green); }
.toast.error { background-color: var(--futu-red); }
.toast.warning { background-color: #ff9800; color: #fff; }

.toast.fadeOut {
    animation: fadeOut 0.3s ease-out forwards;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOut {
    to { opacity: 0; transform: translateY(-10px); }
}

/* 自訂 Confirm 遮罩與彈窗 */
#confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9998;
    display: none;
    justify-content: center;
    align-items: center;
}

.confirm-box {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    padding: 25px;
    border-radius: 8px;
    width: 400px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.8);
}

.confirm-text {
    font-size: 16px;
    margin-bottom: 25px;
    line-height: 1.6;
    white-space: pre-wrap; /* 保留換行符號 */
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* =========================================
   第二波 UI 放大：針對特定小字體與高對比
   ========================================= */

/* 1. 買一價 / 賣一價 的大標題 */
.book-side h4 {
    font-size: 22px !important; /* 從 16px 再放大到 22px */
    color: #ffffff !important;  /* 從暗灰色改為純白色，極大提升辨識度 */
    font-weight: bold;
    padding-bottom: 12px !important;
}

/* 2. 買賣盤裡面的「價格」小字 */
.book-row span:first-child {
    font-size: 18px !important; /* 從 14px 放大 */
    color: #bbbbbb !important;  /* 把暗灰調亮一點 */
}

/* 3. 數量旁邊的「手 / 張」單位 */
#qty-unit {
    font-size: 18px !important; /* 從 14px 放大 */
}

/* 4. 「自動掛出止盈單」整行的勾選框與文字 */
.book-side label {
    font-size: 16px !important; /* 從 13px 放大 */
    color: #dddddd !important;  /* 調亮字體顏色 */
    font-weight: bold;          /* 加粗字體 */
}

/* 如果你的 profit-value 輸入框太小，順便稍微放大它 */
#profit-value {
    font-size: 16px !important;
    padding: 4px 8px !important;
    width: 70px !important;
}

/* 5. 驗證成功後的綠色資訊橫幅 */
#asset-info-banner {
    font-size: 16px !important; /* 從 14px 放大 */
}
#asset-info-banner div {
    font-size: 16px !important;
}

/* 6. 標頭的更新時間 (Update Time) */
.update-time {
    font-size: 16px !important; /* 從 12px 放大到 16px */
    color: #bbbbbb !important;  /* 從暗灰色調亮，提升對比度 */
    font-weight: bold !important; /* 加上粗體，讓跳動的數字更清晰 */
}
