:root {
  --background: #f4ecd8;
  --foreground: #2b2b2b;
  --primary: #d9534f;
  --secondary: #205493;
  --muted: #666666;
  --paper-line: #d3c7ab;
  --font-handwriting: 'Caveat', cursive, sans-serif;
}

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

body {
  background-color: var(--background);
  color: var(--foreground);
  font-family: var(--font-handwriting);
  font-size: 1.25rem;
  min-height: 100vh;
  /* background-image: radial-gradient(var(--paper-line) 1px, transparent 1px); */
  /* background-size: 24px 24px; */
}

/* ==========================================================================
   Paper UI Components (Hand-Drawn Pencil Aesthetics)
   ========================================================================== */

.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 85vh;
  padding: 1.5rem;
}

.paper-card {
  background: #fffef8;
  border: 2px solid var(--foreground);
  border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
  box-shadow: 4px 5px 0px var(--foreground);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
}

.login-title {
  font-size: 2.5rem;
  margin-bottom: 0.25rem;
  text-align: center;
  font-weight: 700;
}

.login-subtitle {
  font-size: 1.15rem;
  color: var(--muted);
  text-align: center;
  margin-bottom: 1.75rem;
}

.form-group {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.form-group label {
  font-weight: 700;
  font-size: 1.2rem;
}

.form-group input {
  font-family: inherit;
  font-size: 1.2rem;
  padding: 0.6rem 0.9rem;
  border: 2px solid var(--foreground);
  border-radius: 125px 15px 185px 15px/15px 185px 15px 125px;
  background: #fff;
  color: var(--foreground);
}

.form-group input:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 2px 3px 0px var(--secondary);
}

.paper-btn {
  width: 100%;
  font-family: inherit;
  font-size: 1.4rem;
  font-weight: 700;
  padding: 0.65rem 1rem;
  background: var(--background);
  color: var(--foreground);
  border: 2px solid var(--foreground);
  border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
  box-shadow: 3px 4px 0px var(--foreground);
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  margin-top: 0.5rem;
}

.paper-btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 5px 0px var(--foreground);
}

.paper-btn:active {
  transform: translate(6px, 6px);
  box-shadow: 1px 2px 0px var(--foreground);
}

.paper-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.error-msg {
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 1rem;
  text-align: center;
  font-size: 1.15rem;
}

/* ==========================================================================
   Dashboard & Profile Layout
   ========================================================================== */

.dashboard-wrapper {
  min-height: 100vh;
  padding: 1.5rem 1.5rem 2.5rem;
}

/* Top Dashboard Header */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto 2rem;
  padding: 1rem 1.75rem;
  border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--foreground);
}

.logo-icon {
  font-size: 2rem;
}

.nav-logout-btn {
  width: auto;
  margin-top: 0;
  padding: 0.4rem 1.2rem;
  font-size: 1.15rem;
  background: #fff;
  color: var(--primary);
  border-color: var(--primary);
}

.nav-logout-btn:hover {
  background: var(--primary);
  color: #fff;
}

@media (max-width: 450px) {
  .dashboard-wrapper {
    padding: 1rem 0.75rem 2rem;
  }

  .dashboard-header {
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
  }

  .header-logo {
    font-size: 1.35rem;
    gap: 0.35rem;
  }

  .logo-icon {
    font-size: 1.4rem;
  }

  .nav-logout-btn {
    font-size: 0.95rem;
    padding: 0.3rem 0.75rem;
  }
}

.dashboard-container {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  align-items: start;
  width: 100%;
  min-width: 0;
}

.dashboard-main,
.profile-sidebar,
.paper-card,
.chart-card,
.stat-card {
  min-width: 0;
}

@media (max-width: 900px) {
  .dashboard-container {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 570px) {
  .dashboard-wrapper {
    padding: 1rem 0.5rem 2rem;
  }

  .paper-card {
    padding: 1.25rem 1rem;
    max-width: 100%;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.75rem;
  }

  .stat-card {
    padding: 0.85rem 1rem;
    gap: 0.5rem;
  }

  .stat-icon {
    font-size: 1.6rem;
  }

  .stat-value {
    font-size: 1.4rem;
  }
}

/* Sidebar Profile Card */
.profile-sidebar {
  max-width: 100%;
  padding: 2rem 1.5rem;
}

.profile-loading {
  text-align: center;
  padding: 2rem 0;
  color: var(--muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 4px solid var(--paper-line);
  border-top-color: var(--foreground);
  border-radius: 50%;
  margin: 0 auto 1rem;
  animation: spin 0.8s linear infinite;
}

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

.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-bottom: 1.5rem;
  border-bottom: 2px dashed var(--paper-line);
  margin-bottom: 1.5rem;
}

.avatar-container {
  position: relative;
  margin-bottom: 1rem;
}

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

.avatar-fallback {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--paper-line);
  color: var(--foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: 700;
  border: 3px solid var(--foreground);
  box-shadow: 2px 3px 0px var(--foreground);
  position: relative;
  overflow: hidden;
}
.avatar-fallback img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.level-badge {
  position: absolute;
  bottom: -6px;
  right: -6px;
  background: var(--primary);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  border: 2px solid var(--foreground);
  box-shadow: 1px 2px 0px var(--foreground);
}

.user-fullname {
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 0.25rem;
}

.user-username {
  font-size: 1.15rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.cohort-tag {
  display: inline-block;
  font-size: 1rem;
  font-weight: 700;
  background: var(--background);
  color: var(--secondary);
  border: 2px solid var(--secondary);
  padding: 0.15rem 0.75rem;
  border-radius: 15px;
}

/* Profile Details List */
.profile-details {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.75rem;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.15rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px dashed var(--paper-line);
}

.info-label {
  font-weight: 700;
  color: var(--muted);
}

.info-value {
  font-weight: 600;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ratio-value {
  color: var(--secondary);
  font-size: 1.3rem;
  font-weight: 700;
}

/* Profile Actions */
.logout-btn {
  background: #fff;
  color: var(--primary);
  border-color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.logout-btn:hover {
  background: var(--primary);
  color: #fff;
}

/* Right Side Dashboard Main Placeholder */
.dashboard-main {
  width: 100%;
}

.main-placeholder-card {
  max-width: 100%;
  min-height: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 2rem;
  /* border-style: dashed; */
}


.placeholder-title {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  color: var(--foreground);
}

.placeholder-subtitle {
  font-size: 1.25rem;
  color: var(--muted);
}

/* ==========================================================================
   Stats Grid & Chart Containers
   ========================================================================== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  max-width: 100%;
}

.stat-icon {
  font-size: 2.2rem;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--muted);
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--foreground);
  line-height: 1.2;
}

/* Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

@media (max-width: 560px) {
  .charts-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
  .chart-card {
    padding: 1rem 0.75rem;
  }
}

.chart-card {
  max-width: 100%;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
}

.chart-header {
  margin-bottom: 1.25rem;
  border-bottom: 2px dashed var(--paper-line);
  padding-bottom: 0.75rem;
}

.chart-title {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.2;
}

.chart-subtitle {
  font-size: 1.05rem;
  color: var(--muted);
}

.chart-body {
  flex: 1;
  min-height: 280px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.chart-placeholder {
  width: 100%;
  min-height: 250px;
  border: 2px dashed var(--paper-line);
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 1.2rem;
  font-weight: 600;
  background: var(--background);
}

/* ==========================================================================
   404 Error Page Aesthetics
   ========================================================================== */

.error-card {
  text-align: center;
  max-width: 460px;
  padding: 3rem 2rem;
}

.error-code {
  font-size: 5rem;
  font-weight: 700;
  line-height: 1;
  color: var(--primary);
  margin-bottom: 0.25rem;
  letter-spacing: 2px;
}

.error-icon {
  font-size: 3rem;
  color: var(--secondary);
  margin-bottom: 1rem;
}

.error-title {
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--foreground);
}

.error-subtitle {
  font-size: 1.15rem;
  color: var(--muted);
  margin-bottom: 1.75rem;
  line-height: 1.4;
}

.error-actions {
  display: flex;
  justify-content: center;
}

.error-actions .paper-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0;
  max-width: 220px;
  width: 100%;
}

.back-btn {
  background: #fff;
  color: var(--foreground);
}

.back-btn:hover {
  background: var(--background);
}

@media (max-width: 480px) {
  .error-card {
    padding: 2rem 1.25rem;
  }
  .error-code {
    font-size: 4rem;
  }
}


