/* Organization Chart Styles */

/* Section Headers */
.org-section {
  margin-bottom: 3rem;
}

.org-section-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 3px solid #0d3b66;
}

.org-section-title {
  font-size: 2rem;
  font-weight: 700;
  color: #0d3b66;
  margin-bottom: 0.5rem;
}

.org-section-subtitle {
  font-size: 1rem;
  color: #6c757d;
}

/* Collapsible Section */
.collapsible-section {
  background: #f8f9fa;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 2rem;
}

.collapsible-header {
  background: linear-gradient(135deg, #0d3b66 0%, #2a6f7e 100%);
  color: white;
  padding: 1rem 1.5rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.3s ease;
}

.collapsible-header:hover {
  background: linear-gradient(135deg, #0a2d4d 0%, #1f5560 100%);
}

.collapsible-header h3 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.collapsible-icon {
  font-size: 1.2rem;
  transition: transform 0.3s ease;
}

.collapsible-header.active .collapsible-icon {
  transform: rotate(180deg);
}

.collapsible-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  padding: 0 1.5rem;
}

.collapsible-content.active {
  max-height: 2000px;
  padding: 1.5rem;
}

/* Organization Groups */
.org-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.org-group {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.org-group:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* Organization Header */
.org-group-header {
  background: linear-gradient(135deg, #0d3b66 0%, #2a6f7e 100%);
  color: white;
  padding: 1.25rem;
  text-align: center;
}

.org-group-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.9;
}

.org-group-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

/* Member List */
.org-members {
  padding: 1.25rem;
}

.org-member {
  padding: 0.75rem 0;
  border-bottom: 1px solid #e9ecef;
}

.org-member:last-child {
  border-bottom: none;
}

.member-position {
  font-size: 0.85rem;
  font-weight: 600;
  color: #0d3b66;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}

.member-name {
  font-size: 1rem;
  font-weight: 500;
  color: #2d3748;
  margin-bottom: 0.25rem;
}

.member-name.vacant {
  color: #9ca3af;
  font-style: italic;
  font-weight: 400;
}

.member-contact {
  font-size: 0.85rem;
  color: #6c757d;
  margin-top: 0.25rem;
}

.member-contact i {
  width: 16px;
  text-align: center;
  margin-right: 0.25rem;
}

.member-contact a {
  color: #0d3b66;
  text-decoration: none;
}

.member-contact a:hover {
  text-decoration: underline;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #6c757d;
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* General Leadership (Simple List) */
.general-leadership-list {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.leadership-group {
  margin-bottom: 1.5rem;
}

.leadership-group:last-child {
  margin-bottom: 0;
}

.leadership-group-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #0d3b66;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e9ecef;
}

.leadership-members {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
}

.leadership-member {
  padding: 0.5rem;
  font-size: 0.95rem;
}

.leadership-member-position {
  font-size: 0.8rem;
  font-weight: 600;
  color: #6c757d;
  text-transform: uppercase;
}

.leadership-member-name {
  color: #2d3748;
  font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
  .org-section-title {
    font-size: 1.75rem;
  }

  .org-groups {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .collapsible-header h3 {
    font-size: 1.25rem;
  }

  .leadership-members {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .org-section-title {
    font-size: 1.5rem;
  }

  .org-group-header {
    padding: 1rem;
  }

  .org-group-title {
    font-size: 1.1rem;
  }

  .org-members {
    padding: 1rem;
  }
}

/* Loading Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.org-group {
  animation: fadeIn 0.5s ease;
}

.org-group:nth-child(1) { animation-delay: 0.1s; }
.org-group:nth-child(2) { animation-delay: 0.2s; }
.org-group:nth-child(3) { animation-delay: 0.3s; }
.org-group:nth-child(4) { animation-delay: 0.4s; }
.org-group:nth-child(5) { animation-delay: 0.5s; }
.org-group:nth-child(6) { animation-delay: 0.6s; }

/* View Toggle */
.view-controls {
  text-align: center;
  margin-bottom: 2rem;
  padding: 1rem;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.view-toggle {
  display: inline-flex;
  gap: 0.5rem;
  background: #f1f5f9;
  padding: 0.25rem;
  border-radius: 8px;
}

.view-toggle-btn {
  padding: 0.5rem 1.5rem;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}

.view-toggle-btn.active {
  background: linear-gradient(135deg, #0d3b66 0%, #2a6f7e 100%);
  color: white;
  box-shadow: 0 2px 4px rgba(13, 59, 102, 0.3);
}

.view-toggle-btn:hover:not(.active) {
  background: #e2e8f0;
  color: #0d3b66;
}

/* Organization Filter */
.org-filter {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.filter-btn {
  padding: 0.4rem 1rem;
  border: 1px solid #cbd5e0;
  background: white;
  color: #4a5568;
  cursor: pointer;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
}

.filter-btn:hover {
  border-color: #0d3b66;
  color: #0d3b66;
  background: #f8fafc;
}

.filter-btn.active {
  background: #0d3b66;
  color: white;
  border-color: #0d3b66;
}

/* Chart View Styles */
.chart-view {
  display: none;
}

.chart-view.active {
  display: block;
}

#orgChartDiv {
  width: 100%;
  background: linear-gradient(135deg, #0d3b66 0%, #1a4d6d 50%, #0d3b66 100%);
  border-radius: 12px;
  padding: 2rem;
  overflow: auto;
  position: relative;
  max-height: 800px;
}

/* Zoom Controls */
.zoom-controls {
  position: sticky;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-bottom: 1rem;
  z-index: 100;
}

.zoom-btn {
  background: white;
  border: 2px solid #0d3b66;
  color: #0d3b66;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.25rem;
  font-weight: bold;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.zoom-btn:hover {
  background: #0d3b66;
  color: white;
  transform: scale(1.1);
}

.zoom-btn:active {
  transform: scale(0.95);
}

.zoom-level {
  background: white;
  border: 2px solid #0d3b66;
  color: #0d3b66;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#orgChartDiv.dragging {
  cursor: grabbing !important;
  user-select: none;
}

#orgChartDiv:not(.dragging) {
  cursor: grab;
}

/* Hierarchical Org Chart */
.hierarchical-chart {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  min-width: 800px;
  padding-bottom: 2rem;
  transform-origin: top center;
  transition: transform 0.3s ease;
}

/* Bishopric Section */
.bishopric-section {
  text-align: center;
  margin-bottom: 2rem;
  position: relative;
}

.bishopric-header {
  background: white;
  border: 5px solid #f4a900;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  margin-bottom: 1rem;
  min-width: 250px;
  position: relative;
  z-index: 2;
}

/* Connection indicator from Bishopric */
.connection-line {
  position: absolute;
  bottom: -2rem;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 2rem;
  background: linear-gradient(180deg, #f4a900 0%, #5a7a8f 100%);
  z-index: 1;
}

.connection-line::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 10px solid #5a7a8f;
}

.bishopric-title {
  color: #0d3b66;
  font-weight: 700;
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.bishopric-title i {
  font-size: 2rem;
  color: #f4a900;
}

.bishopric-members {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.bishopric-member {
  background: rgba(255, 255, 255, 0.95);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border-left: 4px solid #f4a900;
  min-width: 150px;
}

.member-position {
  font-size: 0.75rem;
  color: #0d3b66;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.member-name {
  font-size: 0.95rem;
  color: #2d3748;
  font-weight: 500;
}

.member-name.vacant {
  color: #9ca3af;
  font-style: italic;
}

/* Organizations Grid */
.orgs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 250px));
  gap: 3rem 2rem;
  width: 100%;
  max-width: 1400px;
  position: relative;
  padding-top: 3rem;
  justify-content: center;
}

.org-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  position: relative;
  cursor: pointer;
  height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
}

.org-card::before {
  content: '';
  position: absolute;
  top: -2.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 2.5rem;
  background: linear-gradient(180deg, #5a7a8f 0%, transparent 100%);
}

.org-card::after {
  content: '';
  position: absolute;
  top: -2.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  background: #5a7a8f;
  border-radius: 50%;
  border: 2px solid #0d3b66;
}

.org-card:hover {
  transform: translateY(-8px) scale(1.05);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.org-card:active {
  transform: translateY(-4px) scale(1.02);
}

.org-card-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  color: #00bcd4;
  transition: all 0.3s ease;
}

.org-card.yellow-theme .org-card-icon {
  color: #f4a900;
}

.org-card:hover .org-card-icon {
  transform: scale(1.1);
}

.org-card-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: #0d3b66;
}

.org-card-count {
  font-size: 0.75rem;
  color: #6c757d;
  margin-top: 0.25rem;
}

/* Organization Modal */
.org-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  animation: fadeIn 0.3s ease;
}

.org-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.org-modal-content {
  background: white;
  border-radius: 16px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.org-modal-header {
  background: linear-gradient(135deg, #00bcd4 0%, #0097a7 100%);
  color: white;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.org-modal-header.yellow-theme {
  background: linear-gradient(135deg, #f4a900 0%, #e09500 100%);
}

.org-modal-title-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.org-modal-icon {
  font-size: 2rem;
}

.org-modal-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}

.org-modal-close {
  background: transparent;
  border: none;
  color: white;
  font-size: 1.75rem;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.org-modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.org-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.org-hierarchy-level {
  margin-bottom: 1rem;
}

.org-hierarchy-level:last-child {
  margin-bottom: 0;
}

.level-title {
  font-size: 0.75rem;
  color: #6c757d;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 2px solid #e9ecef;
}

.level-members {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.hierarchy-member {
  padding: 0.5rem;
  background: #f8fafc;
  border-radius: 6px;
  border-left: 3px solid #00bcd4;
}

.hierarchy-member.yellow-accent {
  border-left-color: #f4a900;
}

.hierarchy-position {
  font-size: 0.8rem;
  color: #0d3b66;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.hierarchy-name {
  font-size: 0.9rem;
  color: #2d3748;
}

.hierarchy-name.vacant {
  color: #9ca3af;
  font-style: italic;
}

/* Responsive Design for Org Chart */
@media (max-width: 768px) {
  #orgChartDiv {
    padding: 1rem;
  }

  .hierarchical-chart {
    min-width: auto;
    width: 100%;
  }

  .orgs-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .bishopric-header {
    padding: 1rem;
  }

  .bishopric-title {
    font-size: 1.25rem;
  }

  .bishopric-members {
    flex-direction: column;
    align-items: center;
  }

  .bishopric-member {
    width: 100%;
    max-width: 250px;
  }
}

@media (max-width: 480px) {
  .org-card-header {
    padding: 0.75rem;
  }

  .org-card-title {
    font-size: 1rem;
  }

  .org-card-body {
    padding: 0.75rem;
  }
}

.tree-org {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
  overflow: hidden;
}

.tree-org-header {
  background: linear-gradient(135deg, #0d3b66 0%, #2a6f7e 100%);
  color: white;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.tree-org-icon {
  font-size: 2rem;
}

.tree-org-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}

.tree-hierarchy {
  padding: 2rem;
}

.tree-level {
  position: relative;
  padding-left: 2rem;
  margin-bottom: 1rem;
}

.tree-level:before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, #0d3b66 0%, transparent 100%);
}

.tree-level-0 {
  padding-left: 0;
}

.tree-level-0:before {
  display: none;
}

.tree-position {
  position: relative;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  background: #f8fafc;
  border-radius: 8px;
  border-left: 3px solid #0d3b66;
  transition: all 0.2s;
}

.tree-position:hover {
  background: #f1f5f9;
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.tree-position.vacant {
  border-left-color: #cbd5e0;
  opacity: 0.7;
}

.tree-position-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: #0d3b66;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}

.tree-position-name {
  font-size: 1rem;
  font-weight: 500;
  color: #2d3748;
}

.tree-position-name.vacant {
  color: #9ca3af;
  font-style: italic;
  font-weight: 400;
}

.tree-position-contact {
  font-size: 0.85rem;
  color: #6c757d;
  margin-top: 0.25rem;
}

/* Card View */
.card-view {
  display: block;
}

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

.card-view:not(.active) {
  display: none;
}
