img#resultImage {
    max-width: 100%;
    height: auto;
}

.video-container {
    position: relative;
    width: 60%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio (9 / 16 = 0.5625) */
    margin-left: auto;
    margin-right: auto;
    max-width: 100%;
    overflow: hidden;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 60%;
    height: 100%;
}

.input-section {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

#video_queue {
    margin-top: 15px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 5px;
    max-height: 200px;
    overflow-y: auto;
}

.queue-item {
    padding: 5px;
    border-bottom: 1px solid #dee2e6;
}

.queue-item.current {
    background-color: #e9ecef;
    font-weight: bold;
}

#batch_paths {
    display: none;
}

.upload-progress {
    height: 5px;
    margin-top: 5px;
    display: none;
}

/* 添加禁用樣式 */
.disabled-section {
    opacity: 0.6;
    pointer-events: none;
}

/* RTSP 和文件選擇區域樣式 */
.input-group-section {
    transition: opacity 0.3s ease;
    padding: 10px;
    border-radius: 5px;
}

/* 處理狀態樣式 */
.processing-status {
    text-align: center;
    margin-top: 10px;
    font-weight: bold;
    color: #007bff;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 5px;
}

/* 確保按鈕文字為橫向 */
.btn {
    writing-mode: horizontal-tb !important;
}

img.icon {
    height: 2em;
    transform: translateY(2px); /* 微調垂直位置 */
}

/* --- Page background gradient --- */
:root {
  /* 之後要微調只改這兩個色票即可 */
  --bg-top: #FFE9D6;   /* 淺杏桃 */
  --bg-bottom: #fda33d;/* 深橙 */
}

html, body {
  height: 100%;
}

.page-subtitle {
    color: #be6600;            /* 深紅色校名 */
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 0.5rem;
}

.page-subtitle .icon {
    width: 42px;
    height: auto;
    vertical-align: middle;
}

.page-title {
    font-weight: 700;
    letter-spacing: 1px;
    color: #2F2F2F;
    margin-top: 6px;
    margin-bottom: 0.5rem;
}

.page-divider {
    width: 90%;
    margin: 12px auto;
    border: 1px solid #ccc;
    opacity: 0.5;
}

.page-version {
    color: #666;
    font-size: 1rem;
    letter-spacing: 1px;
    margin-bottom: 1.5rem;
}

/* body：不要再額外撐高底部 */
body {
  min-height: 100vh;
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
  background-attachment: fixed;
  font-family: 'Segoe UI', Arial, sans-serif;
  padding-bottom: 0;      /* ← 原本若有 80~140 都先改為 0 */
  overflow-x: hidden;
}

/* 主卡片：只留適中的下邊距，避免和 footer 疊出雙層 */
.container {
  background-color: #fff;
  border-radius: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  padding: 40px 50px;
  margin: 10px auto 40px; /* ← 下 32px 就好，別太大 */
  max-width: 900px;
  position: relative;
}

/* --- 主卡片寬版樣式 --- */
.container.mt-5 {
  max-width: 1200px;              /* ✅ 原本大約 900px → 改成 1200px */
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  padding: 40px 60px;             /* 內邊距稍微加寬一點 */
  margin: 60px auto;              /* 置中、與上下保持呼吸空間 */
}


/* --- Footer --- */
.site-footer {
  position: relative;
  padding: 5px 0 40px;
  margin-top: 24px;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  overflow: hidden;
}

.footer-inner {         /* 內文字體樣式 */
  position: relative;
  z-index: 2;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
  text-align: center;
  font-family: "Noto Sans TC", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.7;
  letter-spacing: 0.2px;
  color: #5a3d21;
}

.footer-inner p { margin: 6px 0; opacity: 0.9; }

.footer-title {
  font-weight: 700;
  font-size: 15px;
  color: #3e2a14;
  margin-bottom: 6px;
}

.footer-note {
  font-size: 13px;
  color: #7b6145;
  margin-top: 8px;
}

.site-footer a {          /* 連結樣式 */
  color: #1c5f9d;
  text-decoration: none;
  border-bottom: 1px dashed rgba(28,95,157,0.4);
  text-underline-offset: 2px;
  font-weight: 500;
}
.site-footer a:hover { border-bottom-style: solid; opacity: 0.85; }


/* --- 1️⃣ 通用輸入欄位樣式（Input / Select） --- */
.form-control,
.form-select {
  background: #f7f8fa;
  border: 1px solid #e4e7ec;
  border-radius: 12px;
  height: 44px;
  font-size: 16px;
  color: #333;
  transition: all 0.2s ease;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.03);
}

.form-control:focus,
.form-select:focus {
  background: #ffffff;
  border-color: #f9935c; /* 模板橘色 */
  box-shadow: 0 0 0 3px rgba(249,147,92,0.25);
  outline: none;
}

/* Placeholder 顏色更淡 */
.form-control::placeholder {
  color: #b6b6b6;
}

/* 下拉箭頭樣式一致 */
select.form-control,
select.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23f9935c' viewBox='0 0 16 16'><path d='M3.204 5.793a.5.5 0 0 1 .707 0L8 9.086l4.089-3.293a.5.5 0 1 1 .622.782l-4.4 3.54a.75.75 0 0 1-.942 0l-4.4-3.54a.5.5 0 0 1 0-.782z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 34px;
}

/* --- 2️⃣ 主要按鈕樣式（Orange Gradient） --- */
#submit_form.btn-primary {
  background: linear-gradient(90deg, #ffa64d 0%, #ff7b00 100%);
  border: none;
  border-radius: 24px;
  color: white;
  font-weight: 600;
  padding: 10px 24px;
  box-shadow: 0 6px 15px rgba(255,123,0,0.25);
  transition: all 0.25s ease;
}

#submit_form.btn-primary:hover {
  background: linear-gradient(90deg, #ff8a1f 0%, #ff6300 100%);
  box-shadow: 0 8px 18px rgba(255,99,0,0.35);
  transform: translateY(-1px);
}

#submit_form.btn-primary:active {
  transform: translateY(1px);
  box-shadow: 0 4px 10px rgba(255,99,0,0.2);
}

/* --- 3️⃣ Label 顏色與間距微調 --- */
label {
  font-weight: 500;
  color: #444;
  margin-bottom: 6px;
  font-size: 15px;
}


/* --- 調整影片區塊：水平＆垂直置中 --- */
.row {
  display: flex;
  justify-content: center;
  align-items: center;   /* ✅ 垂直置中關鍵 */
  gap: 40px;
  flex-wrap: wrap;
  min-height: 500px;     /* 給容器足夠高度，才有置中空間 */
}

.box1 {
  flex: 0 0 340px;
  max-width: 360px;
}

.box2 {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;   /* ✅ 垂直置中關鍵 */
  text-align: center;
}

.box2 img#video {
  width: auto;                 /* ✅ 不強制填滿寬度 */
  max-width: 150%;             /* ✅ 橫式影片放大 1.5 倍 */
  max-height: 70vh;            /* ✅ 限制直式影片最高佔螢幕 70% */
  height: auto;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  object-fit: contain;         /* ✅ 確保不被拉伸 */
  margin: 10px auto;
  display: block;
  transition: all 0.3s ease;
}

/* 響應式版本：在手機平板自動改為上下排列 */
@media (max-width: 992px) {
  .row {
    flex-direction: column;
    align-items: center;
  }
  .box1, .box2 {
    width: 100%;
    max-width: 500px;
  }
  .box2 img#video {
    max-width: 100%;
    max-height: 50vh;
  }
}

/* 待處理清單卡片外觀 */
#video_queue{
  background:#f7f8fa;
  border:1px solid #eceff4;
  border-radius:12px;
  padding:12px;
  box-shadow:0 2px 10px rgba(0,0,0,.04) inset;
}
#video_queue h6{
  margin:0 0 8px;
  font-size:13px;
  color:#6c757d;
  letter-spacing:.2px;
}

/* 單一清單項目（膠囊） */
.queue-item{
  display:flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border-radius:10px;
  background:#fff;
  border:1px solid #eef1f5;
  box-shadow:0 1px 2px rgba(0,0,0,.04);
  margin-bottom:6px;
}
.queue-item.current{
  border-color:#f9935c;
  box-shadow:0 0 0 3px rgba(249,147,92,.12);
}
.queue-item .idx{
  min-width:28px;
  height:28px;
  border-radius:9999px;
  display:flex; align-items:center; justify-content:center;
  background:#ffe7d4;
  color:#a44f0b;
  font-weight:700; font-size:12px;
}
.queue-item .name{
  flex:1; min-width:0;
  font-size:13px; color:#444;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}

/* 清單底部操作列 */
#video_queue .actions{
  display:flex; justify-content:flex-end; gap:8px; margin-top:8px;
}
.btn-xsm{
  padding:4px 10px; font-size:13px; border-radius:9999px;
}
.btn-clear {
  background: linear-gradient(90deg, #ff6b6b 0%, #ff2e2e 100%);
  border: none;
  border-radius: 24px;
  color: white;
  font-weight: 600;
  padding: 10px 24px;
  box-shadow: 0 6px 15px rgba(255, 46, 46, 0.25);
  transition: all 0.25s ease;
}

.btn-clear:hover {
  background: linear-gradient(90deg, #ff7f7f 0%, #ff3d3d 100%);
  box-shadow: 0 8px 18px rgba(255, 46, 46, 0.35);
  transform: translateY(-1px);
  color: white; /* 保持白字 */
}

.btn-clear:active {
  transform: translateY(1px);
  box-shadow: 0 4px 10px rgba(255, 46, 46, 0.2);
  background: linear-gradient(90deg, #ff5555 0%, #e02727 100%);
  color: white; /* 保持白字 */
}

/* 基礎樣式：置中、膠囊、陰影 */
.processing-status{
  display:inline-flex;align-items:center;gap:8px;
  padding:8px 12px;border-radius:999px;
  font-size:14px;line-height:1.2;
  box-shadow:0 6px 18px rgba(0,0,0,.08), inset 0 1px 0 rgba(255,255,255,.3);
  background:#fff;color:#444; border:1px solid rgba(0,0,0,.06);
}
.processing-status.is-working{
  background:linear-gradient(180deg,#eef6ff,#e6f0ff);
  color:#1b5fa7;border-color:rgba(27,95,167,.25);
}
.processing-status.is-success {
  background: linear-gradient(180deg, #e6f8ea, #b5f2c2); /* 柔和綠漸層 */
  color: #00b518; /* 主色：亮綠 */
  border-color: rgba(0, 181, 24, 0.25); /* 綠色半透明邊框 */
  box-shadow: 0 0 8px rgba(0, 181, 24, 0.15); /* 微光暈效果讓成功感更明顯 */
}
.processing-status.is-error{
  background:linear-gradient(180deg,#ffebee,#ffcdd2);
  color:#b71c1c;border-color:rgba(183,28,28,.25);
}

.btn-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.btn--switch {
  flex: 1;
  padding: 8px 0;
  border-radius: 20px;
  background: #f7f8fa;
  border: 1px solid #e4e7ec;
  font-weight: 600;
  color: #555;
  transition: all 0.25s ease;
}

.btn--switch:hover {
  background: #fff;
  border-color: #f9935c;
  color: #f9935c;
}

.btn--switch.active {
  background: linear-gradient(90deg, #ffa64d 0%, #ff7b00 100%);
  color: white;
  border: none;
  box-shadow: 0 4px 10px rgba(255, 123, 0, 0.25);
}
