/**
 * KAS Managed Websites plugin for KAS
 *
 * Prefix for all classes: kmw-
 */

.kmw-tabs {
  font-size: 16px;
}

.kmw-dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  width: 100%;
  max-width: none;
}

.kmw-website-selector {
  min-width: 220px;
}

.kmw-website-summary,
.kmw-tasks-section,
.kmw-task-schedule,
.kmw-task-calendar {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

.kmw-tile-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  background: #fff;
  border-radius: 10px;
  margin-bottom: 10px;
  transition: box-shadow 0.2s;
}

.kmw-tile-col {
  display: flex;
  padding: 10px;
  flex-direction: column;
  justify-content: center;
  flex: 1 1 240px;
  min-width: 220px;
}

/* Tile design for website summary */
.kmw-tile-rows {
  margin: 0 0 18px 0;
  padding: 0;
}
.kmw-tile-row:hover {
  background-color: #fafafa;
  box-shadow: 0 4px 16px rgba(0,0,0,0.05);
}
.kmw-tile-status {
  font-weight: 600;
  font-size: 15px;
  background: #f4f8fb;
  border-radius: 999px;
  padding: 3px 12px;
  border: 1px solid #0a66c2;
  color: #0a66c2;
  display: inline-block;
  min-width: 70px;
  text-align: center;
}

@media (max-width: 900px) {
  .kmw-tile-row {
    flex-wrap: wrap;
    padding: 12px 8px;
  }
  .kmw-tile-col {
    width: 100% !important;
    margin-bottom: 8px;
    text-align: left !important;
  }
  .kmw-tile-col:last-child {
    margin-bottom: 0;
  }
}

/* Task schedule calendar */
.kmw-task-schedule {
  margin-top: 28px;
}

.kmw-task-schedule h2 {
  margin-bottom: 12px;
}

.kmw-task-calendar {
  border: 1px solid #dde2eb;
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.kmw-task-calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.kmw-task-calendar-header button {
  font-size: 20px;
  border: 1px solid #c5cde5;
  border-radius: 4px;
  background: #f8f9fc;
  color: #222;
  width: 36px;
  height: 36px;
  cursor: pointer;
}

.kmw-task-calendar-title {
  font-weight: 600;
  font-size: 16px;
}

.kmw-task-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.kmw-dashboard-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.kmw-dashboard-stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid #e6eef7;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  text-decoration: none !important;
  color: inherit;
  min-height: 110px;
  justify-content: space-between;
}

.kmw-dashboard-stat:hover {
  border-color: #cfdaf0;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.kmw-dashboard-stat-label {
  font-size: 13px;
  color: #6b7280;
}

.kmw-dashboard-stat-value {
  font-size: 30px;
  line-height: 1;
  font-weight: 700;
  color: #111827;
}

.kmw-dashboard-stat-value-warn {
  color: #b45309;
}

.kmw-dashboard-stat-value-info {
  color: #0f766e;
}

.kmw-dashboard-stat-link {
  font-size: 13px;
  color: #0a66c2;
  font-weight: 600;
}

.kmw-dashboard-panel {
  width: 100%;
  background: #fff;
  border: 1px solid #e6eef7;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  margin-bottom: 18px;
}

.kmw-dashboard-panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 18px 20px 0;
}

.kmw-dashboard-panel-title {
  font-size: 18px;
  margin: 0 0 4px;
}

.kmw-dashboard-panel-subtitle {
  font-size: 13px;
  color: #6b7280;
}

.kmw-dashboard-panel-body {
  padding: 12px 20px 20px;
}

.kmw-dashboard-panel-body .kas-table-list {
  width: 100%;
}

.kmw-dashboard-panel-body .kas-table-list-toolbar {
  margin-top: 0;
}

@media (max-width: 1200px) {
  .kmw-dashboard-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .kmw-dashboard-stats {
    grid-template-columns: 1fr;
  }

  .kmw-dashboard-panel-header,
  .kmw-dashboard-panel-body {
    padding-left: 16px;
    padding-right: 16px;
  }
}

.kmw-task-calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  margin-bottom: 6px;
  color: #4a5568;
  font-size: 12px;
  font-weight: 600;
}

.kmw-calendar-tile {
  position: relative;
  overflow: visible;
  min-height: 78px;
  padding: 8px;
  border: 1px solid #e0e4ee;
  border-radius: 6px;
  background: #fdfdff;
  color: #1f2937;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.kmw-calendar-tile:hover {
  border-color: #8fa6e7;
  background-color: #eff3ff;
}

.kmw-calendar-tile.kmw-calendar-tile-outside {
  color:  #aaa;
  background-color: #fafbff;
}

.kmw-calendar-tile.kmw-calendar-tile-disabled {
  background-color: #eff1f5;
  cursor: not-allowed;
}

.kmw-calendar-tile.kmw-calendar-tile-disabled .kmw-day-add {
  display: none;
}

.kmw-calendar-tile.kmw-calendar-tile-disabled .kmw-day-number {
  color: #6b7280;
}

.kmw-calendar-tile .kmw-day-number {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.kmw-day-add {
  display: none;
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid #0a66c2;
  background: #fff;
  color: #0a66c2;
  text-decoration: none !important;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}

.kmw-calendar-tile:hover .kmw-day-add,
.kmw-calendar-tile.kmw-popover-open .kmw-day-add {
  display: block;
}

.kmw-calendar-tile .kmw-day-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  color: #fff;
  background: #0a66c2;
  padding: 0 5px;
}

.kmw-day-popover {
  display: none;
  position: absolute;
  left: 0;
  right: auto;
  top: 100%;
  z-index: 10;
  min-width: 220px;
  max-width: 360px;
  width: auto;
  background: #ffffff;
  border: 1px solid #d7dbe7;
  border-radius: 6px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.06);
  margin-top: 6px;
  padding: 8px;
  font-size: 12px;
  text-align: left;
  max-height: 150px;
  overflow-y: auto;
  white-space: normal;
}

.kmw-calendar-tile.kmw-popover-open .kmw-day-popover {
  display: block;
}

.kas-card {
  width: 100%;
  background: #fff;
  border: 1px solid #e6eef7;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  margin-bottom: 18px;
  overflow: hidden;
}

.kas-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 18px 20px 0;
}

.kas-card-title {
  font-size: 18px;
  margin: 0 0 4px;
}

.kas-card-subtitle {
  font-size: 13px;
  color: #6b7280;
}

.kas-card-body {
  padding: 16px 20px 20px;
}

.kas-card-body-table {
  padding-top: 8px;
}

.kas-card-body-table .kas-table-list {
  width: 100%;
}

.kas-card-body-table .kas-table-list-toolbar {
  margin: 10px 0 12px;
}

.kmw-day-popover .item {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  color: #1f2937;
  min-width: 0;
  white-space: nowrap;
}

.kmw-day-popover .item:last-child {
  margin-bottom: 0;
}

.kmw-day-popover .item-title {
  display: block;
  flex: 1;
  min-width: 0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 900px) {
  .kmw-task-calendar-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  .kmw-task-calendar-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .kmw-tile-row {
    flex-direction: column;
    align-items: stretch;
    padding: 10px 4px;
  }
  .kmw-tile-col {
    width: 100% !important;
    margin-bottom: 8px;
    text-align: left !important;
  }
  .kmw-tile-col:last-child {
    margin-bottom: 0;
  }
}

/* Progress timeline for tasks */
.kmw-task-progress-timeline {
  position: relative;
  margin: 20px 0 8px 0;
  padding-left: 36px;
}
.kmw-task-progress-timeline::before {
  content: '';
  position: absolute;
  left: 18px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, #e6eefc 0%, #d7e6fb 100%);
  border-radius: 2px;
}
.kmw-task-progress-item {
  position: relative;
  margin: 8px 0 20px 0;
  padding: 10px 14px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(15,23,42,0.04);
  border: 1px solid rgba(16,24,40,0.04);
}
.kmw-task-progress-item::before {
  content: '';
  position: absolute;
  left: -27px;
  top: 18px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #9fbff6;
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(16,24,40,0.08);
}
.kmw-task-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.kmw-task-progress-header strong {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}
.kmw-task-progress-timestamp {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
}
.kmw-task-progress-description {
  margin-top: 8px;
  font-size: 13px;
  color: #253244;
  line-height: 1.45;
}

/* Delete button for progress items */
.kmw-progress-edit,
.kmw-progress-delete {
  background: transparent;
  border: none;
  color: #c53030;
  fill: #c53030;
  font-size: 14px;
  line-height: 1;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
}

.kmw-progress-edit {
  color: #000;
  fill: #000;
}

.kmw-progress-delete:hover {
  background: rgba(197,48,48,0.06);
}
.kmw-progress-edit:hover {
  background: rgba(49,130,206,0.06);
}

.kmw-progress-delete:focus { outline: 2px solid rgba(59,130,246,0.12); }
.kmw-progress-edit:focus { outline: 2px solid rgba(59,130,246,0.12); }

/* Color variants for dots: apply classes if needed */
.kmw-task-progress-item.maintenance::before { background: #2ecc71; }
.kmw-task-progress-item.improvement::before { background: #3498db; }
.kmw-task-progress-item.incident::before { background: #e74c3c; }
.kmw-task-progress-item.other::before { background: #95a5a6; }

/* Subtle highlight for items created by the current user */
.kmw-task-progress-item-by-me {
  /* background: linear-gradient(180deg, #f5faff 0%, #ffffff 100%); */
  border-color: rgba(59,130,246,0.10);
  box-shadow: 0 8px 20px rgba(59,130,246,0.04);
}
.kmw-task-progress-item-by-me::before {
  background: #3b82f6;
  box-shadow: 0 2px 8px rgba(59,130,246,0.12);
}
.kmw-task-progress-item-by-me .kmw-task-progress-header strong {
  color: #0b4fd6;
}
.kmw-notification-wrapper {
  position: relative;
  display: inline-block;
  margin-right: 16px;
}

.kmw-notification-toggle {
  border: 1px solid #c5cde5;
  border-radius: 999px;
  background: #fff;
  color: #0f172a;
  font-weight: 600;
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
}

.kmw-notification-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 0 6px;
}

.kmw-notification-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 390px;
  max-height: 420px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.18);
  z-index: 99;
  overflow: hidden;
}

.kmw-notification-popover-title {
  padding: 12px;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
  font-weight: 700;
  font-size: 14px;
}

.kmw-notification-list {
  max-height: 340px;
  overflow-y: auto;
  padding: 8px 0;
}

.kmw-notification-item {
  border-bottom: 1px solid #eff2f7;
}

.kmw-notification-item:last-child {
  border-bottom: none;
}

.kmw-notification-item-title {
  width: 100%;
  background: transparent;
  border: none;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 12px;
  cursor: pointer;
  text-align: left;
}

.kmw-notification-item-title-text {
  font-size: 13px;
  color: #0f172a;
  font-weight: normal;
}

.kmw-notification-item-unread .kmw-notification-item-title-text {
  font-weight: 700;
}

.kmw-notification-item-date {
  color: #6b7280;
  font-size: 11px;
  white-space: nowrap;
}

.kmw-notification-item-body {
  padding: 8px 12px 12px;
  font-size: 13px;
  color: #334155;
  background: #f8fafc;
}

.kmw-notification-empty {
  padding: 14px 18px;
  font-size: 13px;
  color: #64748b;
}

.kmw-notification-see-all {
  border-top: 1px solid #e5e7eb;
  padding: 8px 12px;
  text-align: right;
  background: #f8fafc;
}

.kmw-notification-see-all a {
  font-size: 12px;
  color: #0f62fe;
  text-decoration: none;
}

.kmw-notification-see-all a:hover {
  text-decoration: underline;
}
/* Compact / mobile adjustments */
@media (max-width: 720px) {
  .kmw-task-progress-timeline { padding-left: 18px; }
  .kmw-task-progress-timeline::before { left: 9px; }
  .kmw-task-progress-item { padding: 12px 12px 12px 46px; }
  .kmw-task-progress-item::before { left: -27px; top: 20px; }
  .kmw-task-progress-header { flex-direction: column; align-items: flex-start; }
  .kmw-task-progress-timestamp { margin-top: 6px; }
}

@media (max-width: 420px) {
  .kmw-task-progress-timeline { padding-left: 12px; }
  .kmw-task-progress-timeline::before { display: none; }
  .kmw-task-progress-item { padding: 12px; margin-left: 0; }
  .kmw-task-progress-item::before { left: 12px; top: 12px; }
}
