.calendar-wrapper,
.cw-inner,
.cw-time-slots,
.cc-times-grid {
  width: 100%;
  height: auto;
  position: relative;
  display: flex;
  box-sizing: border-box;
}

.calendar-wrapper {
  flex-wrap: nowrap;
  padding: var(--space-4);
  font-family: var(--font-sans);
  color: var(--color-black);
  border-radius: var(--space-3);
  border-width: 0.125rem;
  border-style: solid;
  border-color: #e0e0e0;
  background-color: var(--color-white);
  box-sizing: border-box;
}

.cw-inner {
  align-items: flex-start;
  gap: var(--space-6);
  
}

.cw-header {
  justify-content: center;
  align-items: center;
}

.cw-nav {
  width: auto;
  height: auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap:0.5rem;
  margin: 0.5rem auto;
  box-sizing: border-box;
}

.cw-label,
.cw-month-year-label {
  width: auto;
  height: auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-sizing: border-box;
}

.cw-label {
  padding:0.25rem;
  font-weight: 600;
  background-color:transparent;
  border-width: 0.125rem;
  border-style: solid;
  border-color: #e0e0e0;
  background-color: var(--color-white);
}

.cw-prev,
.cw-next {
  position:relative;
  padding:0.5rem;
  border-width: 0.125rem;
  border-style: solid;
  border-color: #cfcfcf;
  border-radius: 100%;
  background-color: #fafafa;
  cursor: pointer;
}

.cw-next svg,
.cw-prev svg {
  width:0.8rem;
  height: 0.8rem;
}

.cw-body,
.cw-time-slots-region {
  height: auto;
  position: relative;
  display: flex;
  flex-wrap: wrap;
  box-sizing: border-box;
}

.cw-body {
  width: 65%;
  gap: 1rem;
  padding:var(--space-3);
}


.cw-calendar-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.cw-calendar-table th {
  padding: var(--space-2);
  font-size: 0.85rem;
  color: #666;
}

.cw-calendar-table td {
  width: calc(100%/7 - 0rem);
  height: 5.3125rem;
  padding: var(--space-2);
  text-align: center;
  vertical-align: middle;
  box-sizing: border-box;
  cursor: default;
}

.cw-cell {
  width: 100%;
  height: 100%;
  position: relative;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--space-2);
  border-radius: var(--space-2);
  box-sizing: border-box;
}

.cw-blocked .cw-cell,
.cw-past-date .cw-cell,
.cw-unavailable .cw-cell {
  color: #bdbdbd;
  background-color: #eaeaea;
  cursor: not-allowed;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
}


.cw-available .cw-cell,
.cw-other-month .cw-available .cw-cell {
  border-width: 0.125rem;
  border-style: solid;
  border-color: transparent;
  background-color: #e6f0ff;
  cursor: pointer;
}

.cw-available .cw-cell:focus {
  outline: none;
  background-color: #f0f8ff;
}

.cw-selected-date .cw-cell,
.cw-available:hover .cw-cell {
  border-color: #7aa7ff;
  color: #fff;
  background-color: #0069ff;
}


.cw-current-date .cw-cell {
  color:#0069ff;
}

.cw-current-date .cw-cell::before {
  content: '';
  width: 1.25rem;
  height: 1.25rem;
  position: absolute;
  display:block;
  margin:auto;
  padding:0.25rem;
  top:0;
  left: 0;
  right: 0;
  bottom: 0;
  border-width: 0.125rem;
  border-style: solid;
  border-radius: 100%;
  border-color: #7aa7ff;
}

.cw-time-slots-region {
  width: 35%;
  flex-wrap: wrap;
  align-items: flex-start;
  margin: var(--space-2) 0 0;
  padding: var(--space-4) 0;
  gap: var(--space-4);
  box-sizing: border-box;
}

.cw-time-slots-title {
  width: auto;
  height: auto;
  position: relative;
  display: flex;
  flex-wrap: wrap;
  font-weight: 600;
  margin: 0 0 var(--space-2) 0;
  box-sizing: border-box;
}

.cw-time-slots,
.cc-times-grid {
  flex-wrap: wrap;
  gap: var(--space-4);
}

.cc-time-slot-btn {
  width: 6.5rem;
  padding: var(--space-2);
  border-radius: var(--space-2);
  border-width: 0.125rem;
  border-style: solid;
  border-color: #007bff;
  color: #007bff;
  background-color: var(--color-white);
  cursor: pointer;
}

.cc-time-slot-btn:hover {
  background-color: #e9f2ff;
}

.cc-time-slot-btn.selected {
  border-color: #0063d1;
  background-color: #007bff;
  color: #fff;
}

.cw-empty {
  color: #777;
  font-size: 0.95rem;
}

/* Time Format Toggle */

.time-format {
  width: auto;
  height: auto;
  position: relative;
  display: flex;
  flex-wrap: wrap;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-2) auto;
  box-sizing: border-box;
}

.time-format label {
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--color-black);
}

.time-format-toggle {
  width: auto;
  height: auto;
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1);
  border-radius: var(--space-2);
  background-color: #007bff;
  box-sizing: border-box;
}

.time-format-toggle .format-btn {
  width: auto;
  height: auto;
  position: relative;
  display: flex;
  align-items: center;
  padding: var(--space-2);
  border-radius: var(--space-1);
  color: var(--color-white);
  font-size: 0.9rem;
  background-color: transparent;
  box-sizing: border-box;
  cursor: pointer;
}

.time-format-toggle .active.format-btn {
  font-weight: 700;
  color: #007bff;
  background-color: var(--color-white);
}

/* Year and Month Picker for Calendars */

.cc-picker-month-full {
  width: 100%;;
}

.cc-month-year-picker,
.cc-picker-panel,
.cc-picker-header,
.cc-picker-grid,
.cc-picker-actions {
  height: auto;
  position: relative;
  display: flex;
  box-sizing: border-box;
}

.cc-month-year-picker {
  width: 100%;
  height: auto;
  position: absolute;
  display: block;
  padding: 1rem;
  top: 0;
  left: 0;
  background-color: var(--color-white);
}

.cc-picker-panel {
  width: 100%;
  height: 100%;
  flex-wrap: wrap;
}

.cc-picker-header {
  width: 100%;
  justify-content: center;
  gap: var(--space-4);
}

.cc-picker-mode {
  display: flex;
  justify-content: center;
  align-items: center;
}

.cc-picker-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-4);
}


.cc-picker-grid {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  flex-wrap: wrap;
  padding:var(--space-4);
  gap: var(--space-4);
  box-sizing: border-box;
}

.cc-picker-grid button {
  width: calc(100%/4 - 0.75rem);
  height: 5.375rem;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 0.875rem;
  border: 0.0625rem solid #e6e9ef;
  background-color: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cc-picker-grid button.current-month,
.cc-picker-grid button.current-year,
.cc-picker-grid button.current-month:hover,
.cc-picker-grid button.current-year:hover {
  border-color: #7aa7ff;
  color: #0b3d91;
  background-color: #e6f0ff;
}

.cc-picker-grid button.viewing-month,
.cc-picker-grid button.viewing-year,
.cc-picker-grid button.viewing-year:hover,
.cc-picker-grid button.viewing-month:hover {
  border-color: #2d4a2d;
  color: #2d4a2d;
  background-color: #f0f7f0;
}

.cc-picker-actions {
  width: auto;
  position: absolute;
  top: 0;
  right: 0;
  align-items: center;
  gap: var(--space-4);
}

.cw-show-full {
  width: auto;
  height: auto;
  position: relative;
  display: none;
  justify-content: space-between;
  align-items: center;
  padding:0;
  font-size: var(--fs-sm);
  color:var(--color-forest-green);
  background-color: transparent;
  box-sizing: border-box;
}

.cw-show-full:hover {
  border-width: 0;
  color: var(--color-forest-green);
  background-color: transparent;
}


/* Mobile UI Strip Layout */


.cw-mobile-ui .cw-calendar-table {
  display: flex;
  flex-wrap: wrap;
  margin:0;
}

.cw-mobile-ui .cw-calendar-table thead,
.cw-mobile-ui .cw-calendar-table .cw-weekdays {
  width: 100%;
  height: auto;
  position: relative;
  display: none;
  gap: 0.75rem;
  box-sizing: border-box;
}

.cw-mobile-ui .cw-calendar-table thead th,
.cw-mobile-ui .cw-calendar-table .cw-weekdays th {
  width: 4.375rem;
}

.cw-mobile-ui .cw-calendar-body {
  width: 100%;
  height: auto;
  position: relative;
  display: flex;
  overflow-x: hidden;
  box-sizing: border-box;
}

.cw-mobile-ui .cw-weekly-row {
  width: 100%;
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  box-sizing: border-box;
}


.cw-mobile-ui .cw-calendar-table td {
  width: 4.375rem;
  height: 4.375rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex:0 0 auto;
  padding:0;
  margin:0.5rem 0;
  border-radius: 0.875rem;
  border: 0.0625rem solid #e6e9ef;
  background-color: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cw-mobile-ui .cw-day-name {
  display: block;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  color: #64748b;
  margin-bottom: 0.25rem;
}

.cw-mobile-ui .cw-day-num {
  display: block;
  font-size: 1.125rem;
  font-weight: 700;
  color: #111827;
}

/* Selected State */
.cw-mobile-ui .cw-selected-date .cw-cell {
  border-color: #7aa7ff;
  color: #0b3d91;
  background-color: #e6f0ff;
}

.cw-mobile-ui .cw-selected-date .cw-day-num {
  color: #0b3d91;
}

.cw-mobile-ui .cw-selected-date .cw-day-name {
  color: #0b3d91;
}

/* Blocked State */
.calendar-wrapper.cw-mobile-ui .cw-blocked .cw-cell {
  background-color: #f8fafc;
  border-color: #f1f5f9;
  opacity: 0.4;
  cursor: not-allowed;
}

.calendar-wrapper.cw-mobile-ui .cw-blocked .cw-day-num,
.calendar-wrapper.cw-mobile-ui .cw-blocked .cw-day-name {
  color: #94a3b8;
}



/* Modal Calendar Popup for Admin  */

.cw-modal {
    width: 100%;
    height: 100%;
    position: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    top: 0;
    left: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

/* Modal Content Box */
.cw-modal-content {
    width: 90%;
    height: auto;
    max-width: 31.25rem;
    max-height: 41.25rem;
    padding: 1.25rem;
    border-radius: 0.5rem;
    overflow-y:auto;
    background-color: #ffffff;
    box-sizing: border-box;
}

/* Header Styles */
.cw-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 1rem 0;
    border-width: 0 0 0.0625rem 0;
    border-style: solid;
    border-color: #eeeeee;
}

.cw-close-modal {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    font-size: 1.5rem;
    border-width: 0;
    background-color: transparent;
    cursor: pointer;
}

.cw-modal .cw-time-slots-region {
    display: none;
}

/* Calendar Container inside Modal */
.modal-calendar-container {
    margin: 0 0 1.25rem 0;
}

/* Selection Controls Area */
.selected-dates-controls {
    padding: 1rem 0 0 0;
    border-width: 0.0625rem 0 0 0;
    border-style: solid;
    border-color: #eeeeee;
}

.hours-input-group {
    display: flex;
    align-items: center;
    margin: 0.75rem 0;
}

.hours-sep {
    margin: 0 0.5rem;
    font-weight: 500;
}

.modal-actions {
    display: flex;
    margin: 1rem 0 0 0;
}

.modal-actions button+button {
    margin: 0 0 0 0.75rem;
}

/* Selection States for Calendar Cells */
.selected-override {
    border-width: 0.125rem;
    border-style: solid;
    border-color: #2196f3;
    background-color: #e3f2fd;
}

/* Visual indicator for dates that already have saved overrides */
.has-override::after {
    content: '';
    width: 0.25rem;
    height: 0.25rem;
    display: block;
    margin: 0.125rem auto 0;
    border-radius: 50%;
    background-color: #ff9800;
}

/* Utility Visibility Class */
.cw-hidden {
    display: none;
}

@media all and (max-width: 766px) {

  .cw-inner {
    flex-wrap: wrap;
    gap: var(--space-4);
  }

  .cw-body, 
  .cw-time-slots-region {
    width: 100%;
    padding:0;
  }


  .cw-show-full {
    display: flex;
  }

  .time-format {
    display: none;
  }
}

@media all and (min-width: 500px) and (max-width: 766px) {

  .cc-time-slot-btn {
    width: calc(100%/3 - 2rem);
  }


}


@media all and (max-width: 499px) {

    .cc-picker-grid button {
    width: calc(100%/2 - 0.75rem);
  }


  .cc-time-slot-btn {
    width: calc(100%/2 - 1rem);
  }
}


@media all and (max-width: 399px) {

  .cc-picker-grid button {
    width: calc(100%/2 - 0.75rem);
  }


  .cc-time-slot-btn {
    width: 100%;
  }
}