/* /opt/nscenter/static/css/main.css */

/* ===== Base ===== */

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #111;
  color: #eee;
}

/* เก่าจากระบบเดิม */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: #222;
  border-bottom: 1px solid #333;
}

.topbar a {
  color: #ccc;
  margin-left: 12px;
  text-decoration: none;
  font-size: 0.95rem;
}

.topbar a:hover {
  color: #fff;
}

.logo {
  font-weight: bold;
  margin-right: 8px;
}

.zone-label {
  font-size: 0.85rem;
  color: #aaa;
}

.page {
  padding: 16px;
}

.panel {
  max-width: 900px;
  margin: 24px auto;
  background: #1c1c1c;
  border-radius: 8px;
  padding: 16px 20px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.6);
}

h1, h2 {
  margin-top: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 10px;
}

label {
  display: block;
  font-size: 0.9rem;
}

input,
select,
button {
  width: 100%;
  padding: 6px 8px;
  margin-top: 4px;
  border-radius: 4px;
  border: 1px solid #444;
  background: #111;
  color: #eee;
  box-sizing: border-box;
}

button {
  cursor: pointer;
  background: #2d6cdf;
  border-color: #2d6cdf;
}

button:hover {
  background: #3f79e2;
}

.table-section {
  margin-top: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

th,
td {
  border-bottom: 1px solid #333;
  padding: 6px 8px;
  text-align: left;
  font-size: 0.9rem;
}

/* Toast เดิม */
#toast-container {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 9999;
}

.toast {
  background: #333;
  color: #eee;
  padding: 8px 10px;
  margin-top: 6px;
  border-radius: 4px;
  font-size: 0.85rem;
  opacity: 0.95;
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.toast-info    { border-left: 4px solid #2196f3; }
.toast-success { border-left: 4px solid #4caf50; }
.toast-error   { border-left: 4px solid #f44336; }

.toast.fadeout {
  opacity: 0;
  transform: translateY(10px);
}

/* ===== Top Bar ใหม่ (NS Center) ===== */

.top-bar {
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
  padding: 8px 16px;
}

.top-bar-inner {
  max-width: 1024px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-circle {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  background: linear-gradient(135deg, #38bdf8, #6366f1);
  color: #0b1120;
}

.top-bar-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.top-bar-title {
  font-size: 15px;
  font-weight: 600;
  color: #e5e7eb;
}

.top-bar-sub {
  font-size: 12px;
  color: #9ca3af;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-nav .nav-link {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  color: #e5e7eb;
  text-decoration: none;
  border: 1px solid transparent;
  background: rgba(15,23,42,0.2);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.top-nav .nav-link:hover {
  background: rgba(148,163,184,0.2);
  border-color: rgba(148,163,184,0.5);
}

.page-main {
  max-width: 1024px;
  margin: 16px auto;
  padding: 0 16px 24px;
}

/* ===== Page Header (ใช้ในหน้า DDNS Clients ฯลฯ) ===== */

.page-header {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-header-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* 🔻 ลดขนาดหัวเรื่องหลักของหน้า */
.page-header-main h1 {
  font-size: 0.9rem;      /* เล็กลงจากหัวเรื่องปกติ */
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.page-subtitle {
  margin: 0;
  font-size: 0.75rem;
  color: #9ca3af;
}

/* ===== Card / Table / Toolbar / Status ===== */

.card {
  background: #111827;
  border-radius: 8px;
  padding: 10px 12px;     /* ลด padding ให้เตี้ยลง */
  margin-bottom: 12px;
  border: 1px solid #1f2937;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.5);
}

/* Header ของการ์ด (เช่น "รายการ Clients", "SST Register") */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

/* 🔻 ลดขนาดตัวหนังสือหัวเรื่องในการ์ด */
.card-header > div:first-child,
.card h1 {
  font-size: 0.82rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.02em;
}

/* ถ้ามี h2 ในการ์ด */
.card h2 {
  font-size: 0.8rem;
  margin: 0 0 5px 0;
  font-weight: 600;
}

.card-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-body {
  font-size: 0.75rem;
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
}

/* ตาราง generic ใช้กับ class="table" (หน้า DDNS) */
.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 4px;
  background: #020617;
}

/* ลดขนาดตัวหนังสือและ padding ของตารางให้เล็กลงดูแน่น */
.table th,
.table td {
  border-bottom: 1px solid #1f2937;
  padding: 4px 6px;
  font-size: 0.75rem;
  line-height: 1.15;
}

.table th {
  background: #020617;
  color: #9ca3af;
  font-weight: 500;
}

.table tr:nth-child(even) td {
  background: #020617;
}

/* ตารางแบบ ns-table (หน้า VPN / Nameserver เดิม) */
.ns-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6px;
  background: #020617;
}

.ns-table th,
.ns-table td {
  border-bottom: 1px solid #1f2937;
  padding: 4px 6px;
  font-size: 0.75rem;
  line-height: 1.15;
}

.ns-table th {
  background: #020617;
  color: #9ca3af;
  font-weight: 500;
}

.ns-table tr:nth-child(even) td {
  background: #020617;
}

/* toolbar ใต้ตาราง / ใต้ฟอร์ม */
.toolbar,
.form-actions {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== ปุ่ม / input แบบ panel เล็ก ===== */

.btn,
.btn-primary,
.btn-secondary {
  width: auto;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}

/* ปุ่ม default */
.btn {
  background: #1f2937;
  border-color: #374151;
  color: #e5e7eb;
}

.btn:hover {
  background: #111827;
}

/* ปุ่มหลัก (สีฟ้า) */
.btn-primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #e5e7eb;
}

.btn-primary:hover {
  background: #1d4ed8;
}

/* ปุ่มรอง (เทา) */
.btn-secondary {
  background: #374151;
  border-color: #4b5563;
  color: #e5e7eb;
}

.btn-secondary:hover {
  background: #111827;
}

/* ช่องในฟอร์ม ddns-form */
.form-row {
  margin-bottom: 8px;
}

.form-row label {
  font-size: 0.78rem;
  margin-bottom: 2px;
}

.form-row input {
  font-size: 0.78rem;
  padding: 4px 6px;
  height: 24px;
}

/* ===== Status message / WG status ===== */

.msg {
  min-height: 1em;
  font-size: 0.7rem;
  color: #9ca3af;
}

.ok {
  color: #4ade80;
}

.err {
  color: #f97373;
}

/* WG status text (หน้า VPN) */
#wg-name,
#wg-status,
#wg-ip,
#wg-peers {
  font-size: 0.75rem;
}

/* label สถานะให้ดูเป็นป้าย */
.wg-status-label {
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* input ในตาราง (VPN, DDNS) ให้เล็กลง */
.ns-table input,
.table input {
  font-size: 0.75rem;
  padding: 3px 5px;
  height: 22px;
}
