/* Teachers Cards Module Styles */
.teachers-cards-module {
  width: 100%;
  margin: 0 auto;
  padding: 20px 0;
}

.joomla-admin .teachers-cards-module {
  background: #f8fafc;
  border-radius: 8px;
  padding: 20px;
  margin: 10px 0;
}

.teachers-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* Responsive grid based on cards per row setting */
.teachers-grid[data-cards-per-row="2"] {
  grid-template-columns: repeat(auto-fit, minmax(45%, 1fr));
}

.teachers-grid[data-cards-per-row="3"] {
  grid-template-columns: repeat(auto-fit, minmax(30%, 1fr));
}

.teachers-grid[data-cards-per-row="4"] {
  grid-template-columns: repeat(auto-fit, minmax(22%, 1fr));
}

.teachers-grid[data-cards-per-row="6"] {
  grid-template-columns: repeat(auto-fit, minmax(15%, 1fr));
}

/* Teacher Card Styles */
.teacher-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 28px 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(226, 232, 240, 0.6);
  transition: all 0.3s ease;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.teacher-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.06);
  border-color: rgba(139, 69, 19, 0.2);
}

.teacher-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(139, 69, 19, 0.02) 0%, transparent 50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.teacher-card:hover::after {
  opacity: 1;
}

/* Avatar Styles */
.teacher-avatar {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: linear-gradient(135deg, #8b4513 0%, #a0522d 100%);
  box-shadow: 0 4px 16px rgba(139, 69, 19, 0.2), 0 2px 4px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.9);
  transition: all 0.3s ease;
}

.teacher-card:hover .teacher-avatar {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(139, 69, 19, 0.3), 0 3px 6px rgba(0, 0, 0, 0.15);
}

/* Added styles for teacher photos with proper sizing and fallback */
.teacher-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.teacher-initials {
  color: white;
  font-size: 32px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

/* Teacher Info */
.teacher-info {
  flex: 1;
}

.teacher-name {
  font-size: 20px;
  font-weight: 700;
  color: #2d3748;
  margin: 0 0 12px 0;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.teacher-name.clickable {
  cursor: pointer;
  color: #8b4513;
  transition: all 0.3s ease;
  position: relative;
}

.teacher-name.clickable:hover {
  color: #a0522d;
  text-decoration: underline;
  transform: translateY(-1px);
}

.teacher-name.clickable::after {
  content: "ℹ️";
  font-size: 14px;
  margin-left: 8px;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.teacher-name.clickable:hover::after {
  opacity: 1;
}

.teacher-instruments {
  font-size: 13px;
  color: #64748b;
  margin: 0;
  line-height: 1.5;
  font-weight: 500;
  background: rgba(139, 69, 19, 0.08);
  padding: 8px 16px;
  border-radius: 20px;
  display: inline-block;
  border: 1px solid rgba(139, 69, 19, 0.15);
  transition: all 0.3s ease;
}

.teacher-card:hover .teacher-instruments {
  background: rgba(139, 69, 19, 0.12);
  color: #8b4513;
  border-color: rgba(139, 69, 19, 0.25);
}

/* Added email contact icon styles */
.teacher-contact {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.email-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #8b4513 0%, #a0522d 100%);
  color: white;
  border-radius: 50%;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(139, 69, 19, 0.3);
}

.email-icon:hover {
  transform: translateY(-2px) scale(1.1);
  box-shadow: 0 4px 16px rgba(139, 69, 19, 0.4);
  background: linear-gradient(135deg, #a0522d 0%, #8b4513 100%);
  color: white;
  text-decoration: none;
}

.email-icon svg {
  width: 18px;
  height: 18px;
  transition: transform 0.2s ease;
}

.email-icon:hover svg {
  transform: scale(1.1);
}

/* Classic Style Variant */
.teachers-cards-module.classic .teacher-card {
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.teachers-cards-module.classic .teacher-card:hover {
  transform: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.teachers-cards-module.classic .teacher-avatar {
  border-radius: 8px;
}

.teachers-cards-module.classic .teacher-photo {
  border-radius: 8px;
}

/* Enhanced import zone styles for better visibility */
.teachers-import-zone {
  margin: 15px 0;
  padding: 20px;
  border: 3px dashed #8b4513;
  border-radius: 12px;
  background: linear-gradient(135deg, #faf9f7 0%, #f5f1eb 100%);
  text-align: center;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.teachers-import-zone h4 {
  color: #8b4513;
  margin-bottom: 15px;
  font-size: 18px;
  font-weight: 600;
}

.teachers-import-zone p {
  color: #6b7280;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.5;
}

.import-file-input {
  display: none;
}

.import-file-button {
  background: linear-gradient(135deg, #8b4513 0%, #a0522d 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(139, 69, 19, 0.3);
  margin: 5px;
}

.import-file-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 69, 19, 0.4);
}

.import-execute-button {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
  margin: 5px;
}

.import-execute-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.4);
}

.import-status {
  margin-top: 15px;
  padding: 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
}

.import-status.success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.import-status.error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

/* Subform Styling */
.subform-repeatable-wrapper {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin: 15px 0;
  overflow: hidden;
}

.subform-repeatable-wrapper .subform-repeatable {
  border: none !important;
  background: transparent;
}

.subform-repeatable-wrapper .subform-repeatable-group {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin: 10px;
  padding: 20px;
  transition: all 0.3s ease;
  position: relative;
}

.subform-repeatable-wrapper .subform-repeatable-group:hover {
  box-shadow: 0 4px 12px rgba(139, 69, 19, 0.1);
  border-color: #8b4513;
}

/* Form Field Styling */
.subform-repeatable-wrapper .control-group {
  margin-bottom: 15px;
}

.subform-repeatable-wrapper .control-label {
  font-weight: 600;
  color: #374151;
  margin-bottom: 5px;
  display: block;
  font-size: 14px;
}

.subform-repeatable-wrapper .controls input[type="text"],
.subform-repeatable-wrapper .controls input[type="email"],
.subform-repeatable-wrapper .controls textarea {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.3s ease;
  background: #fafafa;
}

.subform-repeatable-wrapper .controls input:focus,
.subform-repeatable-wrapper .controls textarea:focus {
  outline: none;
  border-color: #8b4513;
  background: white;
  box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.1);
}

/* Media Field Styling */
.subform-repeatable-wrapper .field-media-wrapper {
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  padding: 15px;
  text-align: center;
  background: #f9fafb;
  transition: all 0.3s ease;
}

.subform-repeatable-wrapper .field-media-wrapper:hover {
  border-color: #8b4513;
  background: #faf9f7;
}

.subform-repeatable-wrapper .field-media-wrapper img {
  max-width: 120px;
  max-height: 120px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Action Buttons */
.subform-repeatable-wrapper .group-add,
.subform-repeatable-wrapper .group-remove {
  background: linear-gradient(135deg, #8b4513 0%, #a0522d 100%);
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 2px;
}

.subform-repeatable-wrapper .group-add:hover,
.subform-repeatable-wrapper .group-remove:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(139, 69, 19, 0.3);
}

.subform-repeatable-wrapper .group-remove {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

/* Responsive Design */
@media (max-width: 1200px) {
  .teachers-grid[data-cards-per-row="4"] {
    grid-template-columns: repeat(auto-fit, minmax(30%, 1fr));
  }

  .teachers-grid[data-cards-per-row="6"] {
    grid-template-columns: repeat(auto-fit, minmax(22%, 1fr));
  }

  .subform-repeatable-wrapper .subform-repeatable-group {
    margin: 8px;
    padding: 15px;
  }

  .teachers-import-zone {
    padding: 20px 15px;
  }
}

@media (max-width: 768px) {
  .teachers-cards-module {
    padding: 15px 0;
  }

  .teachers-grid {
    gap: 15px;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }

  .teachers-grid[data-cards-per-row="2"],
  .teachers-grid[data-cards-per-row="3"],
  .teachers-grid[data-cards-per-row="4"],
  .teachers-grid[data-cards-per-row="6"] {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }

  .teacher-card {
    padding: 20px;
  }

  .joomla-admin .teachers-cards-module {
    padding: 15px;
    margin: 5px 0;
  }

  .subform-repeatable-wrapper .subform-repeatable-group {
    margin: 5px;
    padding: 12px;
  }

  .subform-repeatable-wrapper .controls input[type="text"],
  .subform-repeatable-wrapper .controls input[type="email"] {
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .teachers-import-zone {
    padding: 15px 10px;
  }

  .import-file-button,
  .import-execute-button {
    display: block;
    width: 100%;
    margin: 8px 0;
  }
}

@media (max-width: 480px) {
  .teachers-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .teacher-card {
    padding: 16px;
  }

  .teacher-avatar {
    width: 75px;
    height: 75px;
    margin-bottom: 12px;
  }

  .teacher-initials {
    font-size: 24px;
  }

  .teacher-name {
    font-size: 16px;
  }

  .teacher-instruments {
    font-size: 13px;
  }

  .subform-repeatable-wrapper .subform-repeatable-group {
    padding: 10px;
  }

  .subform-repeatable-wrapper .control-label {
    font-size: 13px;
  }

  .teachers-import-zone h4 {
    font-size: 16px;
  }

  .teachers-import-zone p {
    font-size: 13px;
  }
}

/* Print Styles */
@media print {
  .teacher-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }

  .teacher-card:hover {
    transform: none;
  }
}

/* Dark Mode Support for Backend */
@media (prefers-color-scheme: dark) {
  .joomla-admin .teachers-cards-module {
    background: #1f2937;
  }

  .subform-repeatable-wrapper .subform-repeatable-group {
    background: #374151;
    border-color: #4b5563;
  }

  .subform-repeatable-wrapper .control-label {
    color: #f3f4f6;
  }

  .subform-repeatable-wrapper .controls input[type="text"],
  .subform-repeatable-wrapper .controls input[type="email"],
  .subform-repeatable-wrapper .controls textarea {
    background: #4b5563;
    border-color: #6b7280;
    color: #f3f4f6;
  }
}

/* Added modal popup styles for additional teacher information */
.teacher-modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

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

.modal-content {
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  animation: slideIn 0.3s ease;
  position: relative;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  background: linear-gradient(135deg, #8b4513 0%, #a0522d 100%);
  color: white;
  padding: 24px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.modal-close {
  background: none;
  border: none;
  color: white;
  font-size: 32px;
  font-weight: 300;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
  line-height: 1;
}

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

.modal-body {
  padding: 30px;
  overflow-y: auto;
  max-height: calc(80vh - 100px);
}

.modal-body #modalTeacherInfo {
  font-size: 16px;
  line-height: 1.6;
  color: #374151;
  white-space: pre-wrap;
}

.modal-body #modalTeacherInfo p {
  margin-bottom: 16px;
}

.modal-body #modalTeacherInfo:last-child {
  margin-bottom: 0;
}

/* Responsive modal styles */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    max-height: 90vh;
    border-radius: 12px;
  }

  .modal-header {
    padding: 20px;
  }

  .modal-header h2 {
    font-size: 20px;
  }

  .modal-close {
    font-size: 28px;
    width: 36px;
    height: 36px;
  }

  .modal-body {
    padding: 20px;
    max-height: calc(90vh - 80px);
  }

  .modal-body #modalTeacherInfo {
    font-size: 15px;
  }
}

@media (max-width: 480px) {
  .modal-content {
    width: 98%;
    max-height: 95vh;
    border-radius: 8px;
  }

  .modal-header {
    padding: 16px;
  }

  .modal-header h2 {
    font-size: 18px;
  }

  .modal-body {
    padding: 16px;
    max-height: calc(95vh - 70px);
  }

  .modal-body #modalTeacherInfo {
    font-size: 14px;
  }
}
