* {
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  background-color: #eef2f5;
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
}

/* BỐ CỤC 2 CỘT CHÍNH */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* CỘT NHẬP THÔNG SỐ (BÊN TRÁI) */
.sidebar-panel {
  width: 360px;
  min-width: 320px;
  height: 100vh;
  background: white;
  padding: 20px;
  box-shadow: 2px 0 10px rgba(0,0,0,0.08);
  z-index: 10;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-panel h3 {
  margin-top: 0;
  color: #1a252f;
  border-bottom: 2px solid #0056b3;
  padding-bottom: 10px;
  margin-bottom: 15px;
  text-align: center;
}

/* STYLE ACCORDION (MENU SỔ XUỐNG) */
.acc-group {
  border: 1px solid #dce4ec;
  border-radius: 6px;
  margin-bottom: 10px;
  background-color: #fcfdfe;
  overflow: hidden;
}

.acc-title {
  font-weight: bold;
  font-size: 14px;
  color: #1a252f;
  padding: 12px 15px;
  background-color: #f1f5f9;
  cursor: pointer;
  user-select: none;
  outline: none;
  transition: background 0.2s;
}

.acc-title:hover {
  background-color: #e2e8f0;
  color: #0056b3;
}

.acc-group[open] .acc-title {
  background-color: #e2e8f0;
  border-bottom: 1px solid #cbd5e1;
  color: #0056b3;
}

.acc-content {
  padding: 12px 15px;
  max-height: 350px; /* Thêm dòng này để giới hạn chiều cao mục mở rộng */
  overflow-y: auto;  /* Hiện thanh cuộn riêng nếu quá nhiều ô nhập */
}

.form-group {
  margin-bottom: 12px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  font-weight: bold;
  color: #475569;
}

.form-group input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 13px;
}

.form-group input:focus {
  border-color: #0056b3;
  outline: none;
}

.button-group {
  margin-top: auto;
  padding-top: 15px;
}

.btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-pdf {
  background-color: #28a745;
  color: white;
}

.btn-pdf:hover {
  background-color: #218838;
}

.btn:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

/* CỘT HIỂN THỊ BẢN VẼ (BÊN PHẢI) */
.preview-panel {
  flex: 1;
  padding: 25px;
  overflow-y: auto;
  background-color: #eef2f5;
  display: flex;
  justify-content: center;
}

#svg-preview-list {
  display: flex;
  flex-direction: column;
  gap: 25px;
  width: 100%;
  max-width: 950px;
  align-items: center;
}

/* KIỂU DÁNG TỪNG TRANG BẢN VẼ */
.svg-page-item {
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  width: 100%;
}

.svg-content {
  display: flex;
  justify-content: center;
}

.svg-content svg {
  width: 100%;
  height: auto;
}

/* TỐI ƯU KHI IN / XUẤT PDF TRÀN VIỀN A4 */
@media print {
  @page {
    size: A4 landscape;
    margin: 0 !important;
  }

  html, body, .app-layout {
    width: 297mm !important;
    height: 210mm !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: white !important;
  }

  .sidebar-panel {
    display: none !important;
  }

  .preview-panel {
    padding: 0 !important;
    margin: 0 !important;
    width: 297mm !important;
    overflow: visible !important;
    background: white !important;
  }

  #svg-preview-list {
    gap: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 297mm !important;
    max-width: none !important;
  }

  .svg-page-item {
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 297mm !important;
    height: 210mm !important;
    max-width: 297mm !important;
    max-height: 210mm !important;
    page-break-after: always !important;
    break-after: page !important;
    page-break-inside: avoid !important;
    display: block !important;
  }

  .svg-content {
    width: 297mm !important;
    height: 210mm !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .svg-content svg {
    width: 297mm !important;
    height: 210mm !important;
    max-width: none !important;
    max-height: none !important;
    display: block !important;
  }
}
