/* Availability panel */

.availability-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.availability-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 28px;
  padding: 0 8px;
  background: var(--bg-toolbar);
  border-bottom: 1px solid var(--outline-subtle);
  flex-shrink: 0;
  gap: 8px;
}

.availability-week-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.availability-week-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition);
}

.availability-week-btn img {
  width: 12px;
  height: 12px;
  opacity: 0.75;
}

.availability-week-btn:hover {
  background: var(--bg-hover);
}

.availability-week-btn:hover img {
  opacity: 1;
}

.availability-week-label {
  display: inline-block;
  width: 228px;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  flex-shrink: 0;
}

.availability-week-label strong {
  color: var(--text-primary);
  font-weight: 600;
}

.availability-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.availability-legend {
  display: flex;
  align-items: center;
  gap: 3px;
}

.availability-legend-label {
  font-size: 10px;
  color: var(--text-muted);
}

.availability-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.availability-legend-swatch--0 {
  background: var(--bg-input);
  border: 1px solid var(--outline-subtle);
}

.availability-legend-swatch--1 {
  background: rgba(46, 160, 67, 0.35);
}

.availability-legend-swatch--2 {
  background: rgba(46, 160, 67, 0.55);
}

.availability-legend-swatch--3 {
  background: rgba(46, 160, 67, 0.75);
}

.availability-legend-swatch--4 {
  background: #2ea043;
}

.availability-timezone {
  font-family: var(--font-ui);
  font-size: 10px;
  color: var(--text-muted);
  /* Solid bg + appearance reset: WKWebView (Tauri) otherwise paints the
     native macOS aqua "glass" select chrome. Provide our own caret instead. */
  -webkit-appearance: none;
  appearance: none;
  background-color: var(--bg-input);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath fill='%23999999' d='M0 0h8L4 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  border: 1px solid var(--outline-subtle);
  border-radius: var(--radius-sm);
  padding: 2px 18px 2px 6px;
  max-width: 140px;
  outline: none;
  cursor: pointer;
}

.availability-timezone:focus {
  border-color: var(--outline);
}

.availability-body {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 8px;
  padding: 6px 8px 8px;
}

/* wide: sidebar right, charts side-by-side */
.availability-container--wide .availability-body {
  flex-direction: row;
}

.availability-container--wide .availability-charts {
  flex-direction: row;
}

.availability-container--wide .availability-sidebar {
  width: min(180px, 28%);
  flex-direction: column;
}

/* medium: sidebar bottom, charts still side-by-side */
.availability-container--medium .availability-body {
  flex-direction: column;
}

.availability-container--medium .availability-charts {
  flex-direction: row;
}

.availability-container--medium .availability-sidebar {
  width: 100%;
  flex-direction: row;
}

/* stacked: sidebar bottom, charts stacked */
.availability-container--stacked .availability-body {
  flex-direction: column;
}

.availability-container--stacked .availability-charts {
  flex-direction: column;
}

.availability-container--stacked .availability-sidebar {
  width: 100%;
  flex-direction: row;
}

.availability-charts {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  gap: 8px;
}

.availability-section-block {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.availability-section--team {
  position: relative;
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.availability-section-header {
  flex-shrink: 0;
  padding-left: 36px;
}

.availability-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-primary);
}

.availability-section-sub {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* Grid */

.availability-grid-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 4px;
}

.availability-hour-labels {
  display: flex;
  flex-direction: column;
  width: 32px;
  flex-shrink: 0;
  padding-top: 18px;
}

.availability-hour-label {
  flex: 1;
  display: flex;
  align-items: flex-start;
  font-size: 9px;
  color: var(--text-muted);
  line-height: 1;
  padding-top: 1px;
}

.availability-grid-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.availability-day-headers {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  padding-left: 0;
  margin-bottom: 2px;
}

.availability-day-header {
  flex: 1;
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
}

.availability-columns {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 2px;
}

.availability-column {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--outline-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-input);
}

.availability-cell {
  flex: 1;
  min-height: 0;
  border-bottom: 1px solid var(--outline-subtle);
  background: var(--bg-input);
  cursor: default;
  transition: background var(--transition);
}

.availability-cell:last-child {
  border-bottom: none;
}

.availability-cell--level-1 {
  background: rgba(46, 160, 67, 0.35);
}

.availability-cell--level-2 {
  background: rgba(46, 160, 67, 0.55);
}

.availability-cell--level-3 {
  background: rgba(46, 160, 67, 0.75);
}

.availability-cell--level-4,
.availability-cell--available {
  background: #2ea043;
}

.availability-range-outline {
  position: absolute;
  left: 0;
  right: 0;
  padding: 0;
  margin: 0;
  border: none;
  pointer-events: none;
  border-radius: 2px;
  box-sizing: border-box;
}

.availability-range-outline--meeting {
  pointer-events: none;
  --stripe-angle: 45deg;
  --stripe-color: rgba(232, 160, 64, 0.45);
  --outline-color: #e8a040;
  background-color: #1e1e1e;
  background-image: repeating-linear-gradient(
    var(--stripe-angle),
    #1e1e1e,
    #1e1e1e 4px,
    var(--stripe-color) 4px,
    var(--stripe-color) 7px
  );
  box-shadow: inset 0 0 0 2px var(--outline-color);
}

/* Upward slope, brighter yellow — only when overlapping a meeting that started earlier */
.availability-range-outline--meeting.availability-range-outline--later {
  --stripe-angle: -45deg;
  --stripe-color: rgba(255, 229, 102, 0.55);
  --outline-color: #ffe566;
  background-color: #222;
  background-image: repeating-linear-gradient(
    var(--stripe-angle),
    #222,
    #222 4px,
    var(--stripe-color) 4px,
    var(--stripe-color) 7px
  );
}

.availability-range-outline--meeting.availability-range-outline--active {
  box-shadow: inset 0 0 0 2px #ffe566;
}

.availability-range-outline--selection {
  pointer-events: none;
  --outline-color: #e8a040;
  background-color: rgba(30, 30, 30, 0.85);
  background-image: repeating-linear-gradient(
    45deg,
    rgba(30, 30, 30, 0.85),
    rgba(30, 30, 30, 0.85) 4px,
    rgba(232, 160, 64, 0.25) 4px,
    rgba(232, 160, 64, 0.25) 7px
  );
  box-shadow: inset 0 0 0 2px var(--outline-color);
}

.availability-cell:hover {
  filter: brightness(1.08);
}

/* Sidebar */

.availability-sidebar {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
  min-width: 0;
}

.availability-sidebar-section {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  background: var(--bg-toolbar);
  border: 1px solid var(--outline-subtle);
  border-radius: var(--radius-sm);
}

.availability-sidebar-heading {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.availability-sidebar-empty {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  margin: 0;
}

.availability-name-list,
.availability-meeting-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.availability-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  padding: 2px 0;
}

.availability-meeting-item + .availability-meeting-item {
  margin-top: 4px;
}

.availability-meeting-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition), border-color var(--transition);
}

.availability-meeting-btn:hover {
  background: var(--bg-hover);
  border-color: var(--outline-subtle);
}

.availability-meeting-time {
  font-size: 10px;
  font-weight: 600;
  color: #e8a040;
}

.availability-meeting-subject {
  font-size: 11px;
  color: var(--text-primary);
  margin-top: 1px;
  line-height: 1.3;
}

/* Meeting proposal card */

.proposal-card {
  background: var(--bg-panel-inner);
  border: 1px solid var(--outline);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  z-index: 100;
}

.proposal-card-main {
  padding: 12px 14px;
}

.proposal-card-fields {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.proposal-time-row {
  display: flex;
  gap: 6px;
}

.proposal-field {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--outline-subtle);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition);
}

.proposal-field:focus {
  border-color: var(--outline);
}

.proposal-field--subject {
  resize: vertical;
  min-height: 56px;
  line-height: 1.4;
}

.proposal-card-actions {
  display: flex;
  border-top: 1px solid var(--outline-subtle);
}

.proposal-action {
  flex: 1;
  padding: 10px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  border: none;
  background: var(--bg-toolbar);
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition);
}

.proposal-action + .proposal-action {
  border-left: 1px solid var(--outline-subtle);
}

.proposal-action:hover {
  background: var(--bg-hover-strong);
}
