/* Dashboard roster drawer: course sub-table and counselor notes.
   Layer: components. */
@layer components {
  /* Note Saved Badge */
  .note-saved-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--ds-space-30);
    font-size: var(--ds-font-size-78);
    font-weight: var(--ds-font-weight-bold);
    color: var(--ds-color-success-text);
    background: var(--ds-color-success-bg);
    border: 1px solid var(--ds-color-success-border);
    padding: var(--ds-space-25) var(--ds-space-65);
    border-radius: var(--ds-radius-pill);
    animation: fadeIn 0.3s ease;
    box-shadow: 0 1px 2px var(--ds-emerald-800-a08);
  }

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

  .row-checkbox {
    cursor: pointer;
    width: 15px;
    height: 15px;
    accent-color: var(--color-navy);
  }

  /* Expandable Drawer Sub-table */
  .drawer-row {
    background-color: var(--ds-color-surface-subtle);
  }

  .drawer-row:hover {
    background-color: var(--ds-color-surface-subtle) !important;
  }

  /* .roster-table prefix out-ranks `.roster-table td` (components/data-table.css) without !important */
  .roster-table .drawer-cell {
    padding: var(--ds-space-75) var(--ds-space-125) var(--ds-space-125) var(--ds-space-250);
    border-bottom: 2px solid var(--ds-color-border);
  }

  .drawer-card {
    background: var(--ds-color-surface);
    border: 1px solid var(--ds-color-border);
    border-left: 3px solid var(--color-academy-blue);
    border-radius: var(--radius-sm);
    padding: var(--ds-space-85) var(--ds-space-100);
    box-shadow: var(--ds-shadow-1-3-black-a04);
  }

  .drawer-header {
    font-size: var(--ds-font-size-82);
    font-weight: var(--ds-font-weight-bold);
    color: var(--color-navy);
    margin-bottom: var(--ds-space-60);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .drawer-subtable {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--ds-font-size-82);
  }

  .drawer-subtable th {
    text-align: left;
    padding: var(--ds-space-40) var(--ds-space-60);
    background: var(--ds-color-surface-subtle);
    color: var(--text-muted);
    font-size: var(--ds-font-size-74);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--ds-color-border);
  }

  .drawer-subtable td {
    padding: var(--ds-space-50) var(--ds-space-60);
    border-bottom: 1px solid var(--ds-color-border-subtle);
    vertical-align: middle;
  }

  .drawer-subtable tr:last-child td {
    border-bottom: none;
  }

  /* Drawer Counselor Observation Section */
  .drawer-note-section {
    margin-top: var(--ds-space-100);
  }

  .drawer-note-card {
    background: var(--ds-color-surface-subtle);
    border: 1px solid var(--ds-color-border);
    border-radius: var(--ds-radius-8px);
    padding: var(--ds-space-100) var(--ds-space-115);
    box-shadow: 0 1px 3px var(--ds-black-a03);
  }

  .drawer-note-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--ds-space-75);
  }

  .drawer-note-header-left {
    display: flex;
    align-items: center;
    gap: var(--ds-space-65);
  }

  .drawer-note-icon-wrap {
    width: 32px;
    height: 32px;
    border-radius: var(--ds-radius-6px);
    background: var(--ds-sky-50-alt);
    color: var(--ds-sky-700-alt2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .drawer-note-title {
    font-size: var(--ds-font-size-88);
    font-weight: var(--ds-font-weight-bold);
    color: var(--color-navy);
    line-height: 1.2;
  }

  .drawer-note-subtitle {
    font-size: var(--ds-font-size-74);
    color: var(--text-muted);
    margin-top: var(--ds-space-15);
  }

  .drawer-note-status {
    display: flex;
    align-items: center;
  }

  .drawer-note-textarea {
    width: 100%;
    box-sizing: border-box;
    font-family: var(--font-family);
    font-size: var(--ds-font-size-85);
    line-height: 1.5;
    color: var(--text-main);
    background: var(--ds-color-surface);
    border: 1px solid var(--ds-color-border-strong);
    border-radius: var(--ds-radius-6px);
    padding: var(--ds-space-65) var(--ds-space-85);
    resize: vertical;
    min-height: 72px;
    box-shadow: inset 0 1px 2px var(--ds-black-a03);
    transition: var(--ds-transition-all-150-ease);
  }

  .drawer-note-textarea:focus {
    outline: none;
    background: var(--ds-color-surface);
    border-color: var(--color-academy-blue);
    box-shadow: 0 0 0 3px var(--ds-academy-600-alt-a15);
  }

  .drawer-note-textarea::placeholder {
    color: var(--ds-color-text-subtle);
    font-style: italic;
  }

  .drawer-note-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--ds-space-65);
    flex-wrap: wrap;
    gap: var(--ds-space-50);
  }

  .drawer-note-hint {
    display: flex;
    align-items: center;
    gap: var(--ds-space-35);
    font-size: var(--ds-font-size-75);
    color: var(--text-muted);
  }

  .drawer-note-hint svg {
    color: var(--ds-blue-500);
  }

  .btn-save-drawer-note {
    height: 34px;
    padding: 0 var(--ds-space-115);
    border-radius: var(--ds-radius-6px);
    font-family: inherit;
    font-size: var(--ds-font-size-82);
    font-weight: var(--ds-font-weight-semibold);
    display: inline-flex;
    align-items: center;
    gap: var(--ds-space-45);
    cursor: pointer;
    background: var(--color-navy);
    color: var(--ds-color-text-inverse);
    border: 1px solid var(--ds-navy-900);
    box-shadow: var(--ds-shadow-1-2-black-a05);
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
  }

  .btn-save-drawer-note:hover {
    background: var(--color-academy-blue);
    border-color: var(--color-academy-blue);
    box-shadow: 0 4px 8px -1px var(--ds-academy-600-alt-a25);
    transform: translateY(-1px);
  }

  .btn-save-drawer-note:active {
    transform: translateY(0);
    box-shadow: var(--ds-shadow-1-2-black-a05);
  }

  .badge-passing {
    display: inline-flex;
    align-items: center;
    gap: var(--ds-space-25);
    font-size: var(--ds-font-size-75);
    font-weight: var(--ds-font-weight-semibold);
    color: var(--ds-green-900-alt);
    background: var(--ds-green-50-alt2);
    padding: var(--ds-space-15) var(--ds-space-50);
    border-radius: var(--ds-radius-pill);
    border: 1px solid var(--ds-emerald-100-alt);
  }

    /* Drawer Counselor Observation Section */
    .drawer-note-section {
      margin-top: var(--ds-space-100);
      padding-top: var(--ds-space-25);
    }

    .drawer-note-card {
      background: var(--ds-color-surface-subtle);
      border: 1px solid var(--ds-color-border);
      border-radius: var(--ds-radius-8px);
      padding: var(--ds-space-110) var(--ds-space-125);
      box-shadow: var(--ds-shadow-1-3-black-a04);
    }

    .drawer-note-header {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      margin-bottom: var(--ds-space-75);
    }

    .drawer-note-header-left {
      display: flex;
      align-items: center;
      gap: var(--ds-space-75);
    }

    .drawer-note-icon-wrap {
      width: 34px;
      height: 34px;
      border-radius: var(--ds-radius-8px);
      background: var(--ds-sky-50-alt);
      color: var(--ds-sky-700-alt2);
      display: inline-flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      box-shadow: 0 1px 2px var(--ds-sky-700-alt2-a10);
    }

    .drawer-note-title {
      font-size: var(--ds-font-size-92);
      font-weight: var(--ds-font-weight-bold);
      color: var(--ds-color-brand-navy);
      line-height: 1.2;
    }

    .drawer-note-subtitle {
      font-size: var(--ds-font-size-76);
      color: var(--ds-color-text-muted);
      margin-top: var(--ds-space-20);
    }

    .drawer-note-status {
      display: flex;
      align-items: center;
    }

    .drawer-note-textarea {
      width: 100% !important;
      min-width: 100%;
      box-sizing: border-box;
      font-family: inherit;
      font-size: var(--ds-font-size-88);
      line-height: 1.55;
      color: var(--ds-color-text) !important;
      background: var(--ds-color-surface) !important;
      border: 1px solid var(--ds-color-border-strong);
      border-radius: var(--ds-radius-6px);
      padding: var(--ds-space-75) var(--ds-space-90);
      resize: vertical;
      min-height: 76px;
      box-shadow: inset 0 1px 2px var(--ds-black-a04);
      transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
    }

    .drawer-note-textarea:focus {
      outline: none;
      border-color: var(--ds-academy-600-alt) !important;
      box-shadow: 0 0 0 3px var(--ds-academy-600-alt-a18);
    }

    .drawer-note-textarea::placeholder {
      color: var(--ds-color-text-subtle);
      font-style: italic;
    }

    .drawer-note-footer {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-top: var(--ds-space-75);
      flex-wrap: wrap;
      gap: var(--ds-space-50);
    }

    .drawer-note-hint {
      display: inline-flex;
      align-items: center;
      gap: var(--ds-space-40);
      font-size: var(--ds-font-size-76);
      color: var(--ds-color-text-muted);
    }

    .drawer-note-hint svg {
      color: var(--ds-blue-500);
    }

    .btn-save-drawer-note {
      height: 36px;
      padding: 0 var(--ds-space-125);
      border-radius: var(--ds-radius-6px);
      font-family: inherit;
      font-size: var(--ds-font-size-84);
      font-weight: var(--ds-font-weight-semibold);
      display: inline-flex;
      align-items: center;
      gap: var(--ds-space-50);
      cursor: pointer;
      background: var(--ds-color-brand-navy);
      color: var(--ds-color-text-inverse);
      border: 1px solid var(--ds-navy-900);
      box-shadow: 0 1px 3px var(--ds-black-a10);
      transition: var(--ds-transition-all-150-ease);
      white-space: nowrap;
    }

    .btn-save-drawer-note:hover {
      background: var(--ds-academy-600-alt);
      border-color: var(--ds-academy-600-alt);
      box-shadow: 0 4px 8px -1px var(--ds-academy-600-alt-a30);
      transform: translateY(-1px);
    }

    .btn-save-drawer-note:active {
      transform: translateY(0);
      box-shadow: 0 1px 2px var(--ds-black-a10);
    }

  /* Phones: the drawer opens as a panel right under its student card (see components/roster.css)
     and its course table becomes one small card per course. */
  @media (max-width: 640px) {
    .student-roster tbody tr.drawer-row {
      margin: calc(-1 * var(--ds-space-60)) 0 var(--ds-space-75);
    }

    .roster-table .drawer-cell {
      padding: 0;
      border-bottom: none;
    }

    .drawer-card {
      padding: var(--ds-space-75);
    }

    .drawer-header {
      flex-wrap: wrap;
      gap: var(--ds-space-50);
    }

    .drawer-subtable thead {
      display: none;
    }

    .drawer-subtable,
    .drawer-subtable tbody,
    .drawer-subtable tr,
    .drawer-subtable td {
      display: block;
    }

    .drawer-subtable tr {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: var(--ds-space-45) var(--ds-space-75);
      padding: var(--ds-space-60) 0;
      border-bottom: 1px solid var(--ds-color-border-subtle);
    }

    .drawer-subtable tr:last-child {
      border-bottom: none;
    }

    .drawer-subtable td {
      padding: 0;
      border-bottom: none;
      min-width: 0;
    }

    .drawer-subtable .drawer-courses__course {
      grid-column: 1 / -1;
    }

    .drawer-subtable td[data-label]::before {
      content: attr(data-label);
      display: block;
      font-size: var(--ds-font-size-70);
      font-weight: var(--ds-font-weight-semibold);
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }
  }
}

/* Former inline style attributes (moved from the templates in Phase 2).
   Layer: instance - element-specific rules that out-rank component and page rules,
   exactly like the inline styles they replace. */
@layer instance {
  /* "Loading courses..." until the panel's content arrives (toggleStudentDrawer in dashboard.html) */
  .roster-drawer__loading {
    margin: 0;
    padding: var(--ds-space-100) var(--ds-space-125);
    color: var(--ds-color-text-muted);
    font-size: var(--ds-font-size-88);
  }

  .roster-drawer__title {
    display: flex;
    align-items: center;
    gap: var(--ds-space-60);
    flex-wrap: wrap;
  }

  .roster-drawer__linked-label {
    font-weight: var(--ds-font-weight-regular);
    color: var(--ds-color-text-secondary);
  }

  .roster-drawer__links {
    display: flex;
    gap: var(--ds-space-50);
    align-items: center;
  }

  .drawer-courses__col-title {
    width: 35%;
  }

  .drawer-courses__col-term {
    width: 15%;
  }

  .drawer-courses__col-assignments {
    width: 20%;
  }

  .drawer-courses__col-score {
    width: 12%;
  }

  .drawer-courses__col-grade {
    width: 8%;
  }

  .drawer-courses__col-login {
    width: 10%;
  }

  .drawer-courses__name {
    font-weight: var(--ds-font-weight-semibold);
    color: var(--color-navy);
  }

  .drawer-courses__term {
    color: var(--text-muted);
    font-size: var(--ds-font-size-80);
  }

  .drawer-courses__progress-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ds-space-25);
  }

  .drawer-courses__progress-text {
    font-size: var(--ds-font-size-80);
  }

  .drawer-courses__progress-bar {
    height: 3px;
    margin-top: var(--ds-space-20);
  }

  .drawer-courses__score {
    display: flex;
    align-items: center;
    gap: var(--ds-space-35);
    flex-wrap: wrap;
  }

  .drawer-courses__dash {
    color: var(--text-dim);
  }

  .drawer-courses__login {
    font-size: var(--ds-font-size-76);
    color: var(--text-dim);
  }

  .drawer-courses__empty {
    font-size: var(--ds-font-size-82);
    color: var(--text-dim);
    padding: var(--ds-space-50) 0;
  }
}
