:root {
  --primary: #4a3421;
  --primary-dark: #2d2118;
  --secondary: #7a5b3c;
  --surface: #f7efe3;
  --surface-muted: #f2e4d0;
  --border: #cbb89f;
  --text: #2f241b;
  --text-soft: #6c533e;
  --shadow: 0 16px 40px rgba(45, 33, 24, 0.12);
}

html {
  font-size: 12px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 480px) {
  html {
    font-size: 13px;
  }
}

@media (min-width: 600px) {
  html {
    font-size: 14px;
  }
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

@media (min-width: 1024px) {
  html {
    font-size: 17px;
  }
}

body {
  margin: 0;
  padding-top: 1.5rem;
  padding-bottom: 3rem;
  background: linear-gradient(135deg, #f7efe3 0%, #ede0c8 45%, #e6d3b4 100%);
  color: var(--text);
  font-family: Tahoma, Arial, sans-serif;
}

body a {
  color: var(--primary);
  transition: color 0.2s ease;
}

body a:hover {
  color: var(--secondary);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem #f7efe3, 0 0 0 0.25rem #7a5b3c;
}

.container {
  max-width: 1200px;
}

.dashboard {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.hero-section {
  background: linear-gradient(135deg, #f9f2e9 0%, #efe1c9 100%);
  border: 1px solid var(--border);
  border-radius: 1.1rem;
  padding: 1.8rem 1.5rem;
  box-shadow: var(--shadow);
  text-align: center;
}

.hero-section h2 {
  margin-bottom: 0.8rem;
  font-size: clamp(1.1rem, 5vw, 1.65rem);
  font-weight: 800;
  color: var(--primary-dark);
}

.hero-section p {
  margin: 0.35rem 0;
  font-size: clamp(0.9rem, 3.5vw, 1.2rem);
  color: var(--text-soft);
}

.hero-section p:first-of-type {
  font-size: clamp(1.2rem, 4.5vw, 1.8rem) !important;
  font-weight: 700 !important;
}

.overview-card,
.events-card,
.class-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1.1rem;
  padding: 1.4rem;
  box-shadow: var(--shadow);
}

.class-section {
  display: grid;
  gap: 1.25rem;
}

.class-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 1rem;
}

.class-card-header h3 {
  margin: 0;
  font-size: clamp(1rem, 4vw, 1.2rem);
  color: var(--primary-dark);
  font-weight: 800;
}

.score-pill {
  background: linear-gradient(90deg, var(--primary-dark) 0%, var(--secondary) 100%);
  color: #f7efe3;
  padding: 0.6rem 0.95rem;
  border-radius: 999px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(45, 33, 24, 0.18);
}

.student-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #bda88d;
  box-shadow: 0 4px 12px rgba(45, 33, 24, 0.16);
}

.top-class {
  background: linear-gradient(90deg, #f2e2cc 0%, #e7d0a8 100%);
  font-weight: 700;
}

.ranking-table {
  table-layout: fixed;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  font-size: clamp(0.75rem, 2.5vw, 1rem);
}

.ranking-table th,
.ranking-table td {
  vertical-align: middle;
  text-align: center;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  padding: clamp(0.4rem, 2vw, 0.8rem) clamp(0.3rem, 1.5vw, 0.6rem);
}

/* ستون های جدول */
.ranking-table th:nth-child(1),
.ranking-table td:nth-child(1) {
  width: 15%;
}

.ranking-table th:nth-child(2),
.ranking-table td:nth-child(2) {
  width: 45%;
}

.ranking-table th:nth-child(3),
.ranking-table td:nth-child(3) {
  width: 20%;
}

.ranking-table th:nth-child(4),
.ranking-table td:nth-child(4) {
  width: 20%;
}

@media (max-width: 480px) {
  .ranking-table th,
  .ranking-table td {
    padding: 0.5rem 0.3rem;
    font-size: 0.8rem;
  }
}

@media (min-width: 768px) {
  .ranking-table th,
  .ranking-table td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

.ranking-table th {
  background: linear-gradient(90deg, #f6ebdb 0%, #e8d8bd 100%);
  color: #4d3b2b;
  font-weight: 700;
  border-bottom: 1px solid #f8f5f0;
}

.ranking-table tbody {
  background: #e6e1dc;
}

.ranking-table tbody tr,
.ranking-table tbody tr > th,
.ranking-table tbody tr > td {
  background: #e6e1dc;
}

.ranking-table tbody tr:hover,
.ranking-table tbody tr:hover > th,
.ranking-table tbody tr:hover > td {
  background: #ddd7d2;
}

.ranking-table th,
.ranking-table td {
  border-top: 1px solid #f8f5f0;
  border-left: 1px solid #f8f5f0;
  border-right: 1px solid #f8f5f0;
}

.ranking-table tr:last-child td {
  border-bottom: 1px solid #f8f5f0;
}

.events-card h2 {
  color: var(--primary-dark);
  font-size: clamp(1rem, 4vw, 1.2rem);
  font-weight: 800;
}

.events-card a {
  font-weight: 700;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

.alert-warning {
  background: #efe1c9;
  color: #5f4127;
  border-color: #b58d63;
}

.alert-info {
  background: #e7dac4;
  color: #4a3421;
  border-color: #9f7b4f;
}
