/* ============================================
   Виджет визуализации нарядов
   Используется на pages/vizualizatsiya.html
   ============================================ */

/* ===== Hero на главной — двухколоночный с CTA на виджет ===== */
.hero.hero-split {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 32px;
  align-items: center;
}

.hero-main {
  position: relative;
  z-index: 1;
}

.hero-cta {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(245, 166, 35, 0.7);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  color: #fff;
  text-decoration: none;
  backdrop-filter: blur(6px);
  transition: var(--transition);
}

.hero-cta:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: var(--color-accent);
  transform: translateY(-2px);
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.hero-cta-icon {
  font-size: 38px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.hero-cta-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.hero-cta-title {
  font-size: 17px;
  font-weight: 800;
  line-height: 1.25;
  color: #fff;
}

.hero-cta-sub {
  font-size: 12.5px;
  opacity: 0.85;
  line-height: 1.4;
}

.hero-cta-arrow {
  font-size: 22px;
  color: var(--color-accent);
  font-weight: 700;
  transition: var(--transition);
}

.hero-cta:hover .hero-cta-arrow {
  transform: translateX(4px);
}

@media (max-width: 900px) {
  .hero.hero-split {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

/* ===== Пошаговая инструкция для новичков ===== */
.viz-howto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.viz-howto-step {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-accent);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.viz-howto-num {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: var(--color-accent);
  color: var(--color-primary-dark);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 800;
}

.viz-howto-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.viz-howto-body strong {
  font-size: 14px;
  color: var(--color-text);
  font-weight: 700;
}

.viz-howto-body span {
  font-size: 12.5px;
  color: var(--color-text-muted);
  line-height: 1.45;
}

/* ===== Контекст сделки (верхняя плашка) ===== */
.viz-context {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  margin-bottom: 20px;
}

.viz-context-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.viz-context-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.viz-context-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
}

.viz-context select,
.viz-context input {
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--color-surface);
  color: var(--color-text);
  width: 100%;
}

.viz-context select:focus,
.viz-context input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.08);
}

/* ===== Сетка слотов ===== */
.viz-grid-wrap {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px;
  overflow-x: auto;
}

.viz-grid-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.viz-grid-nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.viz-grid-nav button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.viz-grid-nav button:hover {
  background: var(--color-surface-2);
  border-color: var(--color-primary-light);
}

.viz-grid-range {
  font-weight: 600;
  font-size: 15px;
  color: var(--color-text);
}

.viz-grid {
  display: grid;
  grid-template-columns: 76px repeat(7, minmax(100px, 1fr));
  gap: 5px;
  min-width: 780px;
}

.viz-cell {
  padding: 12px 6px;
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 13px;
  position: relative;
  transition: var(--transition);
  min-height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.viz-slot-main {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.1;
}

.viz-slot-sub {
  font-size: 10.5px;
  font-weight: 500;
  opacity: 0.85;
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

.viz-cell.viz-th {
  background: var(--color-surface-2);
  font-weight: 700;
  font-size: 12px;
  color: var(--color-text);
  padding: 8px 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.viz-cell.viz-th .viz-th-day {
  display: block;
  font-size: 18px;
  font-weight: 700;
  margin-top: 2px;
  text-transform: none;
  letter-spacing: 0;
}

.viz-cell.viz-time {
  background: var(--color-surface-2);
  font-weight: 600;
  color: var(--color-text-muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.viz-cell.viz-slot {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  cursor: pointer;
  user-select: none;
}

.viz-cell.viz-slot-free {
  background: rgba(46, 164, 79, 0.08);
  border-color: rgba(46, 164, 79, 0.3);
  color: var(--color-success);
  font-weight: 700;
}

.viz-cell.viz-slot-free:hover {
  background: rgba(46, 164, 79, 0.18);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.viz-cell.viz-slot-recommended {
  background: rgba(245, 166, 35, 0.14);
  border-color: var(--color-accent);
  color: var(--color-accent-dark);
  font-weight: 700;
}

.viz-cell.viz-slot-recommended:hover {
  background: rgba(245, 166, 35, 0.24);
  transform: translateY(-1px);
}

.viz-cell.viz-slot-busy {
  background: var(--color-surface-2);
  border-color: var(--color-border);
  color: var(--color-text-light);
  cursor: not-allowed;
  opacity: 0.7;
}

.viz-cell.viz-slot-off {
  background: repeating-linear-gradient(
    45deg,
    var(--color-surface-2),
    var(--color-surface-2) 6px,
    var(--color-bg) 6px,
    var(--color-bg) 12px
  );
  border-color: var(--color-border);
  color: var(--color-text-light);
  cursor: not-allowed;
}

.viz-cell.viz-slot-selected {
  background: var(--color-primary);
  border-color: var(--color-primary-dark);
  color: #fff;
  font-weight: 700;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.viz-cell.viz-slot-pending {
  background: rgba(251, 191, 36, 0.22);
  border-color: var(--color-warning);
  color: #92400e;
  font-weight: 700;
}

.viz-cell-mark {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 10px;
  font-weight: 800;
}

/* ===== Легенда ===== */
.viz-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--color-border);
  font-size: 12px;
  color: var(--color-text-muted);
}

.viz-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.viz-legend-chip {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid var(--color-border);
}

.viz-legend-chip.free { background: rgba(46, 164, 79, 0.2); border-color: rgba(46, 164, 79, 0.4); }
.viz-legend-chip.recommended { background: rgba(245, 166, 35, 0.3); border-color: var(--color-accent); }
.viz-legend-chip.pending { background: rgba(251, 191, 36, 0.3); border-color: var(--color-warning); }
.viz-legend-chip.busy { background: var(--color-surface-2); }
.viz-legend-chip.off {
  background: repeating-linear-gradient(45deg, var(--color-surface-2), var(--color-surface-2) 3px, var(--color-bg) 3px, var(--color-bg) 6px);
}

/* ===== Панель действий ===== */
.viz-action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  margin-top: 16px;
  gap: 16px;
  flex-wrap: wrap;
}

.viz-action-info {
  flex: 1;
  font-size: 14px;
  color: var(--color-text);
}

.viz-action-info strong {
  color: var(--color-primary);
}

.viz-action-info .viz-rec-note {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--color-accent-dark);
}

/* ===== Список броней (для Ульяны) ===== */
.viz-bookings-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.viz-booking-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-warning);
  border-radius: var(--radius-md);
  padding: 16px 20px;
}

.viz-booking-card.viz-booking-assigned {
  border-left-color: var(--color-success);
}

.viz-booking-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 12px;
  flex-wrap: wrap;
}

.viz-booking-when {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
}

.viz-booking-jk {
  font-size: 14px;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}

.viz-booking-recs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.viz-booking-rec {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--color-surface-2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  gap: 12px;
}

.viz-eng-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.viz-eng-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.viz-booking-rec-note {
  flex: 1;
  color: var(--color-text-muted);
  font-size: 12px;
}

.viz-booking-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== Сводка дня (таблица инженер × время) ===== */
.viz-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--color-surface);
}

.viz-summary-table th,
.viz-summary-table td {
  padding: 8px 10px;
  text-align: center;
  border: 1px solid var(--color-border);
  vertical-align: top;
}

.viz-summary-table th {
  background: var(--color-surface-2);
  font-weight: 700;
  font-size: 12px;
}

.viz-summary-table th.viz-eng-col {
  text-align: left;
  background: var(--color-surface-2);
}

.viz-summary-table td.viz-eng-col {
  text-align: left;
  font-weight: 600;
  background: var(--color-surface);
  min-width: 160px;
}

.viz-summary-cell {
  font-size: 11px;
  line-height: 1.3;
  padding: 6px 4px;
  min-height: 40px;
}

.viz-summary-cell-busy {
  font-weight: 700;
}

.viz-summary-load {
  font-size: 11px;
  font-weight: 700;
  margin-top: 2px;
}

.viz-summary-load.high {
  color: var(--color-danger);
}

.viz-summary-load.med {
  color: var(--color-accent-dark);
}

.viz-summary-load.low {
  color: var(--color-success);
}

/* ===== Модалка ===== */
.viz-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 9000;
  backdrop-filter: blur(2px);
}

.viz-modal-backdrop.open { display: block; }

.viz-modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(480px, calc(100vw - 32px));
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 28px;
  z-index: 9001;
  border: 1px solid var(--color-border);
}

.viz-modal.open { display: block; }

.viz-modal h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.viz-modal-body {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 20px;
}

.viz-modal-body dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 16px;
  margin: 12px 0;
}

.viz-modal-body dt {
  font-weight: 600;
  color: var(--color-text-muted);
}

.viz-modal-body dd {
  color: var(--color-text);
}

.viz-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ===== Тёмная тема — корректировки ===== */
[data-theme="dark"] .viz-cell.viz-slot-free {
  background: rgba(46, 164, 79, 0.14);
}

[data-theme="dark"] .viz-cell.viz-slot-recommended {
  background: rgba(245, 166, 35, 0.2);
}

[data-theme="dark"] .viz-cell.viz-slot-pending {
  background: rgba(251, 191, 36, 0.3);
  color: #fde68a;
}

[data-theme="dark"] .viz-cell.viz-slot-off {
  background: repeating-linear-gradient(
    45deg,
    var(--color-surface-2),
    var(--color-surface-2) 6px,
    var(--color-bg) 6px,
    var(--color-bg) 12px
  );
}

/* ===== Мобильный адаптив ===== */
@media (max-width: 700px) {
  .viz-grid {
    grid-template-columns: 56px repeat(7, minmax(60px, 1fr));
    min-width: 540px;
  }
  .viz-cell { padding: 8px 4px; font-size: 12px; }
  .viz-cell.viz-th .viz-th-day { font-size: 14px; }
}
