/* public/css/style.css */
:root {
  --primary-color: #4361ee;
  --bg-gradient: linear-gradient(135deg, #1e1e2f 0%, #0f0f1a 100%);
  --card-bg: rgba(255, 255, 255, 0.05);
}

body {
  background: var(--bg-gradient);
  min-height: 100vh;
  font-family:
    "Segoe UI",
    system-ui,
    -apple-system,
    sans-serif;
  color: #fff;
  margin: 0;
}

.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

/* 🔍 Logo 調整為 280px */
.login-logo {
  max-width: 280px;
  height: auto;
  filter: drop-shadow(0 0 15px rgba(67, 97, 238, 0.6));
  animation: pulse 3s infinite ease-in-out;
}

@keyframes pulse {
  0% {
    opacity: 0.8;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.02);
  } /* 280px 較大，縮放幅度改細啲以免太跳 */
  100% {
    opacity: 0.8;
    transform: scale(1);
  }
}

/* 登入卡片 */
.login-card {
  width: 100%;
  max-width: 450px; /* 配合大 Logo 稍微加寬卡片 */
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 3rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.apply-shake {
  animation: shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20%,
  60% {
    transform: translateX(-10px);
  }
  40%,
  80% {
    transform: translateX(10px);
  }
}

/* 📊 系統健康卡片 (Dashboard) */
.health-card {
  background: var(--card-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 18px;
  transition: transform 0.3s;
}
.health-card:hover {
  transform: translateY(-3px);
  background: rgba(255, 255, 255, 0.08);
}
.health-val {
  font-size: 1.6rem;
  font-weight: bold;
  line-height: 1.2;
}
.progress {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
}

/* 監控表格 */
.table {
  color: #eee !important;
  font-size: 0.9rem;
}
.table-dark-custom {
  background: rgba(0, 0, 0, 0.2) !important;
  border-radius: 8px;
  overflow: hidden;
}
.sort-header {
  cursor: pointer;
  transition: background 0.2s;
  position: relative;
}
.sort-header:hover {
  background: rgba(255, 255, 255, 0.1) !important;
}

/* 其他樣式 */
.form-control {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
}
.form-control:focus {
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  border-color: var(--primary-color);
  box-shadow: none;
}
.mfa-input {
  letter-spacing: 0.6rem;
  font-family: monospace;
  font-size: 1.6rem !important;
  text-align: center;
  color: #f72585 !important;
  font-weight: bold;
}

.status-online {
  color: #2ecc71;
  text-shadow: 0 0 5px rgba(46, 204, 113, 0.5);
}
.status-stopped {
  color: #e74c3c;
  text-shadow: 0 0 5px rgba(231, 76, 60, 0.5);
}

.terminal {
  background: #000;
  color: #00ff00;
  font-family: "Courier New", monospace;
  padding: 15px;
  height: calc(100vh - 300px);
  overflow-y: auto;
  overflow-x: hidden;      /* 🚀 隱藏底部橫向捲軸，保持美觀 */
  font-size: 0.85rem;
  border: 1px solid #333;
  white-space: pre-wrap;   /* 🚀 保留 Log 嘅原始空格，但允許換行 */
  word-break: break-all;   /* 🚀 強制將超長嘅無空格字串 (例如 Token) 切斷換行 */
}

.password-wrapper {
  position: relative;
}
.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  opacity: 0.6;
}

/* 手機端優化 */
@media (max-width: 768px) {
  .p-4 { padding: 1rem !important; }
  
  /* 隱藏部分不重要的表格欄位 */
  .table th:nth-child(3), .table td:nth-child(3),
  .table th:nth-child(4), .table td:nth-child(4) {
    display: none;
  }

  /* Log Viewer 側邊欄改為頂部或摺疊 */
  .log-sidebar {
    width: 100% !important;
    height: 150px;
    border-right: none !important;
    border-bottom: 1px solid var(--bs-border-color);
  }
  
  .flex-grow-1.d-flex.overflow-hidden {
    flex-direction: column;
  }

  /* 登入卡片寬度調整 */
  .login-card {
    padding: 1.5rem !important;
    margin: 1rem;
  }
}