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

body {
  margin: 0;
  padding: 0;
  color: var(--text-primary);
  background-color: var(--background) !important;
  font-family: "Montserrat", sans-serif !important;
  min-height: 100vh;
  font-size: 16px;
}

.kreta-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.kreta-main {
  flex: 1;
  padding: clamp(1rem, 3vw, 2rem);
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.absences-page {
  display: grid;
  grid-template-columns: 300px 1fr;
  grid-template-rows: 1fr;
  grid-template-areas:
    "sidebar content";
  gap: 24px;
  min-height: calc(100vh - 200px);
}

.absences-sidebar {
  grid-area: sidebar;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 24px;
  height: fit-content;
}

.filter-card {
  background: var(--card-card);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0px 1px var(--shadow-blur) 0px var(--accent-shadow);
}

.filter-header {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.filter-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  background-color: #00000000 !important;
}

.filter-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-group label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}

.filter-group label img {
  width: 20px;
  height: 20px;
  opacity: 0.8;
}

.filter-input {
  padding: 12px 16px;
  border: 2px solid transparent;
  border-radius: 12px;
  background: var(--button-secondaryFill);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.filter-input:hover {
  background: var(--accent-15);
}

.filter-input:focus {
  outline: none;
  border-color: var(--accent-accent);
  background: var(--button-secondaryFill);
}

.stats-section {
  grid-area: stats;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.stat-card {
  background: var(--card-card);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: 0px 1px var(--shadow-blur) 0px var(--accent-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  min-height: 100px;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-icon {
  width: 24px;
  height: 24px;
  margin-bottom: 8px;
  opacity: 0.8;
}

.stat-number {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 6px;
}

.stat-card.total .stat-number {
  color: var(--accent-accent);
}

.stat-card.justified .stat-number {
  color: var(--grades-4);
}

.stat-card.unjustified .stat-number {
  color: var(--grades-1);
}

.stat-card.pending .stat-number {
  color: var(--grades-3);
}

.stat-label {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.absences-content {
  grid-area: content;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.day-group {
  background: var(--card-card);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0px 1px var(--shadow-blur) 0px var(--accent-shadow);
}

.day-header {
  background: var(--accent-accent);
  color: white;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
}

.day-date {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
}

.day-date img {
  width: 20px;
  height: 20px;
  filter: brightness(0) invert(1);
}

.day-count {
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
}

.day-absences {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  padding: 20px;
}

.absence-card {
  background: var(--button-secondaryFill);
  border-radius: 16px;
  padding: 20px;
  display: grid;
  grid-template-columns: auto 1fr minmax(auto, max-content);
  grid-template-rows: auto auto;
  grid-template-areas:
    "lesson subject status"
    "lesson topic status";
  gap: 8px 12px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid var(--accent-15);
}

.absence-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--accent-shadow);
}

.absence-lesson {
  grid-area: lesson;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--accent-15);
  border-radius: 12px;
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-accent);
}

.absence-subject {
  grid-area: subject;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  align-self: end;
}

.absence-topic {
  grid-area: topic;
  font-size: 13px;
  color: var(--text-secondary);
  align-self: start;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.absence-status {
  grid-area: status;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 24px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  white-space: nowrap;
  flex-shrink: 0;
}

.status-badge img {
  width: 16px;
  height: 16px;
}

.status-badge.justified {
  background: var(--grades-background-4);
  color: var(--grades-4);
}

.status-badge.justified img {
  filter: brightness(0) saturate(100%) invert(76%) sepia(43%) saturate(609%) hue-rotate(53deg) brightness(101%) contrast(92%);
}

.status-badge.unjustified {
  background: var(--grades-background-1);
  color: var(--grades-1);
}

.status-badge.unjustified .material-icons-round {
  font-size: 16px;
}

.status-badge.pending {
  background: var(--grades-background-3);
  color: var(--grades-3);
}

.status-badge.pending .material-icons-round {
  font-size: 16px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  background: var(--card-card);
  border-radius: 20px;
}

.empty-state img {
  width: 80px;
  height: 80px;
  opacity: 0.5;
  margin-bottom: 20px;
}

.empty-state h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  color: var(--text-secondary);
}

@media (max-width: 1024px) {
  .absences-page {
    grid-template-columns: 260px 1fr;
    gap: 20px;
  }

  .day-absences {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  body {
    font-size: 14px;
  }

  .kreta-main {
    padding: 16px;
  }

  .absences-page {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "sidebar"
      "content";
    gap: 16px;
  }

  .absences-sidebar {
    position: static;
  }

  .filter-card {
    padding: 20px;
    border-radius: 16px;
  }

  .filter-content {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }

  .filter-group label {
    font-size: 12px;
  }

  .filter-input {
    padding: 10px 12px;
    font-size: 13px;
  }

  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
  }

  .stat-card {
    padding: 14px 10px;
    min-height: 80px;
    border-radius: 12px;
  }

  .stat-number {
    font-size: 24px;
  }

  .stat-label {
    font-size: 10px;
  }

  .day-group {
    border-radius: 16px;
  }

  .day-header {
    padding: 14px 18px;
    font-size: 14px;
  }

  .day-absences {
    padding: 14px;
    gap: 12px;
  }

  .absence-card {
    padding: 16px;
    border-radius: 12px;
  }

  .absence-lesson {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }

  .absence-subject {
    font-size: 15px;
  }
}

@media (max-width: 480px) {
  .kreta-main {
    padding: 12px;
  }

  .absences-page {
    gap: 12px;
  }

  .filter-card {
    padding: 16px;
  }

  .filter-header {
    margin-bottom: 16px;
  }

  .filter-header h2 {
    font-size: 16px;
  }

  .filter-content {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .stat-card {
    padding: 12px 8px;
    min-height: 70px;
  }

  .stat-number {
    font-size: 22px;
    margin-bottom: 4px;
  }

  .stat-label {
    font-size: 9px;
    letter-spacing: 0.3px;
  }

  .day-header {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .day-date {
    font-size: 14px;
  }

  .day-count {
    font-size: 12px;
    padding: 3px 10px;
  }

  .day-absences {
    padding: 12px;
    gap: 10px;
  }

  .absence-card {
    padding: 14px;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto auto;
    grid-template-areas:
      "lesson subject"
      "lesson topic"
      "status status";
    gap: 6px 12px;
  }

  .absence-lesson {
    width: 40px;
    height: 40px;
    font-size: 16px;
    grid-row: span 2;
  }

  .absence-status {
    justify-content: flex-start;
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--accent-15);
  }

  .status-badge {
    padding: 6px 12px;
    font-size: 11px;
  }

  .absence-subject {
    font-size: 14px;
  }

  .absence-topic {
    font-size: 12px;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.day-group {
  animation: fadeIn 0.3s ease forwards;
}

.day-group:nth-child(1) { animation-delay: 0.05s; }
.day-group:nth-child(2) { animation-delay: 0.1s; }
.day-group:nth-child(3) { animation-delay: 0.15s; }
.day-group:nth-child(4) { animation-delay: 0.2s; }
.day-group:nth-child(5) { animation-delay: 0.25s; }



.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--background);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem;
  border-radius: 24px;
}

.loading-text {
  color: var(--text-primary);
  text-align: center;
  font-family: Montserrat, sans-serif;
  font-size: 20px;
  font-weight: 700;
}

.loading-text2 {
  color: var(--text-secondary);
  text-align: center;
  font-family: Figtree, sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 130%;
}

.loading-logo {
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  border-radius: 8px;
}