* {
  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: flex;
  flex-direction: column;
  gap: 24px;
}

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

.stats-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
  background-color: transparent !important;
  margin-top: 0px !important;
}

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

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

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

.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.total {
  border-color: var(--accent-15);
}

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

.stat-card.late .stat-number {
  color: var(--grades-2);
}

.stat-card.late {
  border-color: var(--grades-background-2);
}

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

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

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

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

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

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

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

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px 24px;
  background: var(--card-card);
  border-radius: 16px;
  box-shadow: 0px 1px var(--shadow-blur) 0px var(--accent-shadow);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-color {
  width: 24px;
  height: 24px;
  border-radius: 8px;
}

.legend-color.status-justified {
  background: var(--grades-background-4);
  border: 2px solid var(--grades-4);
}

.legend-color.status-pending {
  background: var(--grades-background-3);
  border: 2px solid var(--grades-3);
}

.legend-color.status-unjustified {
  background: var(--grades-background-1);
  border: 2px solid var(--grades-1);
}

.legend-color.type-late-legend {
  background: var(--grades-background-2);
  border: 2px dashed var(--grades-2);
}

.legend-item span {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.calendar-section {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

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

.month-header {
  background: var(--button-secondaryFill);
  color: white;
  padding: 16px 20px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  padding: 12px;
}

.calendar-day-header {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 8px 0;
  text-transform: uppercase;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--button-secondaryFill);
  position: relative;
  min-height: 40px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.calendar-day.empty {
  background: transparent;
}

.calendar-day.future {
  background: var(--accent-15);
  opacity: 0.5;
}

.calendar-day.future .day-number {
  color: var(--text-teritary);
}

.calendar-day.today .day-number {
  color: var(--accent-accent);
  font-weight: 700;
}

.calendar-day .day-number {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  z-index: 1;
}

.calendar-day.has-absence {
  cursor: pointer;
}

.calendar-day.has-absence:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px var(--accent-shadow);
  z-index: 2;
}

.calendar-day.status-justified {
  background: var(--grades-background-4);
  border: 2px solid var(--grades-4);
}

.calendar-day.status-justified .day-number {
  color: var(--grades-4);
  font-weight: 700;
}

.calendar-day.status-pending {
  background: var(--grades-background-3);
  border: 2px solid var(--grades-3);
}

.calendar-day.status-pending .day-number {
  color: var(--grades-3);
  font-weight: 700;
}

.calendar-day.status-unjustified {
  background: var(--grades-background-1);
  border: 2px solid var(--grades-1);
}

.calendar-day.status-unjustified .day-number {
  color: var(--grades-1);
  font-weight: 700;
}

.calendar-day.type-late {
  border-style: dashed;
}

.calendar-day.type-mixed {
  border-style: double;
  border-width: 3px;
}

.absence-count {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--accent-accent);
  color: white;
  font-size: 9px;
  font-weight: 700;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calendar-day.status-justified .absence-count {
  background: var(--grades-4);
}

.calendar-day.status-pending .absence-count {
  background: var(--grades-3);
}

.calendar-day.status-unjustified .absence-count {
  background: var(--grades-1);
}

.absence-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.2s ease;
  padding: 20px;
}

.absence-modal-overlay.visible {
  opacity: 1;
}

.absence-modal {
  background: var(--card-card);
  border-radius: 24px;
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.absence-modal-overlay.visible .absence-modal {
  transform: scale(1);
}

.modal-header {
  background: var(--button-secondaryFill);
  border-bottom: 1px solid #00000000 !important;
  color: white;
  padding: 14px 18px !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  background: transparent !important;
}

.modal-content {
  background-color: var(--card-card) !important;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-absence-card {
  background: var(--button-secondaryFill);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-left: 3px solid transparent;
}

.modal-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.modal-lesson {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-accent);
  min-width: 24px;
}

.type-indicator {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px 1px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.type-indicator.absence {
  background: var(--accent-15);
  color: var(--accent-accent);
}

.type-indicator.late {
  background: var(--grades-background-2);
  color: var(--grades-2);
}

.modal-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
  margin-left: auto;
}

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

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

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

.modal-subject {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.modal-info-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.modal-info-item {
  display: inline-block;
}

.modal-info-item:not(:last-child)::after {
  content: '•';
  margin-left: 6px;
  color: var(--text-teritary);
}

.modal-minutes {
  color: var(--grades-2);
  font-weight: 600;
}

.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: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

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

  .kreta-main {
    padding: 16px;
  }

  .stats-section {
    padding: 20px;
    border-radius: 16px;
  }

  .stats-title {
    font-size: 18px;
    margin-bottom: 16px;
  }

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

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

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

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

  .calendar-section {
    grid-template-columns: 1fr;
  }

  .calendar-legend {
    gap: 12px;
    padding: 14px 18px;
  }

  .legend-item span {
    font-size: 12px;
  }

  .month-container {
    border-radius: 16px;
  }

  .month-header {
    padding: 14px 16px;
    font-size: 15px;
  }

  .calendar-grid {
    gap: 3px;
    padding: 10px;
  }

  .calendar-day {
    min-height: 36px;
    border-radius: 8px;
  }

  .calendar-day .day-number {
    font-size: 13px;
  }

  .absence-count {
    width: 14px;
    height: 14px;
    font-size: 8px;
  }

  .absence-modal {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 20px;
  }

  .modal-header {
    padding: 12px 16px;
  }

  .modal-header h2 {
    font-size: 15px;
  }

  .modal-content {
    padding: 12px;
    gap: 6px;
  }

  .modal-absence-card {
    padding: 10px;
    gap: 5px;
  }

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

  .modal-info-row {
    font-size: 11px;
  }
}

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

  .absences-page {
    gap: 16px;
  }

  .stats-section {
    padding: 16px;
  }

  .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;
  }

  .calendar-legend {
    flex-direction: column;
    gap: 10px;
  }

  .calendar-grid {
    gap: 2px;
    padding: 8px;
  }

  .calendar-day {
    min-height: 32px;
  }

  .calendar-day .day-number {
    font-size: 12px;
  }

  .absence-modal-overlay {
    padding: 12px;
  }

  .modal-absence-card {
    padding: 14px;
  }

  .modal-subject {
    font-size: 16px;
  }
}

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

.month-container {
  animation: fadeIn 0.3s ease forwards;
}

.month-container:nth-child(1) { animation-delay: 0.05s; }
.month-container:nth-child(2) { animation-delay: 0.1s; }
.month-container:nth-child(3) { animation-delay: 0.15s; }
.month-container:nth-child(4) { animation-delay: 0.2s; }
.month-container: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;
}