/* Public MD3 Styles for Student Groups Page */

/* ===== TOKENS (Variables) ===== */
:root {
  --md-sys-color-primary: #005CBC;
  --md-sys-color-on-primary: #FFFFFF;
  --md-sys-color-primary-container: #D8E2FF;
  --md-sys-color-on-primary-container: #001A41;
  --md-sys-color-secondary-container: #DAE2F9;
  --md-sys-color-on-secondary-container: #131C2B;
  --md-sys-color-error: #BA1A1A;
  --md-sys-color-background: #FEFBFF;
  --md-sys-color-on-background: #1B1B1F;
  --md-sys-color-surface: #FEFBFF;
  --md-sys-color-on-surface: #1B1B1F;
  --md-sys-color-surface-variant: #E1E2EC;
  --md-sys-color-on-surface-variant: #44474F;
  --md-sys-color-outline: #75777F;
  --md-sys-color-outline-variant: #C5C6D0;
  --md-sys-color-surface-1: #F4F3FF;
  --md-sys-color-surface-2: #E9E7FF;
  --md-sys-color-success: #2E7D32;
  --md-sys-color-warning: #ffc107;
  --md-sys-elevation-1: 0px 1px 2px rgba(0, 0, 0, 0.3), 0px 1px 3px 1px rgba(0, 0, 0, 0.15);
  --md-sys-elevation-2: 0px 1px 2px rgba(0, 0, 0, 0.3), 0px 2px 6px 2px rgba(0, 0, 0, 0.15);
  --md-sys-shape-corner-medium: 12px;
  --md-sys-shape-corner-large: 16px;
  --md-sys-shape-corner-full: 9999px;
  --md-sys-spacing-4: 16px;
  --md-sys-spacing-6: 24px;
  --md-sys-spacing-8: 32px;
}

/* ===== BASE & LAYOUT ===== */
* { box-sizing: border-box; }
body {
  font-family: 'Roboto', sans-serif;
  background-color: var(--md-sys-color-background);
  color: var(--md-sys-color-on-background);
  margin: 0;
  -webkit-font-smoothing: antialiased;
}
.md-container { max-width: 1400px; margin: 0 auto; padding: var(--md-sys-spacing-6); }
.md-surface-container {
    background-color: var(--md-sys-color-surface-1);
    border-radius: var(--md-sys-shape-corner-large);
    padding: var(--md-sys-spacing-6);
}

/* ===== TYPOGRAPHY ===== */
.md-display-small { font-size: 36px; line-height: 44px; font-weight: 400; margin: 0; }
.md-headline-small { font-size: 24px; line-height: 32px; font-weight: 400; margin: 0; color: var(--md-sys-color-on-surface-variant); }
.md-title-large { font-size: 22px; line-height: 28px; font-weight: 400; }
.md-list-item-headline { font-size: 16px; line-height: 24px; font-weight: 500; color: var(--md-sys-color-on-surface); }
.md-list-item-supporting-text { font-size: 14px; line-height: 20px; font-weight: 400; color: var(--md-sys-color-on-surface-variant); }

/* ===== TOP APP BAR ===== */
.md-top-app-bar {
  background-color: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  height: 64px; display: flex; align-items: center;
  padding: 0 var(--md-sys-spacing-6); position: sticky; top: 0; z-index: 100;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}
.md-top-app-bar-title { font-size: 22px; font-weight: 400; }

/* ===== PAGE HEADER & SELECTOR ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--md-sys-spacing-6);
    margin-bottom: var(--md-sys-spacing-6);
}
.page-header-actions {
    display: flex;
    align-items: center;
    gap: var(--md-sys-spacing-4);
    flex-wrap: wrap;
}
.selector-form .md-text-field { min-width: 400px; margin-bottom: 0; }
.md-select-field {
  width: 100%; height: 56px; padding: var(--md-sys-spacing-4);
  background-color: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline);
  border-radius: 4px; font-size: 16px;
  cursor: pointer; appearance: none;
}
.md-select-icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.md-text-field { position: relative; }
.md-text-field-label {
    position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
    font-size: 16px; color: var(--md-sys-color-on-surface-variant);
    background-color: var(--md-sys-color-surface);
    padding: 0 4px; pointer-events: none;
    transition: all 150ms ease;
    z-index: 1;
}
.md-select-field:focus + .md-select-icon + .md-text-field-label,
.md-select-field:not([value=""]) + .md-select-icon + .md-text-field-label {
  top: 0; font-size: 12px; color: var(--md-sys-color-primary);
}

/* ===== GRID & GROUP CARDS ===== */
.md-grid {
    display: grid;
    gap: var(--md-sys-spacing-6);
    grid-template-columns: repeat(12, 1fr);
}
.md-grid-span-6 { grid-column: span 12; }
@media (min-width: 900px) {
    .md-grid-span-6 { grid-column: span 6; }
}
.group-card-md3 {
    background-color: var(--md-sys-color-surface-1);
    border-radius: var(--md-sys-shape-corner-large);
    box-shadow: var(--md-sys-elevation-1);
    overflow: hidden;
}
.group-card-header {
    padding: var(--md-sys-spacing-4) var(--md-sys-spacing-6);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}
.leader-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    padding: 4px 12px;
    border-radius: var(--md-sys-shape-corner-full);
    font-size: 14px;
    margin-top: 12px;
}

/* ===== STUDENT LIST ===== */
.md-list { padding: 8px 0; }
.md-list-item {
    display: flex;
    align-items: center;
    padding: 8px var(--md-sys-spacing-6);
    gap: var(--md-sys-spacing-4);
}
.md-list-item.leader {
    background-color: #FFF3CD; /* Теплий жовтий фон */
    border-left: 4px solid var(--md-sys-color-warning);
    /* Компенсуємо padding, щоб текст залишився на місці */
    padding-left: calc(var(--md-sys-spacing-6) - 4px); 
}

.md-list-item.leader .md-list-item-headline {
    font-weight: 700; /* Жирний шрифт для імені */
    color: #856404; /* Темний колір тексту для контрасту */

}
.md-list-item-number {
    color: var(--md-sys-color-primary);
    font-weight: 500;
}
.md-list-item-content { flex-grow: 1; }
.md-list-item-content p { margin: 0; }

/* ===== CHIPS ===== */
.md-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: var(--md-sys-shape-corner-full);
    font-size: 12px;
    font-weight: 500;
}
.md-chip.budget {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}
.md-chip.contract {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

/* ===== NO DATA MESSAGE ===== */
.no-data-msg {
    text-align: center;
    padding: var(--md-sys-spacing-8);
}
.no-data-msg .material-symbols-outlined {
    font-size: 48px;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: var(--md-sys-spacing-4);
}

/* ===== BUTTONS (from admin) ===== */
.md-button {
  display: inline-flex; align-items: center; justify-content: center;
  height: 40px; padding: 0 var(--md-sys-spacing-6); border: none;
  border-radius: var(--md-sys-shape-corner-full);
  font-size: 14px; font-weight: 500;
  cursor: pointer; position: relative; overflow: hidden;
  transition: box-shadow 150ms ease;
}
.md-button.filled { background-color: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }
.md-button.filled:hover { box-shadow: var(--md-sys-elevation-1); }
.md-button .material-symbols-outlined { margin-right: 8px; }

/* ===== TUTOR INFO ON GROUP CARD ===== */
.tutor-info-block {
    padding: 8px 24px 16px 24px;
    border-top: 1px solid var(--md-sys-color-outline-variant);
    background-color: var(--md-sys-color-surface-2);
}
.tutor-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--md-sys-color-on-surface-variant);
    margin-top: 8px;
}
.tutor-info-item .tutor-name {
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
}
.tutor-info-item button {
    width: 32px;
    height: 32px;
    padding: 4px;
    color: var(--md-sys-color-primary);
    background: none;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.tutor-info-item button:hover {
    background-color: rgba(0,0,0,0.08);
}

/* ===== TUTOR MODAL ===== */
.tutor-modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
}
.tutor-modal-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
}
.tutor-modal {
    background: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-large);
    padding: var(--md-sys-spacing-6);
    width: 90%;
    max-width: 600px;
    box-shadow: var(--md-sys-elevation-2);
    transform: scale(0.95);
    transition: transform 200ms ease;
}
.tutor-modal-backdrop.visible .tutor-modal {
    transform: scale(1);
}
.tutor-modal-header {
    text-align: center;
    margin-bottom: var(--md-sys-spacing-6);
}
.tutor-modal-body {
    display: flex;
    gap: var(--md-sys-spacing-6);
}
.tutor-modal-photo {
    flex-shrink: 0;
    width: 150px;
}
.tutor-modal-photo img {
    width: 100%;
    height: auto;
    border-radius: var(--md-sys-shape-corner-medium);
    object-fit: cover;
}
.tutor-modal-details {
    flex-grow: 1;
}
.tutor-modal-details .specialty {
    font-size: 18px;
    font-weight: 500;
    color: var(--md-sys-color-primary);
}
.tutor-modal-details .course {
    font-size: 16px;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: var(--md-sys-spacing-4);
}
.tutor-modal-contacts {
    display: flex;
    gap: var(--md-sys-spacing-4);
    margin-bottom: var(--md-sys-spacing-6);
}
.tutor-modal-contacts a {
    color: var(--md-sys-color-on-surface);
    text-decoration: none;
    display: inline-flex;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 150ms ease;
}
.tutor-modal-contacts a .material-symbols-outlined { font-size: 28px; }
.tutor-modal-contacts a:hover {
    background-color: var(--md-sys-color-surface-2);
}
.tutor-modal-portfolio h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
}
.tutor-modal-portfolio p {
    margin: 0;
    white-space: pre-wrap;
    font-size: 14px;
    line-height: 1.5;
    color: var(--md-sys-color-on-surface-variant);
}

@media (max-width: 600px) {
    .tutor-modal-body { flex-direction: column; }
    .tutor-modal-photo { width: 120px; margin: 0 auto; }
}