/* 基礎樣式重置和背景 */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}
.container { max-width: 1200px; margin: 0 auto; }
h1 { color: white; text-align: center; margin-bottom: 30px; text-shadow: 2px 2px 4px rgba(0,0,0,0.3); }
h4 { color: #4a5568; margin-top: 10px; margin-bottom: 10px; }

/* 卡片和表單區塊樣式 */
.card { background: white; border-radius: 15px; padding: 30px; margin-bottom: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
.form-section { margin-bottom: 25px; }
.form-section h3 { color: #4a5568; margin-bottom: 15px; padding-bottom: 10px; border-bottom: 2px solid #e2e8f0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px; }

/* 表單群組和輸入框 */
.form-group { display: flex; flex-direction: column; }
.form-group-wrapper { display: flex; gap: 15px; align-items: flex-start; }
.form-group-wrapper .form-group { flex: 1; min-width: 0; }
label { color: #718096; font-size: 14px; margin-bottom: 5px; font-weight: 600; }
textarea { min-height: 100%; resize: vertical; }

/* 按鈕樣式 */
.button-group { display: flex; gap: 15px; justify-content: center; margin-top: 30px; flex-wrap: wrap; }
.button-group button:not(.btn) {
    padding: 12px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}
.button-group button:not(.btn):hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4); }
.button-group button:not(.btn):active { transform: translateY(0); }


/* SVG 人體圖樣式 */
.body-diagram-container {
    padding: 0.5rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
}
.body-diagram {
    width: 100%;
    height: auto;
}
.body-part {
    fill: #e9ecef;
    stroke: #6c757d;
    stroke-width: 0.5;
    cursor: pointer;
    transition: fill 0.2s ease-in-out;
}
.body-part:hover {
    fill: #a5d8ff;
    stroke: #0056b3;
}
.body-part.burn-selected {
    fill: #dc3545;
    stroke: #a42834;
}
.body-part.trauma-selected {
    fill: #0d6efd; 
    stroke: #0a58ca;
}
.body-part.burn-with-trauma {
    fill: url(#blue-hatch); /* 紅底藍網格 */
    stroke: #a42834;
}
.body-part.trauma-with-burn {
    fill: url(#red-hatch);
    stroke: #0a58ca;
}
.svg-label {
    font-size: 24px;
    font-weight: bold;
    fill: #495057;
    pointer-events: none;
    text-anchor: middle;
}

/* START: 模式切換器樣式 */
.form-switch .form-check-input {
    cursor: pointer;
    background-color: #dc3545; /* Red for burn (default) */
    border-color: #c82333;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
}

.form-switch .form-check-input:checked {
    background-color: #0d6efd; /* Blue for trauma */
    border-color: #0a58ca;
}

/* Modal 內部詳細 SVG 樣式 */
#traumaTabContent {
    padding: 1rem;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 .25rem .25rem;
}
#traumaModalBody svg {
    max-width: 100%;
    height: auto;
    max-height: 60vh;
}
.trauma-detail-part {
    fill: #e9ecef;
    stroke: #6c757d;
    stroke-width: 1;
    cursor: pointer;
    transition: fill 0.2s ease-in-out;
}
.trauma-detail-part:hover {
    fill: #a5d8ff;
}
.trauma-detail-part.selected {
    fill: #0d6efd;
    stroke: #0a58ca;
}
.svg-detail-label {
    font-size: 7px;
    fill: #212529;
    pointer-events: none;
    text-anchor: middle;
    dominant-baseline: middle;
}

/* 止血帶區塊樣式 */
.tourniquet-section { background-color: #f7fafc; padding: 15px; border-radius: 8px; border: 1px solid #e2e8f0; }
.tq-record { display: flex; flex-direction: column; padding: 5px 0; }
.tq-record label { font-weight: bold; color: #4a5568; }

/* 生命徵象表格樣式 */
#vitals-table { width: min-content; white-space: nowrap; }
#vitals-table th, #vitals-table td { vertical-align: middle; text-align: left; }
.vitals-label { width: 90px; }
#vitals-table thead th { text-align: center; }
#vitals-table thead th:first-child { text-align: left; }
#vitals-table .input-group { min-width: 130px; }

/* 輸出結果區塊 */
.output-section { margin-top: 30px; padding: 20px; background: #f7fafc; border-radius: 10px; }
.data-display { background: #2d3748; color: #68d391; padding: 15px; border-radius: 8px; font-family: 'Courier New', monospace; font-size: 12px; word-break: break-all; margin: 10px 0; }
.stats { margin-top: 20px; }
.stat-value { font-size: 1.5rem; font-weight: bold; color: #667eea; }
#qrcode { display: flex; justify-content: center; padding: 20px 0; }

/* 影片掃描器 */
#videoContainer { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 1056; display: flex; justify-content: center; align-items: center; flex-direction: column; }
#video { width: 80%; max-width: 640px; height: auto; border: 2px solid white; background: #333; }

/* 回到最上面按鈕樣式 */
#back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    width: 50px;
    height: 50px;
    font-size: 24px;
    padding: 0;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
}

#back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

