/* =========================
   GLOBAL
========================= */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background: #f4f7fb;
  color: #1f2937;
  min-height: 100vh;
}

/* =========================
   HEADER
========================= */

.header {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: white;
  padding: 24px 40px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.header-content {
  max-width: 1200px;
  margin: auto;
}

.header h1 {
  font-size: 28px;
  margin-bottom: 6px;
}

.header p {
  opacity: 0.9;
  font-size: 14px;
}

/* =========================
   MAIN CONTAINER
========================= */

.container {
  max-width: 1200px;
  margin: 30px auto;
  padding: 0 20px;
}

/* =========================
   TOP BAR
========================= */

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

.top-bar h2 {
  font-size: 22px;
  color: #111827;
}

/* =========================
   BUTTONS
========================= */

.btn {
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: #2563eb;
  color: white;
}

.btn-primary:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.btn-primary:disabled {
  background: #10b981;
  cursor: not-allowed;
  opacity: 0.8;
}

.btn-primary:disabled:hover {
  background: #059669;
  transform: none;
}

.btn-secondary {
  background: #e5e7eb;
  color: #374151;
}

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

.btn-danger {
  background: #fee2e2;
  color: #b91c1c;
}

.btn-danger:hover {
  background: #fecaca;
}

/* =========================
   FORM CARD
========================= */

.form-card {
  background: white;
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.07);
  margin-bottom: 40px;
  display: none;
}

.form-card.active {
  display: block;
}

.form-title {
  font-size: 21px;
  margin-bottom: 25px;
  color: #111827;
}

/* =========================
   FORM SECTIONS
========================= */

.form-section {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}

.form-section h3 {
  font-size: 16px;
  color: #2563eb;
  margin-bottom: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group.full {
  grid-column: 1 / -1;
}

/* =========================
   FORM ELEMENTS
========================= */

label {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 7px;
  color: #374151;
}

input,
select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #d1d5db;
  border-radius: 7px;
  outline: none;
  font-size: 14px;
  background: white;
  transition: border-color 0.2s;
}

input:focus,
select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* =========================
   CATEGORY DESCRIPTION
========================= */

.category-description {
  background: #eff6ff;
  border-radius: 7px;
  padding: 10px 12px;
  color: #1e40af;
  font-size: 13px;
  margin-top: 10px;
}

.connection-help {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  border-radius: 7px;
  padding: 10px 12px;
  font-size: 13px;
  margin-top: 10px;
  display: none;
}

.connection-help.show {
  display: block;
}

/* =========================
   FORM ACTIONS
========================= */

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 25px;
}

/* =========================
   TREE SECTION
========================= */

.tree-section {
  background: white;
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.07);
}

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

.tree-header h2 {
  font-size: 21px;
}

/* =========================
   TREE CONTAINER
========================= */

.tree-container {
  overflow-x: auto;
  padding: 40px 20px 60px;
  min-height: 400px;
}

.tree {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 800px;
}

/* =========================
   TREE LEVELS
========================= */

.tree-level {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 35px;
  position: relative;
  width: 100%;
}

.tree-level + .tree-level {
  margin-top: 55px;
}

.tree-level + .tree-level::before {
  content: "";
  position: absolute;
  top: -55px;
  left: 50%;
  width: 2px;
  height: 55px;
  background: #cbd5e1;
}

/* =========================
   PERSON CARD
========================= */

.person-card {
  position: relative;
  width: 190px;
  background: white;
  border: 2px solid #dbeafe;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.person-card.root {
  border-color: #2563eb;
  background: #eff6ff;
}

/* =========================
   PERSON AVATAR
========================= */

.person-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #dbeafe;
  color: #1d4ed8;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  font-size: 18px;
  font-weight: bold;
}

/* =========================
   PERSON INFORMATION
========================= */

.person-card h4 {
  font-size: 15px;
  margin-bottom: 5px;
  color: #111827;
}

.relationship {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 20px;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 11px;
  margin-top: 5px;
}

.person-contact {
  font-size: 11px;
  color: #6b7280;
  margin-top: 8px;
  line-height: 1.5;
}

/* =========================
   EMPTY STATE
========================= */

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #9ca3af;
}

.empty-state-icon {
  font-size: 45px;
  margin-bottom: 15px;
}

.empty-state h3 {
  color: #6b7280;
  margin-bottom: 8px;
}

/* =========================
   PROFESSIONAL CARDS
========================= */

.professional-card {
  border-color: #ddd6fe;
}

.professional-card .person-avatar {
  background: #ede9fe;
  color: #7c3aed;
}

.professional-section {
  width: 100%;
  margin-top: 60px;
}

.professional-title {
  text-align: center;
  margin-bottom: 20px;
  font-weight: bold;
  color: #7c3aed;
  font-size: 16px;
}

/* =========================
   NOTIFICATION
========================= */

.notification {
  position: fixed;
  right: 25px;
  bottom: 25px;
  background: #16a34a;
  color: white;
  padding: 13px 18px;
  border-radius: 8px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
  display: none;
  font-size: 14px;
  z-index: 1000;
}

.notification.show {
  display: block;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 700px) {
  .header {
    padding: 20px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-group.full {
    grid-column: auto;
  }

  .top-bar {
    align-items: flex-start;
    gap: 15px;
    flex-direction: column;
  }

  .form-card,
  .tree-section {
    padding: 18px;
  }

  .tree-container {
    padding-left: 10px;
    padding-right: 10px;
  }
}
