/* ============================================
   PTC Tu Vi Plugin - tuvi.css
   ============================================ */

/* ----- Wrapper ----- */
#ptc-tuvi-wrap {
  font-family: 'Segoe UI', Arial, sans-serif;
  max-width: 980px;
  margin: 0 auto;
  color: #222;
}
.ptc-tuvi-title {
  color: #333;
  border-bottom: 2px solid #a21313;
  padding-bottom: 8px;
  margin-bottom: 20px;
  font-size: 1.5rem;
  margin-top: 30px;
}
.ptc-tuvi-title span {
	color: #c00;
    font-weight: bold;
}

.page-wrapper {
	padding-top: 0 !important;
}

/* ----- TABS ----- */
.ptc-tab-header {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid #a21313;
  margin-bottom: 16px;
}
.ptc-tab-btn {
  padding: 8px 18px;
  border: 1px solid #ddd;
  border-bottom: none;
  background: #f5f5f5;
  cursor: pointer;
  border-radius: 4px 4px 0 0;
  font-size: 0.9rem;
  transition: background .2s;
}
.ptc-tab-btn.active,
.ptc-tab-btn:hover {
  background: #a21313;
  color: #fff;
  border-color: #a21313;
}
.ptc-tab-content { display: none; }
.ptc-tab-content.active { display: block; }

/* ----- FORM GRID ----- */
.ptc-form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.ptc-col-12 { flex: 0 0 100%; }
.ptc-col-4  { min-width: 120px; }

.ptc-form-row label,
.ptc-option-group label:not(.ptc-check-label) {
  display: block;
  font-weight: 600;
  color: #555;
  font-size: 0.88rem;
  margin-bottom: 4px;
}
.ptc-input {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9rem;
}
.ptc-select {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.88rem;
  background: #fff;
}
.ptc-select-full { width: 100%; }

/* Legacy field-row (kept for compatibility) */
.ptc-field-row {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}
.ptc-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.ptc-form-row #ptc-noisinh {
	margin: 0;
}

/* ----- TUY CHON AN SAO ----- */
.ptc-option-group {
  margin-bottom: 10px;
}
.ptc-option-label {
  font-weight: 700;
  color: #333;
  font-size: 0.88rem;
  margin-bottom: 6px;
}
.ptc-check-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  font-size: 0.87rem;
  color: #444;
  margin-bottom: 5px;
  line-height: 1.4;
}
.ptc-check-label input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
}
.ptc-divider {
  border: none;
  border-top: 1px solid #e5e5e5;
  margin: 10px 0;
}

/* ----- BUTTONS ----- */
.ptc-form-actions {
  margin-top: 18px;
  text-align: left;
}
.ptc-btn-primary {
  background: #a21313;
  color: #fff;
  border: none;
  padding: 10px 36px;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: background .2s;
}
.ptc-btn-primary:hover { background: #5a0000; }
.ptc-btn-secondary {
  background: #555;
  color: #fff;
  border: none;
  padding: 7px 18px;
  border-radius: 5px;
  font-size: 0.85rem;
  cursor: pointer;
  margin-right: 8px;
  transition: background .2s;
}
.ptc-btn-secondary:hover { background: #333; }

/* ----- LOADING ----- */
#ptc-loading {
  text-align: center;
  padding: 30px;
  color: #a21313;
}
.ptc-spinner {
  width: 42px; height: 42px;
  border: 5px solid #f3f3f3;
  border-top: 5px solid #a21313;
  border-radius: 50%;
  animation: ptcSpin 0.8s linear infinite;
  margin: 0 auto 10px;
}
@keyframes ptcSpin { to { transform: rotate(360deg); } }

/* ----- RESULT ACTIONS ----- */
.ptc-result-actions {
  margin: 14px 0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ============================
   CHART: 4x4 grid (12 cung)
   ============================ */
#ptc-chart-container {
  overflow-x: auto;
}
.ptc-chart-title {
  text-align: center;
  font-size: 1.1rem;
  font-weight: bold;
  color: #333;
  margin-bottom: 10px;
}
.ptc-chart-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 600px;
  table-layout: fixed;
}
.ptc-chart-table td {
  border: 1px solid #ccc;
  vertical-align: top;
  padding: 5px 6px;
  font-size: 0.78rem;
  height: 140px;
}
/* Center merged cell (spans 2x2) */
.ptc-center-cell {
  text-align: center;
  vertical-align: middle !important;
  background: #f8f9fa;
  font-size: 0.78rem;
  line-height: 1.5;
}
.ptc-center-cell .ptc-center-name {
  font-size: 1.15rem;
  font-weight: bold;
  color: #a21313;
  margin-bottom: 4px;
}
.ptc-center-cell .ptc-center-info { color: #333; }

/* Palace header */
.ptc-palace-header {
  font-weight: bold;
  color: #333;
  font-size: 0.82rem;
  border-bottom: 1px solid #ddd;
  margin-bottom: 3px;
  padding-bottom: 2px;
  display: flex;
  justify-content: space-between;
}
.ptc-palace-header .ptc-chi { color: #666; }
.ptc-palace-header .ptc-age { color: #888; font-size: 0.72rem; }

/* Stars */
.ptc-stars { line-height: 1.6; }
.ptc-star { display: inline-block; margin-right: 3px; font-size: 0.76rem; }
.ptc-star-kim   { color: #c8860a; font-weight: bold; }
.ptc-star-moc   { color: #1a7a1a; font-weight: bold; }
.ptc-star-thuy  { color: #1a56c4; font-weight: bold; }
.ptc-star-hoa   { color: #c00;    font-weight: bold; }
.ptc-star-tho   { color: #8a5a00; font-weight: bold; }
.ptc-star-other { color: #444; }
.ptc-star-tuhoa { font-style: italic; }

/* Palace footer */
.ptc-palace-footer {
  margin-top: 4px;
  font-size: 0.7rem;
  color: #888;
  border-top: 1px solid #eee;
  padding-top: 2px;
  display: flex;
  justify-content: space-between;
}

#ptc-tuvi-form :is(button, fieldset, input, select, textarea) {
	margin-bottom: 0 !important;
	margin: 0;
	margin-top: 4px;
}

/* ----- RESPONSIVE ----- */
@media (max-width: 600px) {
  .ptc-field-row label:first-child { width: 120px; font-size: 0.85rem; }
  .ptc-chart-table { min-width: 420px; font-size: 0.68rem; }
  .ptc-chart-table td { height: 100px; padding: 3px; }
}
