/* imports */
@import url('https://fonts.googleapis.com/css2?family=Segoe+UI:wght@300;400;500;600;700&display=swap');

/* Color Variables — cozy warm-cream educational theme */
:root {
  --lav: #ede7f6;
  --lav-mid: #c5b3e8;
  --lav-dark: #7c5cbf;
  
  --mint: #e8f5e9;
  --mint-mid: #a5d6a7;
  --mint-dark: #3d8b40;
  
  --peach: #fff3e0;
  --peach-mid: #ffcc80;
  --peach-dark: #e6820a;
  
  --pink: #f8d7e3;
  --pink-mid: #e8a0b8;
  --pink-dark: #b5566e;
  
  --cream: #fdf6f0;
  --white: #fff;
  --text: #3d2e2e;
  --muted: #7a6060;
  --border: #f0ddd8;
  --navy: #1a2a4a;
  --r: 12px;
  --rs: 8px;
}

/* Global resets */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--cream);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* SCHOOL HEADER BAR */
.school-header {
  background: var(--navy);
  padding: .6rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(26,42,74,.18);
}

.school-logo-wrap {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.school-logo {
  height: 36px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: .92;
}

.school-name-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.school-name-top {
  font-size: 11px;
  font-weight: 700;
  color: var(--lav-mid);
  letter-spacing: .18em;
  text-transform: uppercase;
}

.school-name-bot {
  font-size: 13px;
  font-weight: 600;
  color: #white;
  letter-spacing: .06em;
  color: var(--white);
}

.header-right {
  font-size: 11px;
  color: var(--lav-mid);
  letter-spacing: .06em;
  text-align: right;
}

.header-right strong {
  color: var(--white);
  display: block;
  font-size: 12px;
  margin-bottom: 1px;
}

.header-divider {
  width: 1px;
  height: 32px;
  background: rgba(197,179,232,.25);
  margin: 0 .75rem;
}

/* APP SHELL */
.app-container {
  display: flex;
  min-height: calc(100vh - 56px - 44px);
}

/* Sidebar Layout */
.sidebar {
  width: 250px;
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
}

.sidebar-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-grow: 1;
}

.menu-item {}

.menu-link {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .8rem;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
  border-radius: var(--rs);
  cursor: pointer;
  transition: all .15s;
  font-weight: 500;
}

.menu-link:hover {
  background: var(--lav);
  color: var(--lav-dark);
}

.menu-link.active {
  background: var(--lav);
  color: var(--lav-dark);
  font-weight: 600;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.user-info {
  display: flex;
  flex-direction: column;
  font-size: 12px;
}

.user-name {
  font-weight: 600;
  color: var(--text);
}

.user-role {
  font-size: 10px;
  color: var(--muted);
}

/* Main content workspace */
.main-content {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  max-width: 1200px;
  margin: 0 auto;
}

/* Quote Bar */
.quote-bar {
  background: var(--lav);
  border-radius: var(--r);
  padding: .7rem 1.2rem;
  margin-bottom: 1.2rem;
  font-size: 13px;
  color: var(--lav-dark);
  font-style: italic;
  display: flex;
  align-items: center;
  gap: .5rem;
  border: 1px solid #d8cef0;
}

/* Cards & Layout Modules */
.card {
  background: var(--white);
  border-radius: var(--r);
  border: 1px solid var(--border);
  padding: 1.2rem;
  margin-bottom: 1.2rem;
}

.card-module {
  background: var(--white);
  border-radius: var(--r);
  border: 1px solid var(--border);
  padding: 1.2rem;
  margin-bottom: 1.2rem;
}

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

.card-module-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

/* Stats grids */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: .55rem;
  margin-bottom: 1.2rem;
}

.stat-card {
  background: var(--cream);
  border-radius: var(--rs);
  padding: .65rem;
  text-align: center;
  border: 1px solid var(--border);
}

.stat-num {
  font-size: 20px;
  font-weight: 600;
  color: var(--lav-dark);
}

.stat-label {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* Buttons style */
.btn {
  padding: .38rem .8rem;
  border-radius: var(--rs);
  border: 1.5px solid var(--lav-mid);
  background: var(--lav);
  color: var(--lav-dark);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: .28rem;
  transition: all .15s;
}

.btn:hover {
  background: var(--lav-mid);
  color: #fff;
}

.btn-danger {
  border-color: #f9a8b8;
  background: #fff0f3;
  color: #c0304e;
}

.btn-danger:hover {
  background: #f9a8b8;
  color: #fff;
}

.btn-sm {
  padding: .26rem .58rem;
  font-size: 12px;
}

.btn-print {
  border-color: var(--mint-mid);
  background: var(--mint);
  color: var(--mint-dark);
}

.btn-print:hover {
  background: var(--mint-mid);
  color: #fff;
}

.btn-export {
  border-color: var(--peach-mid);
  background: var(--peach);
  color: var(--peach-dark);
}

.btn-export:hover {
  background: var(--peach-mid);
  color: #fff;
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
}

.btn-logout:hover {
  color: var(--pink-dark);
}

/* Form inputs styling */
input, select, textarea {
  width: 100%;
  padding: .36rem .62rem;
  border: 1.5px solid var(--border);
  border-radius: var(--rs);
  font-size: 13px;
  color: var(--text);
  background: var(--white);
  outline: none;
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--lav-mid);
}

.input-group {
  margin-bottom: 0.8rem;
}

.input-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: .26rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* Badge System */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.b-ns { background: #f3f3f3; color: #888; }
.b-ip { background: var(--peach); color: var(--peach-dark); }
.b-sub { background: var(--lav); color: var(--lav-dark); }
.b-acc { background: var(--mint); color: var(--mint-dark); }
.b-wl { background: #fff9c4; color: #9e7c0a; }
.b-den { background: #fce4ec; color: #c62828; }
.b-hi { background: #fce4ec; color: #c62828; }
.b-med { background: var(--peach); color: var(--peach-dark); }
.b-lo { background: var(--mint); color: var(--mint-dark); }
.b-fin { background: var(--mint); color: var(--mint-dark); }
.b-rev { background: var(--peach); color: var(--peach-dark); }
.b-dft { background: var(--lav); color: var(--lav-dark); }
.b-out { background: #e3f2fd; color: #1565c0; }

/* Table styling */
.tbl-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 560px;
}

th {
  padding: .52rem .68rem;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  background: var(--cream);
}

td {
  padding: .48rem .68rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:hover td {
  background: #fdf0f5;
}

/* Progress bar */
.pb {
  height: 9px;
  background: var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin: 4px 0;
}

.pbf {
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--lav-mid), var(--mint-mid));
  transition: width .4s;
}

/* Donut chart */
.donut-wrap {
  display: flex;
  gap: 1.4rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.leg {
  display: flex;
  align-items: center;
  gap: .38rem;
  font-size: 12px;
  color: var(--muted);
}

.led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* Checklist items */
.task-item {
  display: flex;
  align-items: center;
  gap: .52rem;
  padding: .48rem .68rem;
  border-radius: var(--rs);
  margin-bottom: .28rem;
  background: var(--cream);
  border: 1px solid var(--border);
}

.task-item.completed {
  opacity: .55;
}

.task-item.completed .task-title {
  text-decoration: line-through;
}

.cb {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 2px solid var(--lav-mid);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--white);
}

.cb.chk {
  background: var(--lav-mid);
  border-color: var(--lav-mid);
  color: #white;
  color: var(--white);
}

/* Stars rating */
.star {
  color: #ddd;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.star.on {
  color: #f4a235;
}

/* Comparison layouts */
.cmp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: .7rem;
}

.cmp-col {
  background: var(--cream);
  border-radius: var(--rs);
  padding: .85rem;
  border: 1px solid var(--border);
}

.cmp-col.best {
  border: 2px solid var(--mint-mid);
  background: #f0fdf1;
}

.cl {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: .16rem;
}

.cv {
  font-size: 13px;
  color: var(--text);
  margin-bottom: .52rem;
}

/* TinkerCAD Student card classroom grids */
.student-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.8rem;
  margin-top: 1rem;
}

.student-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1rem;
  position: relative;
  transition: all 0.15s;
}

.student-card:hover {
  border-color: var(--lav-dark);
}

.uid-box {
  background: var(--cream);
  border: 1px dashed var(--border);
  border-radius: var(--rs);
  padding: 0.4rem 0.6rem;
  font-family: monospace;
  font-size: 12px;
  color: var(--pink-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0.6rem 0;
}

.btn-copy {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
}

.btn-copy:hover {
  color: var(--text);
}

.student-card-stats {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 0.6rem;
  margin-top: 0.6rem;
}

.student-stat-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

/* Crewmate Finder Styling */
.crew-wall-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.project-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.project-card:hover {
  border-color: var(--pink-mid);
}

.project-title {
  margin-bottom: 0.4rem;
  font-size: 15px;
  font-weight: 600;
}

.project-meta {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  gap: 12px;
  margin-bottom: 0.6rem;
}

.project-desc {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 0.8rem;
}

.project-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 1rem;
}

.skill-tag {
  background: var(--lav);
  padding: 2px 8px;
  font-size: 11px;
  border-radius: var(--rs);
  color: var(--lav-dark);
  font-weight: 500;
}

/* AI Panel Interface */
.ai-panel-overlay {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
}

.ai-sidebar {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1rem;
  height: fit-content;
}

.ai-desc-box {
  margin-top: 0.8rem;
  background: var(--lav);
  border-left: 3px solid var(--lav-mid);
  padding: 0.6rem;
  border-radius: 0 var(--rs) var(--rs) 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

.ai-result-panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.5rem;
  min-height: 380px;
  position: relative;
}

.ai-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  height: 250px;
  text-align: center;
}

.ai-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 250px;
  gap: 0.8rem;
  color: var(--muted);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top: 3px solid var(--lav-mid);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.ai-response-content {
  font-size: 13px;
  line-height: 1.6;
}

.ai-response-content h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 1rem 0 0.5rem 0;
  color: var(--lav-dark);
}

.ai-response-content p {
  margin-bottom: 0.6rem;
}

.ai-school-card {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  padding: 0.8rem;
  margin-bottom: 0.6rem;
}

.ai-school-card h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.2rem;
}

/* Modals Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(43, 34, 30, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  width: 100%;
  max-width: 500px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  position: relative;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  font-size: 20px;
  color: var(--muted);
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1rem;
}

/* SCHOOL FOOTER BAR */
.school-footer {
  background: var(--navy);
  padding: .7rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.5rem;
  flex-wrap: wrap;
  gap: .5rem;
  box-shadow: 0 -2px 12px rgba(26, 42, 74, .1);
}

.footer-left {
  font-size: 11px;
  color: rgba(197, 179, 232, .7);
  letter-spacing: .04em;
}

.footer-left strong {
  color: var(--lav-mid);
}

.footer-right {
  font-size: 11px;
  color: rgba(255, 255, 255, .4);
  font-style: italic;
}

/* Page titles */
.page-header {
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.page-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.page-desc {
  font-size: 12px;
  color: var(--muted);
}

.page-actions {
  display: flex;
  gap: 0.4rem;
}

/* Login box */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 100px);
}

.login-container {
  width: 100%;
  max-width: 400px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.login-logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  text-align: center;
  margin-bottom: 0.3rem;
  letter-spacing: 0.05em;
}

.login-tagline {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-tabs {
  display: flex;
  gap: 0.2rem;
  background: var(--cream);
  padding: 0.2rem;
  border-radius: var(--rs);
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.login-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 0.4rem;
  border-radius: var(--rs);
  cursor: pointer;
  font-size: 11px;
  transition: all 0.15s;
  font-weight: 500;
}

.login-tab.active {
  background: var(--white);
  color: var(--lav-dark);
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0,0,0,0.02);
}

/* Tip elements matching guidelines */
.tip-box {
  background: var(--lav);
  border-radius: var(--r);
  padding: .95rem 1.2rem;
  margin-bottom: .8rem;
  border-left: 4px solid var(--lav-mid);
}

.tip-title {
  font-weight: 600;
  margin-bottom: .28rem;
  color: var(--lav-dark);
  font-size: 14px;
}

.tip-body {
  font-size: 12px;
  color: #4a3a5e;
  line-height: 1.6;
}

/* Step Guides */
.step-card {
  background: var(--white);
  border-radius: var(--r);
  border: 1px solid var(--border);
  padding: .95rem 1.15rem;
  margin-bottom: .7rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-body h4 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: .28rem;
  color: var(--text);
}

.step-body p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.step-body ul {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  padding-left: 1rem;
  margin-top: .28rem;
}

.rl {
  display: inline-flex;
  align-items: center;
  gap: .28rem;
  padding: .36rem .82rem;
  background: var(--lav);
  color: var(--lav-dark);
  border-radius: var(--rs);
  font-size: 12px;
  text-decoration: none;
  margin: .22rem;
  font-weight: 500;
}

.rl:hover {
  background: var(--lav-mid);
  color: #fff;
}

/* Responsive queries */
@media(max-width: 800px) {
  .app-container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 1rem;
  }
  .sidebar-menu {
    flex-direction: row;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 0.5rem;
  }
  .menu-item {
    flex-shrink: 0;
  }
  .ai-panel-overlay {
    grid-template-columns: 1fr;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .cmp-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
