/* ============================================================
   COMP-6062 Final Project – Stylesheet
   ============================================================ */

:root {
  --bg:        #eee7e7;
  --surface:   #6e793c;
  --surface2:  #1d3a47;
  --border:    #b9621b;
  --accent:    #654066;      
  --accent2:   #5b8dee;     
  --text:      #01010e;
  --muted:     #a4a3a8;
  --radius:    12px;
  --mono:      'Space Mono', monospace;
  --display:   'Syne', sans-serif;
}

/* ---------- Reset / Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  /* subtle grain texture */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
}

/* ---------- Header ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-title {
  font-family: var(--display);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.1;
}

.title-accent {
  color: var(--accent);
}

.student-info {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.badge-course {
  display: inline-block;
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: 4px;
}

/* ---------- Module Cards ---------- */
.module-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  position: relative;
  overflow: hidden;
  transition: border-color 0.25s;
}

.module-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(200,241,53,0.03) 0%, transparent 60%);
  pointer-events: none;
}

.module-card:hover {
  border-color: #3a3a48;
}

.module-label {
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.module-title {
  font-family: var(--display);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1;
}

/* ---------- Inputs ---------- */
.input-group-stack {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.module-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.9rem;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.82rem;
  width: 100%;
  outline: none;
  transition: border-color 0.2s;
}

.module-input::placeholder { color: var(--muted); }

.module-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200,241,53,0.08);
}

/* ---------- Buttons ---------- */
.btn-module {
  background: var(--accent);
  color: #0d0d0f;
  border: none;
  border-radius: 6px;
  padding: 0.65rem 1.2rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, opacity 0.2s;
}

.btn-module:hover:not(:disabled) {
  background: #d8ff3e;
  transform: translateY(-1px);
}

.btn-module:active:not(:disabled) { transform: translateY(0); }

.btn-module:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- Profile ---------- */
.profile-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 0;
  flex: 1;
}

.avatar-ring {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
}

.avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--surface);
}

.user-name {
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  margin: 0;
}

.user-age {
  color: var(--muted);
  font-size: 0.78rem;
  margin: 0;
}

.user-age strong { color: var(--accent); }

/* ---------- Weather ---------- */
.weather-display {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.weather-desc {
  font-family: var(--display);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent);
  text-transform: capitalize;
}

.weather-stats {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.stat-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-label {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat-val {
  font-size: 0.82rem;
  color: var(--text);
  font-weight: 700;
}

.weather-location {
  font-size: 0.7rem;
  color: var(--muted);
  margin: 0;
  letter-spacing: 0.06em;
}

/* ---------- Dictionary ---------- */
.dict-display {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent2);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.dict-word {
  font-family: var(--display);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  margin: 0;
  text-transform: capitalize;
}

.dict-phonetic {
  color: var(--accent2);
  font-size: 0.78rem;
  margin: 0;
}

.dict-def {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.7;
  margin: 0;
}

/* ---------- Spinner ---------- */
.spinner-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.5rem 0;
}

.spin-ring {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 0.5rem;
}

/* ---------- Error ---------- */
.error-msg {
  background: rgba(255,80,80,0.08);
  border: 1px solid rgba(255,80,80,0.3);
  border-radius: 6px;
  padding: 0.6rem 0.9rem;
  color: #ff8080;
  font-size: 0.78rem;
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 3rem;
  border-top: 1px solid var(--border);
  padding: 1.2rem 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Media Queries ---------- */

/* Tablet: two-column layout adjustments */
@media (max-width: 991.98px) {
  .module-card {
    padding: 1.5rem;
  }

  .module-title {
    font-size: 1.2rem;
  }

  .site-title {
    font-size: 1.6rem;
  }
}

/* Mobile: stack everything, tighten spacing */
@media (max-width: 575.98px) {
  .site-header {
    padding: 1rem 0;
  }

  .badge-course {
    margin-top: 0.5rem;
    display: block;
    text-align: center;
  }

  .module-card {
    padding: 1.25rem;
    border-radius: 8px;
  }

  .btn-module {
    width: 100%;
    text-align: center;
  }

  .weather-stats {
    flex-direction: column;
  }

  .stat-pill {
    width: 100%;
    justify-content: space-between;
  }

  .avatar-ring {
    width: 80px;
    height: 80px;
  }
}
