/* myHUSDid modern shell — works with existing style.css */

:root {
  --brand: #0071bc;
  --brand-dark: #005a96;
  --brand-soft: #e8f4fc;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --bg: #f1f5f9;
  --card: #ffffff;
  --danger: #b91c1c;
  --success: #15803d;
  --shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
  --radius: 12px;
}

/* Reset aggressive center-all rules for the new shell */
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Quicksand', system-ui, sans-serif;
  text-align: left;
}

body * {
  text-align: inherit;
}

img {
  display: inline-block;
  margin: 0;
  width: auto;
  max-width: 100%;
}

/* Header / nav */
.app-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.view-as-banner {
  background: #7c3aed;
  color: #fff;
  text-align: center;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.55rem 1rem;
}

.view-as-banner a {
  color: #fff !important;
  font-weight: 800;
  text-decoration: underline !important;
}

.view-as-email {
  opacity: 0.9;
  font-weight: 500;
}

.view-as-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.75rem 0 0;
}

.view-as-form input[type="text"] {
  font: inherit;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  min-width: 220px;
}

.view-as-form button {
  font: inherit;
  font-weight: 700;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  border: 2px solid #7c3aed;
  background: #7c3aed;
  color: #fff;
  cursor: pointer;
}

.view-as-form label {
  font-weight: 700;
  font-size: 0.85rem;
}

.view-as-error {
  color: #fecaca;
  font-weight: 700;
  font-size: 0.85rem;
}

.dash-hero .view-as-error,
.view-as-form .view-as-error {
  color: #b91c1c;
}

.app-header-inner {
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
  padding: 0.65rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Beat legacy style.css * { margin: auto } which centered Home */
.app-header .brand,
.app-header .brand-logo,
.app-header .brand-school-logo,
.app-header .app-nav,
.app-header .nav-link {
  margin: 0;
}

/* Wider shell for tools like Network Monitor — keep centered */
body.nm-page .app-header-inner,
body.nm-page .app-footer,
body.nm-page .app-main {
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
}

.brand-logo {
  height: 42px;
  width: auto;
  display: block;
  margin: 0;
}

.brand-school-logo {
  height: 42px;
  width: auto !important;
  max-height: 42px;
  display: block;
  margin: 0 !important;
  object-fit: contain;
}

.app-header .brand-school-logo {
  margin: 0;
}

.app-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  flex: 0 0 auto;
  justify-content: flex-start;
  margin: 0;
}

.nav-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  margin: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover,
.nav-link.is-active {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.app-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.app-user-name {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Main */
.app-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2rem;
}

.app-footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.app-footer .disclaimer {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
  text-align: center;
}

.app-footer .logo {
  width: 3.5rem;
  display: block;
  margin: 0.75rem auto;
}

.app-footer p {
  text-align: center;
}

/* Buttons */
.btn,
a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.92rem;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  background: var(--brand);
  color: #fff !important;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover,
a.btn:hover {
  background: var(--brand-dark);
}

.btn-ghost,
a.btn-ghost {
  background: transparent;
  color: var(--brand-dark) !important;
  border-color: var(--border);
}

.btn-ghost:hover,
a.btn-ghost:hover {
  background: var(--brand-soft);
}

.btn-danger {
  background: var(--danger);
}

/* Login page */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #0b3a5b 0%, #0071bc 55%, #38bdf8 100%);
  padding: 1.5rem;
}

.login-card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  padding: 2rem 2rem 1.5rem;
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.login-card .login-logo {
  width: 70%;
  max-width: 260px;
  display: block;
  margin: 0 auto 1rem;
}

.login-card h1 {
  font-size: 1.35rem;
  margin: 0 0 0.35rem;
  color: var(--text);
  text-align: center;
}

.login-card p.lead {
  color: var(--muted);
  margin: 0 0 1.5rem;
  text-align: center;
}

.google-signin {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text) !important;
  font-weight: 700;
  font-size: 1.05rem;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.google-signin:hover {
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  transform: translateY(-1px);
}

.google-signin img {
  width: 28px;
  height: 28px;
}

.login-error {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  text-align: center;
}

/* Dashboard */
.profile-hero {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--brand-soft);
  display: block;
}

.profile-hero h1 {
  margin: 0 0 0.25rem;
  font-size: 1.75rem;
  color: var(--brand);
  font-style: italic;
}

.profile-hero .subtitle {
  margin: 0;
  color: var(--muted);
}

.section-title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 1.5rem 0 0.75rem;
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.tile {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  text-decoration: none;
  color: var(--text) !important;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.tile:hover {
  transform: translateY(-2px);
  border-color: #93c5fd;
  box-shadow: 0 10px 24px rgba(0, 113, 188, 0.12);
}

.tile-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.tile h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  color: var(--text);
}

.tile p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.4;
}

/* Cards / content panels */
.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.panel h2 {
  margin-top: 0;
}

.alert {
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}

.alert-info {
  background: var(--brand-soft);
  color: var(--brand-dark);
  border: 1px solid #bfdbfe;
}

.alert-error {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
}

.alert-success {
  background: #f0fdf4;
  color: var(--success);
  border: 1px solid #bbf7d0;
}

/* Tables inside new shell */
.app-main table.review {
  width: 100%;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.empty-state {
  background: var(--card);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  box-shadow: var(--shadow);
  color: var(--muted);
}

/* Prefer new logout styling when buttons appear in legacy pages */
a.logout button,
.page-actions button {
  font-family: inherit;
  cursor: pointer;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  font-weight: 600;
}

a.logout button:hover,
.page-actions button:hover {
  background: var(--brand-soft);
  border-color: #93c5fd;
}

@media (max-width: 720px) {
  .app-header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .app-user {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
  }

  .profile-hero {
    flex-direction: column;
    text-align: center;
  }

  .profile-hero h1,
  .profile-hero .subtitle {
    text-align: center;
  }
}
