.attendance-calendar {
  font-family: "Helvetica Neue", sans-serif;
  width: 100%;
  min-height: 100vh;
  /* Changed to min-height to allow natural expansion */
  background-color: white;
  display: flex;
  flex-direction: column;
  padding: 0;
  box-sizing: border-box;
  /* Removed overflow: hidden to allow page scroll */
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px;
  flex-shrink: 0;
  padding-top: 0px;
}

.left-section {
  display: flex;
  align-items: center;
}

.profile-pic {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  margin-right: 15px;
  object-fit: cover;
}

.employee-details {
  display: flex;
  flex-direction: column;
  padding-left: 10px;
}

.employee-details h3 {
  margin: 0;
  width: 220px;
  height: 18px;
  font-weight: 800;
  font-size: 12px;
  line-height: 150%;
  letter-spacing: 4%;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: "Helvetica Neue", sans-serif;
}

.employee-details p {
  margin: 0;
  width: 220px;
  height: 15px;
  font-weight: 400;
  font-style: regular;
  font-size: 10px;
  line-height: 150%;
  letter-spacing: 0%;
  color: #666;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.right-section {
  display: flex;
  align-items: center;
}

.nav-btn {
  width: 48px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid #818181;
  background-color: #ffffff;
  color: #333;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  margin: 0 5px;
}

.nav-btn:hover {
  background-color: #f5f5f5;
}

.arrow {
  width: 22px;
  height: 22px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 16px;
}

.today-btn {
  width: 160px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid #818181;
  background-color: #ffffff;
  color: #333;
  font-weight: 700;
  font-style: bold;
  font-size: 14px;
  line-height: 150%;
  letter-spacing: 0%;
  text-align: center;
  cursor: pointer;
  margin: 0 5px;
}

.today-btn:hover {
  background-color: #f5f5f5;
}

.month-label {
  font-size: 1.2rem;
  font-weight: bold;
  color: #333;
  margin-left: 10px;
}

.legend {
  display: flex;
  justify-content: left;
  padding: 0px 40px;
  margin-bottom: 0px;
  flex-shrink: 0;
  box-sizing: border-box;
}

.legend-container {
  display: flex;
  justify-content: left;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
  max-width: 1292px;
  padding: 8px;
}

@media (max-width: 768px) {
  .legend {
    padding-left: 20px;
    /* Less indentation on smaller screens */
  }
}

.legend-item {
  display: flex;
  align-items: center;
  height: 18px;
  gap: 4px;
  font-family: "Helvetica Neue", sans-serif;
  font-weight: 400;
  font-style: regular;
  font-size: 12px;
  line-height: 150%;
  letter-spacing: 0%;
  box-sizing: border-box;
  white-space: nowrap;
}

.legend-item::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
}

.calendar-container {
  display: flex;
  flex-direction: column;
  padding: 0 32px 8px 40px;
  min-height: 250px;
  max-height: calc(100vh - 270px);
  overflow-y: auto;
  overflow-x: hidden;
}

/* UPDATED: Sticky Weekday Headers */
.weekday-headers {
  position: sticky;
  top: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  width: 97%;
  height: 32px;
  background-color: #f6f6f6;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 8px;
  flex-shrink: 1;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-right: 20px;
  margin-left: 20px;
  /* Added subtle shadow for sticky effect */
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  width: 100%;
  gap: 8px;
  box-sizing: border-box;
  padding-bottom: 20px;
}

.calendar-header {
  text-align: center;
  font-weight: 700;
  font-style: bold;
  font-size: 12px;
  line-height: 150%;
  letter-spacing: 0%;
  color: black;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid #1a1a1a61;
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
}

.calendar-header:last-child {
  border-right: none;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
}

.calendar-header:not(:first-child) {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.calendar-cell {
  width: 100%;
  min-height: 70px;
  height: 30px;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  border: 2px solid #eaeaeacc;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  cursor: pointer;
  transition: transform 0.2s;
  position: relative;
  gap: 6px;
  padding: 8px;
  background-color: #fff;
  box-sizing: border-box;
  min-width: 0;
}

.calendar-cell:hover {
  transform: scale(1.02);
  z-index: 5;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.calendar-cell.other-month {
  color: #ccc;
  background-color: #f6f6f6;
}

.calendar-cell.today {
  border: 3px solid #3d3d3d;
  font-weight: bold;
}

.date-number {
  width: 23px;
  height: 30px;
  font-weight: 400;
  font-style: regular;
  font-size: 20px;
  line-height: 150%;
  letter-spacing: 0%;
  text-align: center;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.time-icon-container {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2;
}

.calendar-cell.present {
  background-color: #a5f2c5;
}

.calendar-cell.absent {
  background-color: #f68787;
}

.calendar-cell.leave {
  background-color: #6a8acf;
}

.calendar-cell.weekly-off {
  background-color: #83ddff;
}

.calendar-cell.holiday {
  background-color: #ffcb8b;
}

.calendar-cell.multiple {
  background-color: #54e55f;
}

.calendar-cell.half-day-absent {
  background: linear-gradient(to right, #f68787 50%, #fff 50%) !important;
}

.calendar-cell.half-day-absent .date-number {
  position: relative;
  z-index: 1;
  background: transparent;
}

@media (max-width: 1400px) {
  .calendar-cell {
    height: 57px;
  }

  .date-number {
    font-size: 18px;
  }
}

@media (max-width: 768px) {
  .top-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 15px;
  }

  .right-section {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 5px;
  }

  .month-label {
    margin-left: 0;
  }

  .legend {
    padding: 0 15px;
    gap: 10px;
  }

  .legend-container {
    gap: 8px;
  }

  .legend-item {
    font-size: 11px;
  }

  .legend-item::before {
    width: 16px;
    height: 16px;
  }

  .calendar-container {
    padding: 0 15px 30px;
    /* Just padding, no height restrictions */
  }

  .calendar-cell {
    height: 100px;
  }

  .date-number {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .legend {
    font-size: 0.8rem;
  }

  .calendar-cell {
    height: 80px;
    font-size: 0.8rem;
  }

  .today-btn {
    width: 120px;
    font-size: 12px;
  }

  .nav-btn {
    width: 40px;
    height: 36px;
  }

  .calendar-header {
    font-size: 10px;
  }

  .date-number {
    font-size: 14px;
  }

  .calendar-container {
    max-height: calc(110vh - 280px);
    /* Reduced from 350px */
  }

  .calendar-grid-container {
    padding-bottom: 20px;
    /* Added small mobile bottom padding */
  }
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.modal-content {
  width: 648px;
  height: 500px;
  border-radius: 8px;
  background-color: #ffffff;
  box-shadow: 0px 2px 3px 0px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  padding: 24px;
  gap: 20px;
}

.modal-header {
  width: 100%;
  height: 27px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header-content {
  flex: 1;
  min-width: 0;
  height: 27px;
  font-family: "Helvetica Neue", sans-serif;
  font-weight: 700;
  font-style: Bold;
  font-size: 18px;
  line-height: 150%;
  letter-spacing: 0%;
  color: var(--action-primary-default);
  display: flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 4px;
}

.close-button {
  width: 27px;
  height: 27px;
  border: none;
  background-color: red;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background-color 0.2s;
}

.close-button:hover {
  background-color: rgba(255, 0, 0, 0.918);
}

.close-icon {
  width: 27px;
  height: 27px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 16px;
  color: #ffffff;
  background-color: #3d3d3d;
  border-radius: 25px;
  cursor: pointer;
}

.modal-body {
  width: 600px;
  height: 405px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-row {
  width: 476px;
  height: 41px;
  display: flex;
  gap: 28px;
}

.field-container {
  width: 140px;
  height: 41px;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  display: flex;
  flex-direction: column;
}

.field-title {
  width: 87px;
  height: 17px;
  font-family: "Helvetica Neue", sans-serif;
  font-weight: 400;
  font-style: Regular;
  font-size: 11px;
  line-height: 150%;
  letter-spacing: 0%;
  text-align: center;
  color: #1a1a1ade;
  display: flex;
  align-items: center;
  margin: 0 auto;
}

.field-value {
  width: 200px;
  height: 24px;
  font-family: "Helvetica Neue", sans-serif;
  font-weight: 700;
  font-style: Bold;
  font-size: 16px;
  line-height: 150%;
  letter-spacing: 0%;
  vertical-align: middle;
  color: #1a1a1ade;
  display: flex;
  flex-grow: 1;
  padding: 0px 28px;
}

.field-container.full-width {
  width: 100%;
}

.field-container.full-width .field-title {
  width: 84px;
}

.field-container.full-width .field-value {
  width: calc(100% - 84px);
  text-align: left;
  padding-left: 10px;
  box-sizing: border-box;
}

// ::ng-deep .mat-mdc-form-field.mat-form-field-animations-enabled .mdc-text-field__input {
//   width: 100px !important;
// }

.weekday-headers-wrapper {
  position: sticky;
  top: 0;
  background: white;
  z-index: 100;
  padding: 0 20px;
}

.calendar-grid-scrollable {
  overflow-y: auto;
  max-height: calc(100vh - 300px);
  padding: 0 20px 20px;
}

.context-menu {
  position: fixed !important;
  background-color: white !important;
  border: 1px solid #ccc !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2) !important;
  border-radius: 4px !important;
  min-width: 150px !important;
  z-index: 9999 !important;
  padding: 5px 0 !important;
  display: block !important;
}

.menu-item {
  padding: 8px 12px !important;
  cursor: pointer !important;

  &:hover {
    background-color: #f5f5f5 !important;
  }
}

/* Yearly View Styles */
.yearly-view {
  display: flex;
  justify-content: center;
  padding-left: 20px;
  padding-right: 20px;
  padding-top: 0px;
  width: 100%;
  box-sizing: border-box;

  .yearly-grid-container {
    width: 100%;
    max-width: 1292px;
    height: 420px;
    display: flex;
    flex-direction: column;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;

    &::-webkit-scrollbar {
      height: 8px;
      width: 8px;
    }

    &::-webkit-scrollbar-track {
      background: #f1f1f1;
      border-radius: 4px;
    }

    &::-webkit-scrollbar-thumb {
      background: #ccc;
      border-radius: 4px;

      &:hover {
        background: #999;
      }
    }
  }

  .yearly-header {
    display: flex;
    height: 32px;
    background-color: #f6f6f6;
    border-radius: 4px;
    margin-bottom: 2px;

    .yearly-header-cell {
      display: flex;
      align-items: center;
      justify-content: center;
      font-family: "Helvetica Neue", sans-serif;
      font-weight: 700;
      font-style: bold;
      font-size: 12px;
      line-height: 150%;
      letter-spacing: 0%;
      border-left: 1px solid #1a1a1a61;
      box-sizing: border-box;

      &:first-child {
        border-left: none;
      }

      &.month-header {
        width: 78px;
      }

      &:not(.month-header) {
        width: 39.42px;
      }
    }
  }

  .yearly-month-rows {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-grow: 1;

    .yearly-month-row {
      display: flex;
      height: 30px;
      gap: 2px;

      .yearly-month-cell {
        width: 78px;
        height: 30px;
        background-color: #fff;
        border-radius: 4px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-family: "Helvetica Neue", sans-serif;
        font-weight: 700;
        font-style: bold;
        font-size: 12px;
        line-height: 150%;
        letter-spacing: 0%;
        border: 1px solid #ddd;
        box-sizing: border-box;
        cursor: pointer;
        transition: background-color 0.2s ease;

        &:hover {
          background-color: var(--button-primary-bg-disabled);
        }

        &:active {
          background-color: #d0d0d0;
        }
      }

      /* ==========================================================================
         YOUR NEW STYLES ARE HERE - WITH ORIGINAL VALUES
         This replaces all the old .yearly-day-cell styles
         ========================================================================== */
      .yearly-day-cell {
        width: 37.42px;
        height: 30px;
        border-radius: 4px;
        box-sizing: border-box;
        transition: transform 0.2s;
        /* Default background from your original file */
        background-color: var(--bg-subtle);

        &:hover {
          transform: scale(1.1);
          z-index: 1;
          box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
        }

        /* Original Colors and Styles */
        &.present {
          background-color: #a5f2c5;
        }

        &.leave {
          background-color: #6a8acf;
        }

        &.weekly-off {
          background-color: #83ddff;
        }

        &.absent {
          background-color: #f68787;
        }

        &.holiday {
          background-color: #ffcb8b;
        }

        &.multiple {
          background-color: #54e55f;
        }

        &.today-year {
          border: 2px solid black !important;
          box-shadow: 0 0 5px rgba(0, 0, 0, 0.4);
        }

        &.empty-day,
        &.future-day {
          background-color: var(--action-secondary-hover);
          /* Original value */
          cursor: default;

          &:hover {
            transform: none !important;
            box-shadow: none !important;
          }
        }
      }
    }
  }
}

/* Responsive adjustments for the yearly view */
@media (max-width: 1400px) {
  .yearly-view {
    .yearly-grid-container {
      width: 100%;
      max-width: 1292px;
    }

    .yearly-header-cell:not(.month-header),
    .yearly-day-cell {
      width: 35px;
    }
  }
}

@media (max-width: 1200px) {
  .yearly-view {
    padding: 15px;

    .yearly-header-cell:not(.month-header),
    .yearly-day-cell {
      width: 32px;
    }

    .yearly-month-cell {
      width: 65px;
      font-size: 11px;
    }

    .yearly-header-cell {
      font-size: 11px;
    }
  }
}

@media (max-width: 1024px) {
  .yearly-view {

    .yearly-header-cell:not(.month-header),
    .yearly-day-cell {
      width: 28px;
    }

    .yearly-month-cell {
      width: 60px;
      font-size: 10px;
    }

    .yearly-header-cell {
      font-size: 10px;
    }

    .yearly-month-row {
      height: 28px;
    }
  }
}

@media (max-width: 768px) {
  .yearly-view {
    padding: 10px;

    .yearly-grid-container {
      height: auto;
      overflow-x: auto;
      overflow-y: visible;
      border-radius: 8px;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    .yearly-header,
    .yearly-month-row {
      min-width: 700px;
    }

    .yearly-header-cell:not(.month-header),
    .yearly-day-cell {
      width: 22px;
      min-width: 22px;
    }

    .yearly-month-cell {
      width: 55px;
      min-width: 55px;
      font-size: 9px;
    }

    .yearly-header-cell {
      font-size: 9px;
    }

    .yearly-month-row {
      height: 26px;
    }

    .yearly-header {
      height: 28px;
    }
  }
}

@media (max-width: 480px) {
  .yearly-view {
    padding: 5px;

    .yearly-grid-container {
      border-radius: 6px;
    }

    .yearly-header,
    .yearly-month-row {
      min-width: 600px;
    }

    .yearly-header-cell:not(.month-header),
    .yearly-day-cell {
      width: 18px;
      min-width: 18px;
    }

    .yearly-month-cell {
      width: 50px;
      min-width: 50px;
      font-size: 8px;
    }

    .yearly-header-cell {
      font-size: 8px;
    }

    .yearly-month-row {
      height: 24px;
    }

    .yearly-header {
      height: 26px;
    }

    .yearly-day-cell:hover {
      transform: scale(1.05);
    }
  }
}

@media (max-width: 360px) {
  .yearly-view {

    .yearly-header,
    .yearly-month-row {
      min-width: 550px;
    }

    .yearly-header-cell:not(.month-header),
    .yearly-day-cell {
      width: 16px;
      min-width: 16px;
    }

    .yearly-month-cell {
      width: 45px;
      min-width: 45px;
      font-size: 7px;
    }

    .yearly-header-cell {
      font-size: 7px;
    }

    .yearly-month-row {
      height: 22px;
    }

    .yearly-header {
      height: 24px;
    }
  }
}


.refresh-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-left: 15px;
}

.refresh-btn {
  width: 48px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid #818181;
  background-color: #ffffff;
  color: #333;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: background-color 0.2s;
  margin-right: 5px;
}

.refresh-btn:hover {
  background-color: #f5f5f5;
}

.refresh-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.last-updated {
  font-size: 10px;
  color: #666;
  text-align: center;
  max-width: 120px;
  line-height: 1.2;
}

.rotating {
  animation: rotate 1s linear infinite;
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .refresh-container {
    flex-direction: row;
    align-items: center;
    margin-left: 10px;
  }

  .refresh-btn {
    margin-bottom: 0;
    margin-right: 5px;
  }

  .last-updated {
    max-width: 100px;
    font-size: 9px;
  }
}

/* Screen Modal Styles - Bigger and Responsive */
.modal-content.screen-modal {
  width: min(90vw, 1405px);
  max-width: 95vw;
  height: 80vh;
  max-height: 900px;
  border-radius: 8px;
  background-color: #ffffff;
  box-shadow: 0px 2px 3px 0px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  padding: 20px;
  gap: 15px;
  margin-top: 10px;
}

.modal-body.screen-modal-body {
  flex: 1;
  overflow: auto;
  padding: 0;
  width: 100%;
  min-width: 0;
}

::ng-deep {

  // Override employeewiseleave container height when embedded inside the screen modal
  .modal-body.screen-modal-body {
    .employeewise-leave-container {
      height: 100%;
      overflow-y: auto;
    }

    .lightbox-vertical-container {
      width: 100%;
      overflow-x: hidden;
    }

    .TabContainer {
      display: flex;
      flex-wrap: wrap;
      width: 100%;
    }
  }

  // Target the modal body that contains the attendance punch component
  .modal-body.screen-modal-body {
    .FormOverView.scrollbar {
      // Apply your scrollbar styles here
      overflow-y: hidden;
      overflow-x: hidden;

      // Custom scrollbar styling
      &::-webkit-scrollbar {
        width: 8px;
      }

      &::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 4px;
      }

      &::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 4px;

        &:hover {
          background: #555;
        }
      }

      // For Firefox
      scrollbar-width: thin;
      scrollbar-color:  var(--scrollbar-thumb, #ccc);
    }
  }
}

/* Responsive adjustments for screen modal */
@media (max-width: 1400px) {
  .modal-content.screen-modal {
    width: min(95vw, 1400px);
    height: 85vh;
  }
}

@media (max-width: 1200px) {
  .calendar-container {
    padding: 0 20px 8px 30px;
  }

  .calendar-cell {
    min-height: 60px;
    gap: 4px;
    padding: 6px;
  }

  .date-number {
    font-size: 18px;
  }
}

@media (max-width: 992px) {
  .calendar-container {
    padding: 0 15px 8px 20px;
    max-height: calc(100vh - 340px);
  }

  .calendar-cell {
    min-height: 55px;
  }
}

@media (max-width: 768px) {
  .modal-content.screen-modal {
    width: 99%;
    height: 95vh;
    padding: 15px;
    border-radius: 0;
  }

  .calendar-container {
    padding: 0 15px 30px;
    max-height: calc(100vh - 180px);
  }

  .calendar-grid {
    gap: 6px;
  }
}

@media (max-width: 480px) {
  .modal-content.screen-modal {
    width: 100%;
    height: 100vh;
    border-radius: 0;
    padding: 10px;
  }

  .modal-body.screen-modal-body {
    padding: 0;
  }
}

/* Ensure the screen modal header is responsive */
.screen-modal .modal-header {
  width: 100%;
  height: auto;
  min-height: 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 0 10px 0;
  border-bottom: 1px solid #eee;
}

.screen-modal .modal-header-content {
  width: auto;
  height: auto;
  font-size: 18px;
  font-weight: 700;
  padding: 0;
}

@media (max-width: 768px) {
  .screen-modal .modal-header-content {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .screen-modal .modal-header-content {
    font-size: 14px;
    max-width: 70%;
  }
}

.screen-modal .close-icon {
  width: 30px;
  height: 30px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 18px;
  color: #ffffff;
  background-color: red;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.2s;
}

.screen-modal .close-icon:hover {
  background-color: rgba(255, 0, 0, 0.817);
}

@media (max-width: 480px) {
  .screen-modal .close-icon {
    width: 25px;
    height: 25px;
    font-size: 16px;
  }

}

.view-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 48px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid #818181;
  background-color: #ffffff;
  color: #333;
  font-weight: 700;
  font-style: bold;
  font-size: 20px;
  line-height: 150%;
  letter-spacing: 0%;
  text-align: center;
  cursor: pointer;
  margin: 0 5px;
  transition: all 0.3s ease;
  padding-top: 2px;
}


.view-toggle-btn mat-icon {
  font-size: 20px;
  padding-top: 2px;
}

@media (max-width: 768px) {
  .view-toggle-btn {
    width: 100px;
    font-size: 12px;
    padding: 0 5px;
  }

  .view-toggle-btn mat-icon {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .view-toggle-btn {
    width: 80px;
    font-size: 10px;
    height: 36px;
  }

  .view-toggle-btn mat-icon {
    font-size: 14px;
  }
}

.yearly-day-cell.today-year {
  border: 2px solid black !important;
  position: relative;
}

.yearly-day-cell.today-year.present,
.yearly-day-cell.today-year.absent,
.yearly-day-cell.today-year.leave,
.yearly-day-cell.today-year.weekly-off,
.yearly-day-cell.today-year.holiday,
.yearly-day-cell.today-year.multiple,
.yearly-day-cell.today-year.half-day-absent {
  border: 2px solid black !important;
}

/* Make today indicator more visible on mobile */
@media (max-width: 768px) {
  .yearly-day-cell.today-year {
    border: 2px solid #333 !important;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.4);
  }
}

@media (max-width: 480px) {
  .yearly-day-cell.today-year {
    border: 2px solid #333 !important;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
  }
}

::ng-deep .cdk-overlay-container {
  z-index: 100000 !important;
}

/* All overlay panes */
::ng-deep .cdk-overlay-pane {
  z-index: 100001 !important;
}

/* Angular Material Components */
::ng-deep .mat-mdc-select-panel {
  z-index: 100002 !important;
}

::ng-deep .mat-mdc-menu-panel {
  z-index: 100002 !important;
}

::ng-deep .mat-mdc-dialog-container {
  z-index: 100003 !important;
}

::ng-deep .mat-mdc-snack-bar-container {
  z-index: 100004 !important;
}

::ng-deep .mat-mdc-tooltip {
  z-index: 100004 !important;
}

/* Error message overlays */
::ng-deep .mat-error {
  z-index: 100002 !important;
}

/* Picklist specific */
::ng-deep gb-newpicklist .cdk-overlay-pane,
::ng-deep gb-newpicklist .mat-mdc-select-panel,
::ng-deep gb-newpicklist .mat-select-panel {
  z-index: 100003 !important;
}

/* Date picker overlays */
::ng-deep .mat-datepicker-popup {
  z-index: 100003 !important;
}

::ng-deep .mat-calendar {
  z-index: 100003 !important;
}

/* Autocomplete overlays */
::ng-deep .mat-mdc-autocomplete-panel {
  z-index: 100002 !important;
}

/* Custom component overlays - if any */
::ng-deep .gb-error-popup,
::ng-deep .gb-validation-message,
::ng-deep .error-tooltip {
  z-index: 100004 !important;
}

.calendar-grid-scrollablee {
  overflow-y: auto;
  max-height: calc(110vh - 300px);
  padding: 0 20px 20px;
}

.weekday-headers-wrapper {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 103%;
  margin-bottom: 8px;
  flex-shrink: 1;
}

.weekday-headers {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  height: 32px;
  background-color: #f6f6f6;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.weekday-headers {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  height: 32px;
  background-color: #f6f6f6;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.grid-view-toggle-header {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 40px;
  padding: 6px;
  background: #fff;
  border: 1px solid #818181;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  margin: 0 5px;

  &:hover {
    background: #f5f5f5;
  }

  mat-icon {
    font-size: 20px;
    height: 20px;
    width: 20px;
  }
}

/* Responsive adjustments for grid toggle button */
@media (max-width: 1200px) {
  .grid-view-toggle-header {
    width: 44px;
    height: 38px;

    mat-icon {
      font-size: 18px;
      height: 18px;
      width: 18px;
    }
  }
}

@media (max-width: 768px) {
  .grid-view-toggle-header {
    width: 40px;
    height: 36px;
    margin: 0 3px;

    mat-icon {
      font-size: 16px;
      height: 16px;
      width: 16px;
    }
  }
}

@media (max-width: 480px) {
  .grid-view-toggle-header {
    width: 36px;
    height: 32px;
    padding: 4px;
    margin: 0 2px;

    mat-icon {
      font-size: 14px;
      height: 14px;
      width: 14px;
    }
  }
}

@media (max-width: 360px) {
  .grid-view-toggle-header {
    width: 32px;
    height: 28px;
    padding: 3px;

    mat-icon {
      font-size: 12px;
      height: 12px;
      width: 12px;
    }
  }
}

.grid-view-container {
  overflow-x: auto;
  max-height: calc(100vh - 300px);
  overflow-y: auto;
}

.legend-item.color-red::before {
  background-color: #ff9da4;
}

.legend-item.color-orange::before {
  background-color: #fdc973;
}

.legend-item.color-green::before {
  background-color: #a0ffc9;
}

.attendance-grid-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: white;
  font-size: 12px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0px 2px 4px 0px #00000033;

  thead {
    position: sticky;
    top: 0;
    background: #f6f6f6;
    z-index: 1;
  }

  th {
    padding: 12px 10px;
    text-align: center;
    border: 1px solid #e0e0e0;
    font-weight: 700;
    font-family: "Helvetica Neue", sans-serif;
    color: var(--text-primary);
    font-size: 12px;
    white-space: nowrap;
    background: var(--bg-surface);
    font-style: bold;
  }

  th:first-child {
    border-top-left-radius: 12px;
  }

  th:last-child {
    border-top-right-radius: 12px;
  }

  td {
    padding: 10px 8px;
    text-align: center;
    font-size: 12px;
    white-space: nowrap;
    font-family: "Helvetica Neue", sans-serif;
    color: var(--text-primary);
    font-weight: 400;
  }

  tbody tr:last-child td:first-child {
    border-bottom-left-radius: 8px;
  }

  tbody tr:last-child td:last-child {
    border-bottom-right-radius: 8px;
  }

  tbody tr {
    cursor: pointer;

    &:nth-child(even) {
      background-color: var(--button-primary-border-disabled);
    }

    &:nth-child(odd) {
      background-color: white;
    }

    &:hover {
      background-color: var(--button-primary-bg-disabled) !important;
    }

    &.color-red {
      background-color: #ff9da4 !important;

      &:hover {
        background-color: #f47676 !important;
      }
    }

    &.color-orange {
      background-color: #fdc973 !important;

      &:hover {
        background-color: #ffa733 !important;
      }
    }

    &.color-green {
      background-color: #a0ffc9 !important;

      &:hover {
        background-color: #a0ffdf !important;
      }
    }
  }
}

@media (max-width: 768px) {
  .summary-cards {
    gap: 8px;
    padding: 15px;
  }

  .summary-card {
    min-width: 90px;
    padding: 10px 12px;
  }

  .summary-value {
    font-size: 18px;
  }

  .summary-label {
    font-size: 10px;
  }

  .attendance-grid-table {

    th,
    td {
      padding: 8px 6px;
      font-size: 10px;
      border-radius: 8px !important;
    }
  }
}

.grid-view-container {
  overflow-x: auto;
  max-height: calc(118vh - 400px);
  overflow-y: auto;
  padding: 0 20px 20px;
}

.summary-cards {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0px 20px 4px 20px;
  flex-wrap: wrap;
}

.summary-card {
  flex: 0 0 auto;
  min-width: 90px;
  padding: 8px 12px;
  background: white;
  text-align: left;
}

.summary-label {
  font-size: 11px;
  color: var(--text-primary);
  margin-bottom: 4px;
  font-weight: 400;
  white-space: nowrap;
  font-family: "Helvetica Neue", sans-serif;
}

.summary-value {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  font-style: bolder;
  font-family: "Helvetica Neue", sans-serif;
}

@media (max-width: 768px) {
  .summary-cards {
    gap: 8px;
    padding: 15px;
  }

  .summary-card {
    min-width: 90px;
    padding: 10px 12px;
  }

  .summary-value {
    font-size: 12px;
    font-style: bold;
    font-weight: 700;
    font-family: "Helvetica Neue", sans-serif;
  }

  .summary-label {
    font-size: 11px;
    font-family: 400;
    font-family: "Helvetica Neue", sans-serif;
  }

  .attendance-grid-table {

    th,
    td {
      padding: 8px 6px;
      font-size: 10px;
    }
  }
}

.legend.grid-legend {
  display: flex;
  justify-content: flex-end;
  padding: 0;
  margin: 0;
  flex: 1;
}

.legend.grid-legend .legend-container {
  display: flex;
  gap: 15px;
  flex-wrap: nowrap;
  align-items: center;
}

.userImage {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  cursor: pointer;
  background-color: var(--button-primary-bg-active);
  color: var(--bg-surface);
  border-radius: 50%;
  font-family: 'Helvetica Neue', sans-serif;
  font-weight: 700;
  font-style: normal;
  font-size: 20px;
  line-height: 150%;
  letter-spacing: 0;
  text-align: center;
  flex-shrink: 0;
  margin-left: 10px;
}

.employee-picker-wrapper {
  position: relative;
  display: inline-block;
  margin-left: 20px;

  gb-newpicklist {
    display: block;

    ::ng-deep {
      .mat-form-field-wrapper {
        padding-right: 40px !important;
      }


    }
  }

  .picklist-clear-icon {
    position: absolute;
    right: 50px;
    top: 50%;
    transform: translateY(-50%);
    color: #ED2531 !important;
    font-size: 12px !important;
    width: 12px !important;
    height: 12px !important;
    line-height: 12px !important;
    cursor: pointer;
    z-index: 1000;
    background: transparent;
    pointer-events: auto;

    &:hover {
      color: #c41e28 !important;
      transform: translateY(-50%) scale(1.3);
    }

    &:active {
      transform: translateY(-50%) scale(0.9);
    }
  }
}

.picklist-clear-icon-boxed {
  position: absolute;
  right: 48px;
  top: 50%;
  transform: translateY(-50%);
  color: #ED2531 !important;
  font-size: 12px !important;
  width: 16px !important;
  height: 16px !important;
  line-height: 16px !important;
  cursor: pointer;
  z-index: 1000;
  background: rgba(237, 37, 49, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;

  &:hover {
    background: rgba(237, 37, 49, 0.2);
    color: #c41e28 !important;
  }
}

@media (max-width: 768px) {
  .top-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 15px;
    gap: 15px;
  }

  .left-section {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }

  .employee-picker-wrapper {
    width: 100%;
    margin-left: 0;
    margin-top: 10px;
  }

  .right-section {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
  }

  .nav-btn,
  .today-btn,
  .view-toggle-btn {
    height: 44px;
    /* Larger touch target */
    min-height: 44px;
    /* Minimum touch target for accessibility */
  }

  .today-btn {
    width: auto;
    flex: 1;
    min-width: 150px;
  }

  .refresh-container {
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
    margin: 10px 0;
  }
}

@media (max-width: 480px) {
  .top-bar {
    padding: 10px;
  }

  .nav-btn,
  .view-toggle-btn {
    width: 44px;
    height: 44px;
  }

  .today-btn {
    font-size: 12px;
    min-width: 120px;
  }
}

@media (max-width: 768px) {
  .calendar-container {
    padding: 0 10px 20px;
    max-height: calc(100vh - 250px);
  }

  .weekday-headers-wrapper {
    padding: 0 10px;
  }

  .calendar-grid {
    gap: 5px;
  }

  .calendar-cell {
    min-height: 60px;
    padding: 5px;
    font-size: 14px;
  }

  .date-number {
    font-size: 16px;
    width: 20px;
    height: 25px;
  }

  .time-icon-container {
    width: 20px;
    height: 20px;
    bottom: 5px;
    right: 5px;
  }
}

@media (max-width: 480px) {
  .calendar-container {
    padding: 0 5px 15px;
    max-height: calc(100vh - 220px);
  }

  .calendar-grid {
    gap: 3px;
  }

  .calendar-cell {
    min-height: 50px;
    padding: 3px;
    font-size: 12px;
  }

  .date-number {
    font-size: 14px;
    width: 18px;
    height: 22px;
  }

  .time-icon-container {
    width: 18px;
    height: 18px;
  }
}

@media (max-width: 768px) {
  .legend {
    padding: 5px 15px;
    flex-wrap: wrap;
  }

  .legend-container {
    gap: 8px;
    padding: 5px;
  }

  .legend-item {
    font-size: 11px;
    height: 16px;
  }

  .legend-item::before {
    width: 16px;
    height: 16px;
  }

  .summary-cards {
    padding: 0 15px;
    gap: 10px;
  }

  .summary-card {
    min-width: 80px;
    padding: 8px 10px;
  }

  .summary-label {
    font-size: 10px;
  }

  .summary-value {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .legend {
    padding: 5px 10px;
  }

  .legend-container {
    gap: 5px;
  }

  .legend-item {
    font-size: 10px;
    height: 14px;
  }

  .legend-item::before {
    width: 14px;
    height: 14px;
  }

  .summary-card {
    min-width: 70px;
    padding: 6px 8px;
  }

  .summary-label {
    font-size: 9px;
  }

  .summary-value {
    font-size: 12px;
  }
}

@media (max-width: 768px) {
  .modal-overlay {
    padding: 0;
  }

  .modal-content {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
    padding: 15px;
  }

  .modal-header {
    width: 100%;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
  }

  .modal-header-content {
    width: auto;
    font-size: 16px;
  }

  .modal-body {
    width: 100%;
    height: calc(100% - 60px);
    overflow-y: auto;
  }

  .modal-row {
    width: 100%;
    flex-wrap: wrap;
    gap: 15px;
  }

  .field-container {
    width: calc(50% - 8px);
    min-width: 140px;
  }

  .field-container.full-width {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .modal-content {
    padding: 10px;
  }

  .modal-header-content {
    font-size: 14px;
  }

  .field-container {
    width: 100%;
    min-width: auto;
  }
}

@media (max-width: 768px) {
  .grid-view-container {
    padding: 0 10px 20px;
    max-height: calc(100vh - 250px);
  }

  .attendance-grid-table {
    font-size: 11px;
  }

  .attendance-grid-table th,
  .attendance-grid-table td {
    padding: 8px 5px;
  }
}

@media (max-width: 480px) {
  .grid-view-container {
    padding: 0 5px 15px;
    max-height: calc(100vh - 220px);
  }

  .attendance-grid-table {
    font-size: 10px;
  }

  .attendance-grid-table th,
  .attendance-grid-table td {
    padding: 6px 3px;
  }
}

@media (max-width: 768px) {
  .yearly-view {
    padding: 10px;
  }

  .yearly-grid-container {
    height: auto;
    overflow-x: auto;
    overflow-y: visible;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }

  .yearly-header,
  .yearly-month-row {
    min-width: 700px;
  }

  .yearly-header-cell:not(.month-header),
  .yearly-day-cell {
    width: 22px;
    min-width: 22px;
  }

  .yearly-month-cell {
    width: 55px;
    min-width: 55px;
    font-size: 9px;
  }

  .yearly-header-cell {
    font-size: 9px;
  }

  .yearly-month-row {
    height: 26px;
  }

  .yearly-header {
    height: 28px;
  }
}

@media (max-width: 480px) {
  .yearly-view {
    padding: 5px;
  }

  .yearly-header,
  .yearly-month-row {
    min-width: 600px;
  }

  .yearly-header-cell:not(.month-header),
  .yearly-day-cell {
    width: 18px;
    min-width: 18px;
  }

  .yearly-month-cell {
    width: 50px;
    min-width: 50px;
    font-size: 8px;
  }

  .yearly-header-cell {
    font-size: 8px;
  }

  .yearly-month-row {
    height: 24px;
  }

  .yearly-header {
    height: 26px;
  }
}

@media (max-width: 768px) {
  .context-menu {
    min-width: 180px;
    font-size: 14px;
  }

  .menu-item {
    padding: 12px 15px;
  }
}

@media (max-width: 480px) {
  .context-menu {
    min-width: 160px;
    font-size: 13px;
  }

  .menu-item {
    padding: 10px 12px;
  }
}

@media (max-width: 768px) {
  .employee-picker-wrapper {
    width: 100%;
    margin-left: 0;
    margin-top: 10px;
  }

  .profile-pic,
  .userImage {
    width: 32px;
    height: 32px;
  }

  .employee-details {
    padding-left: 8px;
  }

  .employee-details h3 {
    width: 180px;
    font-size: 11px;
  }

  .employee-details p {
    width: 180px;
    font-size: 9px;
  }
}

@media (max-width: 480px) {

  .profile-pic,
  .userImage {
    width: 30px;
    height: 30px;
  }

  .employee-details {
    padding-left: 6px;
  }

  .employee-details h3 {
    width: 150px;
    font-size: 10px;
  }

  .employee-details p {
    width: 150px;
    font-size: 8px;
  }
}

@media screen and (min-width: 1400px) {
  .calendar-container {
    padding: 0 28px 8px 35px;
    max-height: calc(100vh - 300px);
  }

  .calendar-cell {
    min-height: 65px;
    padding: 7px;
  }

  .weekday-headers {
    width: 96%;
    margin-right: 25px;
    margin-left: 25px;
  }
}

@media screen and (min-width: 1600px) {
  .calendar-container {
    padding: 0 30px 8px 38px;
    max-height: calc(100vh - 310px);
  }

  .calendar-cell {
    min-height: 68px;
  }

  .weekday-headers {
    width: 95%;
    margin-right: 22px;
    margin-left: 22px;
  }
}

/* 90% zoom */
@media screen and (max-width: 1600px) and (min-width: 1200px) {
  .calendar-container {
    padding: 0 25px 8px 32px;
    max-height: calc(100vh - 290px);
  }

  .calendar-cell {
    min-height: 62px;
  }
}

/* 80% zoom */
@media screen and (max-width: 1200px) and (min-width: 992px) {
  .calendar-container {
    padding: 0 22px 8px 28px;
    max-height: calc(100vh - 280px);
  }

  .calendar-cell {
    min-height: 58px;
    gap: 3px;
  }

  .date-number {
    font-size: 17px;
  }
}

.calendar-container {
  display: flex;
  flex-direction: column;
  padding: 0 32px 8px 40px;
  min-height: 250px;
  max-height: calc(100vh - 325px);
  overflow-y: auto;
  overflow-x: hidden;
  transition: padding 0.3s ease;
}

/* With menu tree open */
body:not(.menu-collapsed) .calendar-container {
  padding: 0 28px 8px 35px;
  max-height: calc(100vh - 330px);
}

/* Without menu tree / menu collapsed */
body.menu-collapsed .calendar-container {
  padding: 0 35px 8px 45px;
  max-height: calc(100vh - 320px);
}

.weekday-headers {
  position: sticky;
  top: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  width: 95%;
  height: 32px;
  background-color: #f6f6f6;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 8px;
  flex-shrink: 1;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-right: 20px;
  margin-left: 20px;
  transition: width 0.3s ease, margin 0.3s ease;
}

/* With menu tree */
body:not(.menu-collapsed) .weekday-headers {
  width: 96%;
  margin-right: 18px;
  margin-left: 18px;
}

/* Without menu tree */
body.menu-collapsed .weekday-headers {
  width: 97.5%;
  margin-right: 22px;
  margin-left: 22px;
  height: 100%;
}

/* Calendar cell zoom adjustments */
.calendar-cell {
  width: 100%;
  min-height: 70px;
  height: 30px;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  border: 2px solid #eaeaeacc;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  cursor: pointer;
  transition: transform 0.2s, min-height 0.3s ease;
  position: relative;
  gap: 6px;
  padding: 8px;
  background-color: #fff;
  box-sizing: border-box;
  min-width: 0;
}

/* Menu tree adjustments for cells */
body:not(.menu-collapsed) .calendar-cell {
  min-height: 65px;
  padding: 7px;
  gap: 5px;
}

body.menu-collapsed .calendar-cell {
  min-height: 72px;
  padding: 9px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  width: 100%;
  gap: 8px;
  box-sizing: border-box;
  padding-bottom: 20px;
  transition: gap 0.3s ease;
}

/* Adjust gap based on viewport */
@media screen and (max-width: 1400px) {
  .calendar-grid {
    gap: 7px;
  }
}

@media screen and (max-width: 1200px) {
  .calendar-grid {
    gap: 6px;
  }
}

body:not(.menu-collapsed) .calendar-grid {
  gap: 7px;
}

.yearly-grid-view-wrapper {
  width: 100%;
  padding: 0 20px;
}

.yearly-grid-view-container {
  overflow-x: auto;
  max-height: calc(100vh - 300px);
  overflow-y: auto;
  padding-bottom: 20px;
}

@media (max-width: 768px) {
  .yearly-grid-view-wrapper {
    padding: 0 10px;
  }

  .yearly-grid-view-container {
    max-height: calc(100vh - 250px);
  }
}

.back-to-team-btn {
  border-radius: 8px;
  border: 1px solid #818181;
  background-color: #ffffff;
  color: #333;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  margin-left: auto;
  width: 150px;
}

.back-to-team-btn:hover {
  background-color: #e8e8e8;
}

.legend-item::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
  background-color: var(--legend-color, #ccc); // Use CSS variable
}
.yearly-day-cell.future-day {
  background-color: var(--state-disabled-surface);  
  cursor: default;
  
  &:hover {
    transform: none !important;
    box-shadow: none !important;
  }
}
.refresh-btn2 {
  width: 160px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid #818181;
  background-color: var(--action-primary-disabled);
  color: #333;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: background-color 0.2s;
  margin-right: 5px;
  font-weight: 700;
  font-size: 14px;
}