/* ===== Mobile 版本樣式文件 ===== */
@import url("https://fonts.googleapis.com/css2?family=Maven+Pro:wght@400;500;600;700;800;900&display=swap");

/* ===== 基礎重置 ===== */
* {
  margin: 0;
  padding: 0;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
  font-family: "Maven Pro", sans-serif;
}

html, body {
  height: 100%;
}

/* ===== Mobile 特定樣式 ===== */
input {
  font-size: 20px !important; 
}

/* ===== 登入頁面樣式 ===== */
.wrapper {
  height: 100vh;
}

.login-body {
  overflow: hidden; 
  position: fixed; 
  width: 100%; 
  height: 100%; 
  touch-action: none;
}

.login-box-margin {
  margin-top: 100px;
}

.loginBtn {
  border-radius: 50px;
  font-weight: bold;
  font-size: 20px;
  background-image: linear-gradient(to right, #0acffe 0%, #495aff 100%);
  border: none;
}

.loginBtn:hover {
  background-image: linear-gradient(to right, #495aff 0%, #0acffe 100%);
}

/* ===== 登入表單輸入框圓角 ===== */
.input-group:not(:has(.input-group-append)) .form-control {
  border-radius: 0 0.375rem 0.375rem 0 !important;
}

.input-group:not(:has(.input-group-append)) .input-group-text {
  border-radius: 0.375rem 0 0 0.375rem !important;
}

.input-group:has(.input-group-append) .form-control {
  border-radius: 0 !important;
}

.input-group:has(.input-group-append) .input-group-text {
  border-radius: 0.375rem 0 0 0.375rem !important;
}

.input-group:has(.input-group-append) .input-group-append .btn {
  border-radius: 0 0.375rem 0.375rem 0 !important;
}

/* ===== 導航欄樣式 ===== */
.navbar {
  height: 60px;
  background-color: #6697ff;
}

.navbar.fixed-navbar {
  position: fixed;
  /* z-index: 1030 !important; */
}

.navbar img {
  width: 200px;
}

.navbar-logo {
  height: 30px !important; 
  width: auto !important; 
  object-fit: contain !important;
}

.navbar-logo-large {
  height: 40px; 
  width: auto; 
  object-fit: contain;
}

/* ===== 導航按鈕欄 ===== */
.nav-buttons-bar {
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  background-color: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
  /* z-index: 1020 !important; */
  padding: 0.5rem 0;
}

.nav-buttons-container {
  display: flex;
  justify-content: space-around;
  align-items: center;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: #6c757d;
  padding: 0.5rem 0.3rem;
  min-width: 60px;
  transition: all 0.3s ease;
  border-radius: 0.375rem;
}

.nav-btn i {
  font-size: 1.2rem;
  margin-bottom: 0.25rem;
}

.nav-btn span {
  font-size: 0.75rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.2;
}

.nav-btn:hover {
  color: #495057;
  background-color: #e9ecef;
}

.nav-btn.active {
  color: #6697ff;
  background-color: #e3f2fd;
}

.nav-btn.active i {
  color: #6697ff;
}

/* ===== 主要內容區域 ===== */
.myContent {
  margin-top: 120px !important;
  position: fixed !important;
  width: 100%;
  padding-bottom: 20px;
  /* 确保内容固定但不影响modal层级 */
  z-index: 1 !important;
}

/* 为modal创建更高的stacking context */
.modal {
  position: fixed !important;
  z-index: 9999 !important;
  background-color: rgba(0, 0, 0, 0.5) !important;
}

.modal-backdrop {
  display: none !important;
}

.modal-dialog {
  position: relative !important;
  z-index: 10000 !important;
}

.modal-content {
  position: relative !important;
  z-index: 10001 !important;
}

/* Readonly字段样式 - 与admin一致 */
#addID {
  font-size: 2rem !important;
  font-weight: 500 !important;
  background-color: transparent !important;
  border: none !important;
  outline-width: 0 !important;
}

/* Box ID字段也使用相同样式 */
#addBoxModal #addID {
  font-size: 2rem !important;
  font-weight: 500 !important;
  background-color: transparent !important;
  border: none !important;
  outline-width: 0 !important;
}

.content {
  margin-top: 120px !important;
  width: 100%;
  padding-bottom: 20px;
}

/* ===== 管理儀表板樣式 ===== */
.dashboard-container {
  gap: 1px;
}

.dashboard-btn {
  height: 45px; 
  min-width: 60px; 
  display: flex; 
  flex-direction: column; 
  justify-content: center; 
  align-items: center; 
  flex: 1;
}

/* ===== 日期選擇器樣式 ===== */
.date-picker-icon {
  height: 38px;
}

.date-picker-input {
  font-size: 18px !important; 
  height: 38px; 
  padding: 0px 2px;
}

.date-picker-separator {
  height: 38px; 
  border-radius: 0;
  border-left-style: hidden;
  border-right-style: hidden;
}

/* ===== Tab 和表單樣式 ===== */
.tab-content {
  width: 90%;
}

.tab-pane {
  width: 100%;
}

.editform {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.myTable {
  margin-top: 120px;
  width: 100%;
  height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
}

textarea {
  resize: none;
}

/* ===== 表單狀態樣式 ===== */
form.is-readonly input[readonly],
input[disabled]:not([type="submit"]):not([type="button"]),
textarea[readonly],
textarea[disabled] {
  cursor: text;
  background-color: #fff !important;
  border-color: transparent;
  outline-color: transparent;
  box-shadow: none;
}

form.is-editing .KeyEditBtn {
  display: none !important;
}

/* ===== 禁用按钮樣式 ===== */
input[type="submit"]:disabled,
input[type="button"]:disabled,
button:disabled {
  opacity: 0.6 !important;
  cursor: not-allowed !important;
  background-color: #6c757d !important;
  border-color: #6c757d !important;
  color: #fff !important;
}

form.is-readonly .KeyUpdateBtn {
  display: none !important;
}

/* ===== 個人資料表單樣式 ===== */
#info-form {
  font-size: 1rem !important;
  font-weight: 800;
}

#info-form .form-control-plaintext {
  font-size: 1.25rem !important;
  font-weight: 500;
}

/* ===== 選單樣式 ===== */
.menu {
  height: 320px;
  font-size: 1.5rem;
  position: fixed;
  top: 60px;
  width: 100%;
  background-color: #343a40;
  display: none;
  /* z-index: 3; */
}

.menu ul li a {
  padding: 3px;
  display: inline-block;
  text-decoration: none;
  color: #ccc;
  font-size: 1.1em;
  width: 100%;
  padding-left: 20px;
  white-space: nowrap;
}

/* ===== 卡片樣式 ===== */
.card-header {
  background-color: #204863;
}

.card {
  border-color: #204863;
}

/* ===== 邊框樣式 ===== */
.border-left-primary {
  border-left: 0.5rem solid #4e73df !important;
}

.border-left-info {
  border-left: 0.5rem solid #36b9cc !important;
}

.border-left-success {
  border-left: 0.5rem solid #1cc88a !important;
}

.border-left-warning {
  border-left: 0.5rem solid #f6c23e !important;
}

/* ===== 通知徽章樣式 ===== */
.nav-link {
  position: relative;
}

.checkNotification {
  position: relative;
}

.checkNotification .badge-counter {
  position: absolute;
  transform: scale(0.7);
  transform-origin: top left;
  right: .25rem;
  margin-top: -.25rem;
}

#checkNotification2 {
  position: absolute;
  transform: scale(0.7);
  transform-origin: top right;
  right: .25rem;
  margin-top: -.25rem;
}

/* ===== 表格樣式 ===== */
.detail {
  table-layout: fixed;
  word-wrap: break-word !important;
}

.detail tr td:nth-child(2),
.detail tr td:nth-child(3),
.detail tr td:nth-child(4),
.detail tr td:nth-child(5) {
  width: 5%;
}

/* ===== 金鑰長度驗證樣式 ===== */
.warning { 
  color: red; 
  display: none; 
  font-size: 12px;
  margin-top: 5px;
  margin-bottom: 10px;
}

textarea.error { 
  border-color: red; 
}

.KeyUpdateBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== 固定表格標題樣式 ===== */
.fixed-table-header {
  position: fixed;
  top: 120px;
  left: 0;
  right: 0;
  /* z-index: 1; */
  background-color: #f8f9fa;
  border-bottom: 2px solid #dee2e6;
}

.fixed-table-header table {
  margin-bottom: 0;
  table-layout: fixed;
  width: 100%;
}

/* ===== 可滾動表格主體 ===== */
.scrollable-table-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 60px;
}

.scrollable-table-body table {
  margin-bottom: 0;
  table-layout: fixed;
  width: 100%;
}

/* ===== Records 表格列寬 ===== */
#table th:first-child,
#table td:first-child,
#table-body th:first-child,
#table-body td:first-child {
  width: 30%;
}

/* 同步標題和主體的列寬 */
.fixed-table-header th:nth-child(1),
.scrollable-table-body td:nth-child(1) { 
  width: 30% !important; 
  min-width: 0;
}
.fixed-table-header th:nth-child(2),
.scrollable-table-body td:nth-child(2) { 
  width: 20% !important; 
  min-width: 0;
}
.fixed-table-header th:nth-child(3),
.scrollable-table-body td:nth-child(3) { 
  width: 8% !important; 
  min-width: 0;
}
.fixed-table-header th:nth-child(4),
.scrollable-table-body td:nth-child(4) { 
  width: 8% !important; 
  min-width: 0;
}
.fixed-table-header th:nth-child(5),
.scrollable-table-body td:nth-child(5) { 
  width: 8% !important; 
  min-width: 0;
}
.fixed-table-header th:nth-child(6),
.scrollable-table-body td:nth-child(6) { 
  width: 26% !important; 
  min-width: 0;
  font-size: 0.8rem;
}

/* ===== Records 表格樣式 ===== */
#table {
  margin-bottom: 0;
  table-layout: fixed;
  width: 100%;
}

#table thead th {
  background-color: #f8f9fa;
  border-bottom: 2px solid #dee2e6;
  font-weight: 600;
  padding: 0.75rem 0.5rem;
  position: sticky;
  top: 0;
  /* z-index: 1; */
  font-size: 0.8rem;
}

#table tbody td {
  padding: 0.5rem;
  border-bottom: 1px solid #dee2e6;
}

/* ===== 動態內容表格樣式 ===== */
#dynamicContent table {
  margin-bottom: 0;
  table-layout: fixed;
  width: 100%;
}

#dynamicContent table thead th {
  background-color: #f8f9fa;
  border-bottom: 2px solid #dee2e6;
  font-weight: 600;
  padding: 0.75rem 0.5rem;
  position: sticky;
  top: 0;
  /* z-index: 1; */
  font-size: 0.8rem;
}

#dynamicContent table tbody td {
  padding: 0.5rem;
  border-bottom: 1px solid #dee2e6;
}

/* ===== Modal 樣式 ===== */
.modal-header-padding {
  padding: 10px 20px;
}

.modal-body-padding {
  padding: 20px;
}

/* Mobile Modal优化 - 使用标准Bootstrap行为 */
@media (max-width: 768px) {
  .modal-dialog {
    margin: 60px 15px 15px 15px;
    max-width: calc(100% - 30px);
  }
}

/* Sales Record Modal移动端滚动优化 */
#boxDetailModal .modal-dialog {
  max-width: calc(100vw - 10px) !important;
  width: calc(100vw - 10px) !important;
  margin: 60px auto 15px auto !important;
}

#boxDetailModal .modal-content {
  max-height: calc(100vh - 120px) !important;
  overflow: hidden !important;
}

#boxDetailModal .modal-body {
  padding: 10px !important;
  overflow: hidden !important;
  max-height: calc(100vh - 200px) !important;
}

#boxDetailModal .table-responsive {
  overflow: visible !important;
  max-height: none !important;
}

/* DataTable在Modal中的滚动设置 */
#boxDetailModal .dataTables_wrapper {
  overflow: visible !important;
}

#boxDetailModal .dataTables_scrollBody {
  overflow-x: auto !important;
  overflow-y: auto !important;
  max-height: calc(100vh - 300px) !important;
  -webkit-overflow-scrolling: touch !important;
}

#boxDetailModal .dataTables_scrollHead {
  overflow-x: hidden !important;
}

#boxDetailModal table {
  width: 100% !important;
  min-width: 800px !important; /* 确保表格有足够宽度可以水平滚动 */
}

#boxDetailModal table th,
#boxDetailModal table td {
  white-space: nowrap !important;
  padding: 8px 6px !important;
  font-size: 0.8rem !important;
}

/* All Devices主表格垂直滚动优化 */
#dynamicContent #showAllDevices .dataTables_wrapper {
  overflow: visible !important;
}

#dynamicContent #showAllDevices .dataTables_scrollBody {
  overflow-x: auto !important;
  overflow-y: auto !important;
  max-height: 50vh !important;
  -webkit-overflow-scrolling: touch !important;
}

#dynamicContent #showAllDevices .dataTables_scrollHead {
  overflow-x: hidden !important;
}

#dynamicContent #showAllDevices .dataTables_scrollHead .dataTables_scrollHeadInner {
  margin-bottom: 0 !important; /* 移除底部间距 */
}

#dynamicContent #showAllDevices .dataTables_scrollHead {
  margin-bottom: 0 !important; /* 移除表头底部间距 */
}

#dynamicContent #showAllDevices .dataTables_scroll {
  border-collapse: collapse !important;
}

#dynamicContent #showAllDevices table {
  width: 100% !important;
  margin-bottom: 0 !important;
  margin-top: 0 !important; /* 移除顶部间距 */
}

/* 移除card相关样式，因为mobile版本不使用card */

#dynamicContent #showAllDevices table th {
  background-color: #f8f9fa !important;
  position: sticky !important;
  top: 0 !important;
  /* z-index: 10 !important; */
  border-bottom: 2px solid #dee2e6 !important;
}

#dynamicContent #showAllDevices table td {
  border-bottom: 1px solid #dee2e6 !important;
}

/* 移动端表格行悬停效果 */
#dynamicContent #showAllDevices table tbody tr:hover {
  background-color: #f8f9fa !important;
}

/* Add User表格垂直滚动优化 */
#dynamicContent #showAllUsers .dataTables_wrapper {
  overflow: visible !important;
}

#dynamicContent #showAllUsers .dataTables_scrollBody {
  overflow-x: auto !important;
  overflow-y: auto !important;
  max-height: 50vh !important;
  -webkit-overflow-scrolling: touch !important;
}

#dynamicContent #showAllUsers .dataTables_scrollHead {
  overflow-x: hidden !important;
}

#dynamicContent #showAllUsers .dataTables_scrollHead .dataTables_scrollHeadInner {
  margin-bottom: 0 !important; /* 移除底部间距 */
}

#dynamicContent #showAllUsers .dataTables_scrollHead {
  margin-bottom: 0 !important; /* 移除表头底部间距 */
}

#dynamicContent #showAllUsers .dataTables_scroll {
  border-collapse: collapse !important;
}

#dynamicContent #showAllUsers table {
  width: 100% !important;
  margin-bottom: 0 !important;
  margin-top: 0 !important;
}

#dynamicContent #showAllUsers table th {
  background-color: #f8f9fa !important;
  position: sticky !important;
  top: 0 !important;
  /* z-index: 10 !important; */
  border-bottom: 2px solid #dee2e6 !important;
  text-align: center !important;
}

#dynamicContent #showAllUsers table td {
  border-bottom: 1px solid #dee2e6 !important;
  text-align: center !important;
}

#dynamicContent #showAllUsers table tbody tr:hover {
  background-color: #f8f9fa !important;
}

/* All Clients表格垂直滚动优化 */
#dynamicContent #showAllClient .dataTables_wrapper {
  overflow: visible !important;
}

#dynamicContent #showAllClient .dataTables_scrollBody {
  overflow-x: auto !important;
  overflow-y: auto !important;
  max-height: 50vh !important;
  -webkit-overflow-scrolling: touch !important;
}

#dynamicContent #showAllClient .dataTables_scrollHead {
  overflow-x: hidden !important;
}

#dynamicContent #showAllClient .dataTables_scrollHead .dataTables_scrollHeadInner {
  margin-bottom: 0 !important; /* 移除底部间距 */
}

#dynamicContent #showAllClient .dataTables_scrollHead {
  margin-bottom: 0 !important; /* 移除表头底部间距 */
}

#dynamicContent #showAllClient .dataTables_scroll {
  border-collapse: collapse !important;
}

#dynamicContent #showAllClient table {
  width: 100% !important;
  margin-bottom: 0 !important;
  margin-top: 0 !important;
}

#dynamicContent #showAllClient table th {
  background-color: #f8f9fa !important;
  position: sticky !important;
  top: 0 !important;
  /* z-index: 10 !important; */
  border-bottom: 2px solid #dee2e6 !important;
  text-align: center !important;
}

#dynamicContent #showAllClient table td {
  border-bottom: 1px solid #dee2e6 !important;
  text-align: center !important;
}

#dynamicContent #showAllClient table tbody tr:hover {
  background-color: #f8f9fa !important;
}

/* Add Boxes表格垂直滚动优化 */
#dynamicContent #showAllBox .dataTables_wrapper {
  overflow: visible !important;
}

#dynamicContent #showAllBox .dataTables_scrollBody {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  max-height: 50vh !important;
  -webkit-overflow-scrolling: touch !important;
}

#dynamicContent #showAllBox .dataTables_scrollHead {
  overflow-x: hidden !important;
}

#dynamicContent #showAllBox .dataTables_scrollHead .dataTables_scrollHeadInner {
  margin-bottom: 0 !important; /* 移除底部间距 */
}

#dynamicContent #showAllBox .dataTables_scrollHead {
  margin-bottom: 0 !important; /* 移除表头底部间距 */
}

#dynamicContent #showAllBox .dataTables_scroll {
  border-collapse: collapse !important;
}

#dynamicContent #showAllBox table {
  width: 100% !important;
  margin-bottom: 0 !important;
  margin-top: 0 !important;
}

#dynamicContent #showAllBox table th {
  background-color: #f8f9fa !important;
  position: sticky !important;
  top: 0 !important;
  /* z-index: 10 !important; */
  border-bottom: 2px solid #dee2e6 !important;
  text-align: center !important;
  white-space: nowrap !important;
}

#dynamicContent #showAllBox table td {
  border-bottom: 1px solid #dee2e6 !important;
  text-align: center !important;
  white-space: nowrap !important;
}

#dynamicContent #showAllBox table tbody tr:hover {
  background-color: #f8f9fa !important;
}

/* Pair表格样式优化 (复用showAllBox的ID，因为Pair页面也使用这个ID) */
/* 当在Pair页面时，showAllBox包含checkbox表格 */
#dynamicContent #showAllBox input[type="checkbox"] {
  transform: scale(1.2);
  margin: 0;
}

#dynamicContent #showAllBox .checkAll-container {
  display: flex;
  align-items: center;
  justify-content: center;
}

#dynamicContent #showAllBox .checkItem-container {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== 狀態圖標樣式 ===== */
.status-joystick-enabled {
  filter: invert(75%) sepia(18%) saturate(1467%) hue-rotate(346deg) brightness(98%) contrast(91%);
}

.status-joystick-disabled {
  filter: invert(100%) sepia(0%) saturate(7500%) hue-rotate(71deg) brightness(100%) contrast(100%);
}

/* ===== 操作按鈕樣式 ===== */
.action-buttons {
  white-space: nowrap;
}

/* ===== 忘記密碼分隔線 ===== */
.forgot-password-hr {
  border: 1px solid #ccc; 
  width: 100%;
}

/* ===== 隱藏元素樣式 ===== */
.d-none {
  display: none !important;
}

/* ===== 個人資料頁面樣式 ===== */
.email-verification-text {
  color: Gray;
}

.resend-email-link {
  color: red; 
  font-weight: 600;
}

.nav-tab-nowrap {
  white-space: nowrap;
}

.tab-content-full-width {
  width: 100%;
}

.profile-form-container {
  max-height: 400px;
}

/* ===== 通知頁面樣式 ===== */
.notification-container {
  margin-top: 120px;
}

/* ===== Tab 圖片樣式 ===== */
.tab-image {
  height: 30px !important;
}

/* ===== 移动端展开功能样式 ===== */
.details-control {
    text-align: center;
    cursor: pointer;
    padding: 8px !important;
}

.details-control i {
    font-size: 16px;
    transition: all 0.3s ease;
}

.details-control:hover i {
    transform: scale(1.1);
}

.details-row {
    background-color: #f8f9fa !important;
}

.details-row td {
    text-align: left !important;
    vertical-align: top !important;
    font-size: 14px;
}

.details-row .row {
    margin: 0;
}

.details-row .col-12 {
    padding: 0 5px;
}

.details-row strong {
    color: #495057;
    font-weight: 600;
    font-size: 13px;
}

/* 简单表格容器样式 */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* 移动端3列表格优化 */
#dynamicContent table {
    width: 100%;
    table-layout: fixed;
}

#dynamicContent table th:nth-child(1),
#dynamicContent table td:nth-child(1) {
    width: 40px;
    text-align: center;
}

#dynamicContent table th:nth-child(2),
#dynamicContent table td:nth-child(2) {
    width: 40%;
    text-align: left;
    padding-left: 15px;
}

#dynamicContent table th:nth-child(3),
#dynamicContent table td:nth-child(3) {
    width: 30%;
    text-align: center;
}

#dynamicContent table th:nth-child(4),
#dynamicContent table td:nth-child(4) {
    width: 30%;
    text-align: center;
}

#dynamicContent table th,
#dynamicContent table td {
    padding: 12px 8px;
    font-size: 14px;
    vertical-align: middle;
}

/* 移动端响应式 */
@media (max-width: 768px) {
    .details-control i {
        font-size: 16px;
    }
    
    .details-row td {
        padding: 12px !important;
        font-size: 13px;
        text-align: left !important;
    }
    
    .details-row strong {
        font-size: 13px;
        color: #495057;
    }
    
    .details-row .col-12 {
        padding: 5px 0;
    }
    
    #dynamicContent table th,
    #dynamicContent table td {
        padding: 10px 6px;
        font-size: 13px;
    }
}