/* Projects Page Styles - Using main theme colors */

.projects-page {
  color: var(--text);
}

.coming-soon-banner {
  background: linear-gradient(135deg, #38bdf8 0%, #1e40af 100%);
  padding: 2rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  animation: slideDown 0.5s ease-out;
  max-width: 600px;
  width: 100%;
}

.coming-soon-banner.hidden {
  display: none;
}

.coming-soon-banner:not(.hidden) {
  display: block;
}

.banner-content {
  text-align: center;
  color: white;
  width: 100%;
}

.banner-content h2 {
  margin: 0 0 0.5rem 0;
  font-size: 1.5rem;
}

.banner-content p {
  margin: 0;
  font-size: 1rem;
  opacity: 0.95;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

#top {
  display: block;
}

#top:has(.coming-soon-banner:not(.hidden)) {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 80px);
}

.projects-section {
  padding: 2rem 1rem;
}

.projects-section.hidden {
  display: none;
}

.section-header {
  text-align: center;
  margin-bottom: 3rem;
}

.section-header h1 {
  font-size: 2.5rem;
  margin: 0 0 0.5rem 0;
}

.section-header p {
  font-size: 1.1rem;
  color: var(--muted);
  margin: 0;
}

.projects-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  width: 100%;
  max-width: none;
  margin: 0;
}

@media (max-width: 1024px) {
  .projects-container {
    grid-template-columns: 1fr;
  }
}

.card-surface {
  background: var(--surface-strong);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.card-surface h2 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  border-bottom: 2px solid var(--accent-2);
  padding-bottom: 1rem;
  color: var(--text);
}

.card-surface h3 {
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  font-size: 1.1rem;
  color: var(--text);
}

/* Form Styles */
.group-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

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

.form-group label {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}

.form-group input,
.form-group textarea {
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: all 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

.members-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.members-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.member-input-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.member-search-container {
  position: relative;
  width: 100%;
  font-size: 0.95rem;
  color: var(--text);
}

.student-id-input {
  width: 100%;
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: all 0.3s ease;
}

.student-id-input:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

.student-suggestions {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  left: auto;
  background: var(--surface-strong);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
  min-width: 300px;
}

.student-suggestions.hidden {
  display: none;
}

.student-suggestions li {
  padding: 0.75rem;
  cursor: pointer;
  transition: all 0.3s ease;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.student-suggestions li:last-child {
  border-bottom: none;
}

.student-suggestions li:hover {
  background: var(--surface);
  color: var(--accent-2);
}

.student-suggestion-id {
  font-weight: 600;
  color: var(--accent-2);
  min-width: 80px;
}

.student-suggestion-name {
  font-size: 0.85rem;
  color: var(--muted);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-display {
  display: none;
  min-height: 1.5rem;
  padding: 0.5rem;
  font-size: 0.9rem;
  color: var(--accent-3);
  align-items: center;
  gap: 0.5rem;
}

.member-display.selected {
  display: flex;
}

.member-display.selected::before {
  content: "✓";
  font-weight: bold;
  color: var(--accent-3);
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.button {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.button.primary {
  background: var(--accent-2);
  color: white;
}

.button.primary:hover:not(:disabled) {
  background: #0ea5e9;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.4);
}

.button.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.button.secondary {
  background: var(--surface-strong);
  border: 1px solid var(--border-strong);
  color: var(--text);
}

.button.secondary:hover {
  background: var(--surface);
  border-color: var(--accent-2);
  color: var(--accent-2);
  transform: translateY(-2px);
}

.button.danger {
  background: #ef4444;
  color: white;
}

.button.danger:hover {
  background: #dc2626;
}

.button.success {
  background: #10b981;
  color: white;
}

.button.success:hover {
  background: #059669;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* Search Section */
.search-section {
  margin-bottom: 2rem;
}

.search-input-container {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  position: relative;
}

.search-input-container .member-search-container {
  flex: 1;
}

.search-input-container input {
  width: 100%;
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: all 0.3s ease;
}

.search-input-container input:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

.search-input-container .student-suggestions {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  left: auto;
  background: var(--surface-strong);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
  min-width: 300px;
}

.search-result {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-top: 1rem;
}

/* Groups page: compact no-results box */
#groupsNoResults.search-result {
  padding: 1rem 1.25rem;
}

#groupsLoading.search-result {
  padding: 1rem 1.25rem;
}

.groups-no-results-text {
  text-align: center;
  color: var(--muted);
  padding: 0.25rem 0;
}

.groups-loading-text {
  text-align: center;
  color: var(--muted);
  padding: 0.25rem 0;
}

.search-result.hidden {
  display: none;
}

.search-input-container .student-suggestions::-webkit-scrollbar {
  width: 6px;
}

.search-input-container .student-suggestions::-webkit-scrollbar-track {
  background: transparent;
  margin: 5% 0;
}

.search-input-container .student-suggestions::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}

.search-input-container .student-suggestions::-webkit-scrollbar-thumb:hover {
  background: var(--accent-2);
}

.search-result-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.student-info {
  background: var(--surface);
  padding: 1rem;
  border-radius: 6px;
  border-left: 4px solid var(--accent-2);
}

.student-info .info-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  align-items: center;
}

.student-info .info-row:last-child {
  margin-bottom: 0;
}

.info-label {
  font-weight: 600;
  color: var(--muted);
}

.info-value {
  color: var(--text);
}

.no-group-message {
  color: var(--muted);
  padding: 1rem;
  text-align: center;
}

.in-group-message {
  color: var(--accent-3);
  font-weight: 600;
}

/* Teams List */
.teams-list-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.teams-list {
  display: grid;
  gap: 1rem;
  max-height: 600px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.teams-list::-webkit-scrollbar {
  width: 6px;
}

.teams-list::-webkit-scrollbar-track {
  background: transparent;
}

.teams-list::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}

.teams-list::-webkit-scrollbar-thumb:hover {
  background: var(--accent-2);
}

/* Groups Table */

/*
 * min-width:0 is the critical fix. Grid/flex items default to min-width:auto,
 * which means they refuse to shrink below their content size. Without this,
 * the card is always >= 680px wide, breaking the page layout on mobile.
 */
.groups-list-panel {
  min-width: 0;
}

.groups-table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}

.groups-table {
  width: 100%;
  min-width: 680px;
  table-layout: fixed;
  border-collapse: collapse;
  background: var(--surface);
}

.groups-table th,
.groups-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: right;
  vertical-align: middle;
  height: 52px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 6-column widths (desktop) */
.groups-table th:nth-child(1), .groups-table td:nth-child(1) { width: 8%;  }
.groups-table th:nth-child(2), .groups-table td:nth-child(2) { width: 25%; }
.groups-table th:nth-child(3), .groups-table td:nth-child(3) { width: 16%; }
.groups-table th:nth-child(4), .groups-table td:nth-child(4) { width: 16%; }
.groups-table th:nth-child(5), .groups-table td:nth-child(5) { width: 16%; }
.groups-table th:nth-child(6), .groups-table td:nth-child(6) { width: 19%; }

.group-id-col   { width: 8%;  }
.group-name-col { width: 25%; }
.member-col     { width: 16%; }
.mentor-col     { width: 19%; text-align: left; }

.groups-table thead th {
  background: var(--surface-strong);
  color: var(--text);
  font-weight: 600;
}

.groups-table tbody tr:last-child td {
  border-bottom: none;
}


.mentor-link {
  color: var(--accent-2);
  text-decoration: none;
  transition: color 0.15s;
}

.mentor-link:hover {
  color: var(--accent-3);
  text-decoration: underline;
}

.student-suggestions::-webkit-scrollbar {
  width: 6px;
}

.student-suggestions::-webkit-scrollbar-track {
  background: transparent;
  margin: 5% 0;
}

.student-suggestions::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}

.student-suggestions::-webkit-scrollbar-thumb:hover {
  background: var(--accent-2);
}

.team-card {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  transition: var(--transition);
}

.team-card:hover {
  border-color: var(--accent-2);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.1);
}

.team-card.finalized {
  border-left: 4px solid var(--accent-3);
}

.team-card.pending {
  background-color: rgba(234, 179, 8, 0.08);
  border-left: 4px solid #eab308;
}

.team-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 1rem;
}

.team-info {
  flex: 1;
}

.team-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent-2);
  margin-bottom: 0.25rem;
}

.team-id {
  font-size: 0.85rem;
  color: var(--muted);
}

.team-placeholder {
  font-size: 0.9rem;
  color: var(--muted);
  font-style: italic;
  padding: 0.5rem 0;
}

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

.members-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 0.25rem;
}

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

.team-member {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border-radius: 4px;
  border-right: 2px solid var(--accent-2);
  gap: 0.5rem;
}

.member-name {
  font-weight: 500;
  font-size: 0.95rem;
}

.member-id {
  font-size: 0.8rem;
  color: var(--muted);
  margin-right: auto;
}

.loading-state,
.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
}

.groups-table td.loading-state,
.groups-table td.empty-state {
  background: var(--surface-strong);
  border-bottom: none;
  font-weight: 500;
}

.error-state {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid #ef4444;
  border-radius: 8px;
  padding: 1.5rem;
  color: #ef4444;
  text-align: center;
}

/* Status Messages */
.message {
  padding: 1rem 1.5rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.toast-message {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  max-width: 350px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transform: translateX(400px);
  transition: all 0.3s ease;
  z-index: 1000;
}

.toast-message.show {
  opacity: 1;
  transform: translateX(0);
}

.success-message {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid var(--accent-3);
  color: var(--accent-3);
}

.error-message {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid #ef4444;
  color: #ef4444;
}

.info-message {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid var(--accent-2);
  color: var(--accent-2);
}

.message-icon {
  font-weight: bold;
  font-size: 1.2rem;
}

.message-close {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0;
  margin: 0;
  margin-left: auto;
  transition: opacity 0.3s ease;
}

.message-close:hover {
  opacity: 0.7;
}

.team-status {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--accent-3);
  color: white;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.team-status.pending {
  background: #eab308;
  color: black;
}

.team-status.finalized {
  background: var(--accent-3);
  color: white;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.team-card {
  animation: fadeIn 0.3s ease-out;
}

/* Responsive */
@media (max-width: 1024px) {
  .projects-section {
    padding: 1.5rem 1rem;
  }

  .section-header h1 {
    font-size: 2rem;
  }
}

@media (max-width: 768px) {
  .projects-section {
    padding: 1rem;
  }

  .section-header {
    margin-bottom: 2rem;
  }

  .section-header h1 {
    font-size: 1.5rem;
  }

  .section-header p {
    font-size: 0.95rem;
  }

  .projects-container {
    gap: 1.5rem;
  }

  .card-surface {
    padding: 1.25rem;
  }

  .card-surface h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
  }

  .card-surface h3 {
    font-size: 1rem;
    margin-top: 1rem;
    margin-bottom: 0.75rem;
  }

  .form-group {
    gap: 0.35rem;
  }

  .form-group label {
    font-size: 0.9rem;
  }

  .form-group input,
  .form-group textarea {
    padding: 0.65rem;
    font-size: 0.9rem;
  }

  .members-section {
    gap: 0.75rem;
  }

  .members-container {
    gap: 0.75rem;
  }

  .member-input-group {
    padding: 0.75rem;
    gap: 0.5rem;
  }

  .search-input-container {
    flex-direction: column;
    gap: 0.5rem;
  }

  .search-input-container input {
    font-size: 0.9rem;
  }

  .form-actions {
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.75rem;
  }

  .button {
    width: 100%;
    justify-content: center;
    padding: 0.7rem 1.25rem;
    font-size: 0.9rem;
  }

  .team-header {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }

  .team-status {
    align-self: flex-start;
  }

  .team-member {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding: 0.65rem;
  }

  .student-info .info-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .teams-list {
    max-height: 400px;
  }
}

@media (max-width: 480px) {
  .section-header h1 {
    font-size: 1.25rem;
  }

  .section-header p {
    font-size: 0.85rem;
  }

  .coming-soon-banner {
    padding: 1.5rem 1rem;
  }

  .banner-content h2 {
    font-size: 1.25rem;
  }

  .banner-content p {
    font-size: 0.9rem;
  }

  .card-surface {
    padding: 1rem;
  }

  .card-surface h2 {
    font-size: 1.1rem;
  }

  .card-surface h3 {
    font-size: 0.95rem;
  }

  .button {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
  }

  .team-card {
    padding: 1rem;
  }

  .team-name {
    font-size: 1rem;
  }

  .search-result {
    padding: 1rem;
  }
}

/* Modal Styles */
.modal {
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 25px rgba(0, 0, 0, 0.15);
  max-width: 500px;
  width: 90%;
  animation: modalSlideUp 0.3s ease-out;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  color: var(--text);
  font-size: 1.25rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all 0.3s ease;
}

.modal-close:hover {
  background: var(--surface);
  color: var(--accent-2);
}

.modal-body {
  padding: 1.5rem;
  color: var(--text);
  line-height: 1.6;
}

.modal-body p {
  margin: 0;
  font-size: 0.95rem;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  padding: 1.5rem;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
}

.modal-actions .button {
  flex: 1;
}

/* Yellow button state for incomplete teams */
.button.warning {
  background: #eab308;
  color: black;
  border: none;
}

.button.warning:hover:not(:disabled) {
  background: #facc15;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(234, 179, 8, 0.4);
}
