/* Event Mail Form Styles */

.teacher-selection-layout {
  display: flex;
  gap: 30px;
  min-height: 400px;
}

/* Full screen modal adjustments */

.teachers-column {
  flex: 1;
  border-right: 2px solid #e0e0e0;
  padding-right: 20px;
}

.selected-column {
  flex: 1;
  padding-left: 20px;
  background-color: #f8f9fa;
  border-radius: 5px;
  padding: 15px;
  display: flex;
  flex-direction: column;
}

/* Province-level grouping (Level 2) */
.province-group {
  margin-bottom: 35px;
  border: 2px solid #2c5282;
  border-radius: 8px;
  padding: 20px;
  background-color: #f7fafc;
}

.province-group.collapsed {
  padding: 0;
}

.province-group.collapsed .province-content {
  display: none;
}

.province-header {
  margin: 0 0 20px 0;
  color: #1a202c;
  font-size: 18px;
  font-weight: bold;
  border-bottom: 3px solid #2c5282;
  padding-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  position: relative;
  user-select: none;
  transition: all 0.2s ease;
}

.province-header:hover {
  background-color: rgba(44, 82, 130, 0.05);
  margin: -5px -10px 20px -10px;
  padding: 5px 10px 8px 10px;
  border-radius: 4px;
}

.province-header::after {
  content: "▼";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  transition: transform 0.2s ease;
}

.province-group.collapsed .province-header {
  margin: 0;
  padding: 15px;
  border-bottom: none;
}

.province-group.collapsed .province-header::after {
  transform: translateY(-50%) rotate(-90deg);
}

.province-actions {
  margin-top: 15px;
  padding: 8px 12px;
  background-color: #e2e8f0;
  border-radius: 5px;
  text-align: center;
}

.province-actions span {
  display: inline-block;
  margin: 0 8px;
  padding: 4px 12px;
  background-color: #2c5282;
  color: white;
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition: background-color 0.2s ease;
}

.province-actions span:hover {
  background-color: #2a4b7c;
}

.province-actions .deselect-province {
  background-color: #e53e3e;
}

.province-actions .deselect-province:hover {
  background-color: #c53030;
}

/* District-level grouping (Level 3) */
.district-group {
  margin-bottom: 20px;
  border: 1px solid #cbd5e0;
  border-radius: 5px;
  padding: 15px;
  background-color: #ffffff;
  margin-left: 15px;
}

.district-group.collapsed {
  padding: 0;
}

.district-group.collapsed .district-content {
  display: none;
}

.district-header {
  margin: 0 0 12px 0;
  color: #2d3748;
  font-size: 15px;
  font-weight: 600;
  border-bottom: 2px solid #4299e1;
  padding-bottom: 5px;
  cursor: pointer;
  position: relative;
  user-select: none;
  transition: all 0.2s ease;
}

.district-header:hover {
  background-color: rgba(66, 153, 225, 0.05);
  margin: -5px -10px 12px -10px;
  padding: 5px 10px 5px 10px;
  border-radius: 3px;
}

.district-header::after {
  content: "▼";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  transition: transform 0.2s ease;
}

.district-group.collapsed .district-header {
  margin: 0;
  padding: 12px;
  border-bottom: none;
}

.district-group.collapsed .district-header::after {
  transform: translateY(-50%) rotate(-90deg);
}

.district-actions {
  margin-top: 10px;
  padding: 5px 8px;
  background-color: #edf2f7;
  border-radius: 3px;
  text-align: center;
}

.district-actions span {
  display: inline-block;
  margin: 0 5px;
  padding: 3px 8px;
  background-color: #4299e1;
  color: white;
  border-radius: 2px;
  cursor: pointer;
  font-size: 10px;
  transition: background-color 0.2s ease;
}

.district-actions span:hover {
  background-color: #3182ce;
}

.district-actions .deselect-district {
  background-color: #f56565;
}

.district-actions .deselect-district:hover {
  background-color: #e53e3e;
}

/* School type grouping */
.school-type-group {
  margin-bottom: 10px;
}

.school-type-header {
  margin: 0 0 8px 0;
  color: #4a5568;
  font-size: 13px;
  font-weight: 500;
  background-color: #e2e8f0;
  padding: 4px 8px;
  border-radius: 3px;
  border-left: 3px solid #4299e1;
}

.district-group label {
  display: block;
  margin-bottom: 8px;
  padding: 8px 12px;
  background-color: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 13px;
}

.district-group label:hover {
  background-color: #f0f4f8;
  border-color: #a0a0a0;
}

.district-group label.has_sport {
  background-color: #e6fffa;
  border-color: #38b2ac;
  font-weight: 500;
}

.district-group label.has_sport:hover {
  background-color: #b2f5ea;
}

.district-group input[type="checkbox"] {
  margin-right: 8px;
  transform: scale(1.1);
}

.check_actions {
  margin-top: 15px;
  padding: 10px;
  background-color: #e2e8f0;
  border-radius: 3px;
  text-align: center;
}

.check_actions span {
  display: inline-block;
  margin: 0 10px;
  padding: 5px 15px;
  background-color: #4299e1;
  color: white;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  transition: background-color 0.2s ease;
}

.check_actions span:hover {
  background-color: #3182ce;
}

.check_actions .deselect-all {
  background-color: #e53e3e;
}

.check_actions .deselect-all:hover {
  background-color: #c53030;
}

.selected-column h3 {
  margin: 0 0 15px 0;
  color: #2d3748;
  font-size: 16px;
}

#selected_emails_display {
  flex: 1;
  overflow-y: auto;
  border: 1px solid #e0e0e0;
  border-radius: 3px;
  background-color: #fff;
  padding: 10px;
  min-height: 200px;
}

.selected-email-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 8px 10px;
  margin-bottom: 8px;
  background-color: #e6fffa;
  border: 1px solid #38b2ac;
  border-radius: 3px;
  font-size: 13px;
  line-height: 1.3;
}

.selected-email-item .email-info {
  flex: 1;
  padding-right: 10px;
}

.selected-email-item .email-info strong {
  display: block;
  font-weight: 600;
  margin-bottom: 2px;
  color: #2d3748;
}

.selected-email-item .email-info small {
  display: block;
  color: #4a5568;
  margin-bottom: 1px;
  font-size: 11px;
}

.selected-email-item .email-info .school-sport {
  color: #38b2ac;
  font-size: 10px;
  font-weight: 500;
  margin-top: 2px;
}

.selected-email-item .remove-email {
  color: #e53e3e;
  cursor: pointer;
  font-weight: bold;
  font-size: 16px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 2px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.selected-email-item .remove-email:hover {
  color: #fff;
  background-color: #e53e3e;
}

.selected-emails-column {
  margin-top: 20px;
}

.selected-emails-column h3 {
  margin: 0 0 10px 0;
  color: #2d3748;
}

#selected_emails_list {
  min-height: 100px;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #e0e0e0;
  border-radius: 3px;
  padding: 10px;
  background-color: #f8f9fa;
}

/* Responsive design */
@media (max-width: 768px) {
  .teacher-selection-layout {
    flex-direction: column;
  }

  .teachers-column {
    border-right: none;
    border-bottom: 2px solid #e0e0e0;
    padding-right: 0;
    padding-bottom: 20px;
  }

  .selected-column {
    padding-left: 0;
    padding-top: 20px;
  }
}

/* Enhanced styling for forms with district layout */
.district_layout .form-item {
  margin-bottom: 0;
}

.district_layout .form-item-teacher-selection {
  margin: 0;
}

.teachers-column > h3,
.selected-column > h3 {
  margin-top: 0;
  margin-bottom: 15px;
  padding: 10px 15px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 5px;
  font-size: 16px;
  text-align: center;
}

/* Email counter */
.email-counter {
  text-align: center;
  margin-bottom: 10px;
  font-weight: bold;
  color: #4a5568;
}

/* Loading state */
.teachers-loading {
  text-align: center;
  padding: 40px;
  color: #a0a0a0;
}

.teachers-loading:before {
  content: "⏳";
  margin-right: 10px;
}
