/* ElimuGuide — cross-page responsive overrides */

/* ── Safe areas (notched phones) ── */
@supports (padding: max(0px)) {
  body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
}

/* ── Brand logos on small screens ── */
@media (max-width: 639px) {
  :root {
    --elimu-logo-nav: 48px;
    --elimu-logo-compact: 40px;
    --elimu-logo-auth: 64px;
    --elimu-logo-hero: 88px;
    --elimu-logo-footer: 32px;
  }
}

/* ── Auth pages ── */
@media (max-width: 479px) {
  .auth-page {
    padding: 0.75rem;
    align-items: flex-start;
    padding-top: max(0.75rem, env(safe-area-inset-top));
  }

  .auth-card {
    border-radius: 1.25rem;
  }

  .auth-form-panel {
    padding: 1.5rem 1.25rem;
  }
}

/* ── Landing chat FAB ── */
@media (max-width: 639px) {
  #career-chat-fab {
    bottom: max(1rem, env(safe-area-inset-bottom));
    right: max(1rem, env(safe-area-inset-right));
    padding: 0.75rem 1rem;
    font-size: 0.8125rem;
  }

  #career-chat-panel {
    bottom: calc(max(1rem, env(safe-area-inset-bottom)) + 3.75rem);
    right: max(1rem, env(safe-area-inset-right));
    width: min(calc(100vw - 2rem), 22rem);
    max-height: min(32rem, calc(100dvh - 7rem));
  }
}

/* ── Dashboard shell (mobile Safari / small screens) ── */
.dash-app {
  height: 100vh;
  height: 100dvh;
}

#app-sidebar {
  height: 100vh;
  height: 100dvh;
}

@media (max-width: 1023px) {
  body:has(.dash-app) {
    overflow: auto;
  }

  .dash-app {
    min-height: 100vh;
    min-height: 100dvh;
    height: auto;
    overflow: visible;
  }

  .dash-content {
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible;
  }

  #app-sidebar {
    height: 100vh;
    height: 100dvh;
  }
}

@media (min-width: 1024px) {
  body:has(.dash-app) {
    overflow: hidden;
  }
}

/* ── Dashboard header ── */
.dash-header {
  flex-wrap: nowrap;
  min-width: 0;
  padding: 0.75rem 1rem;
}

.dash-header-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 639px) {
  .dash-header-title {
    font-size: 1.0625rem;
  }

  .dash-header-actions {
    gap: 0.25rem;
    flex-shrink: 0;
  }

  .dash-icon-btn,
  .dash-header-avatar {
    width: 2.125rem;
    height: 2.125rem;
  }
}

/* ── Main content padding ── */
@media (max-width: 479px) {
  .dash-main {
    padding: 1rem 0.875rem;
  }
}

/* ── Home grid — earlier two-column layout on tablets ── */
@media (min-width: 768px) and (max-width: 1279px) {
  .dash-home-bottom {
    display: grid;
    grid-template-columns: 1fr 18rem;
    gap: 1.25rem;
    align-items: start;
  }
}

@media (max-width: 767px) {
  .dash-home-bottom {
    display: grid;
    gap: 1.25rem;
  }
}

/* ── Profile section ── */
@media (max-width: 639px) {
  .dash-profile-summary {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    gap: 1rem;
  }

  .dash-profile-row,
  .dash-profile-verify-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.375rem;
  }

  .dash-profile-row dd {
    text-align: left;
    width: 100%;
  }
}

/* ── Recommendation cards (home preview) ── */
@media (max-width: 479px) {
  .dash-rec-card {
    flex-wrap: wrap;
    align-items: flex-start;
    padding: 0.875rem;
  }

  .dash-rec-card > :not(.dash-rec-save-btn) {
    min-width: 0;
    flex: 1 1 calc(100% - 3rem);
  }

  .dash-rec-save-btn {
    margin-left: auto;
  }
}

/* ── Recommendations table ── */
.rec-table {
  min-width: 40rem;
}

@media (max-width: 639px) {
  .rec-table th,
  .rec-table td {
    padding: 0.625rem 0.75rem;
  }
}

/* ── Notifications list ── */
@media (max-width: 639px) {
  .dash-notif-row {
    flex-wrap: wrap;
    align-items: flex-start;
    padding: 0.875rem 1rem;
  }

  .dash-notif-body {
    flex: 1 1 calc(100% - 3.5rem);
    min-width: 0;
  }

  .dash-notif-action {
    width: 100%;
    margin-top: 0.5rem;
    justify-content: center;
  }

  .dash-notif-panel-header {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}

/* ── Universities table ── */
.uni-table-wrap {
  -webkit-overflow-scrolling: touch;
}

.uni-table {
  min-width: 44rem;
}

@media (max-width: 639px) {
  .uni-table th,
  .uni-table td {
    padding: 0.625rem 0.75rem;
    font-size: 0.8125rem;
  }
}

/* ── University detail ── */
@media (max-width: 639px) {
  .uni-detail-hero {
    padding: 1rem;
    gap: 1.25rem;
  }

  .uni-detail-card {
    border-radius: var(--dash-radius);
  }
}

/* ── Pricing cards in dashboard ── */
@media (max-width: 479px) {
  .dash-pricing-card {
    padding: 1.25rem 1rem;
  }
}

/* ── Journey bar horizontal scroll ── */
.dash-journey-bar {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── Prevent horizontal page scroll ── */
html {
  overflow-x: hidden;
}

.dash-app,
.dash-content,
.dash-main {
  max-width: 100%;
}
