/* ==========================================
   Калькулятор стоимости — специфичные стили
   calc-cost.css (зависит от calc-base.css)
   ========================================== */

/* --- Таблица материалов --- */
.cc-calc-table {
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  overflow: hidden;
}

.cc-calc-table__head {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 32px;
  gap: 0;
  background: rgba(102,126,234,0.06);
  border-bottom: 1px solid #e8e8e8;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #667eea;
}

.cc-calc-table__row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 32px;
  gap: 0;
  padding: 8px 16px;
  border-bottom: 1px solid #f0f0f0;
  align-items: center;
  transition: background 0.2s ease;
}

.cc-calc-table__row:last-of-type {
  border-bottom: none;
}

.cc-calc-table__row:hover {
  background: #fafbff;
}

.cc-calc-table__row--warning {
  background: #fffdf0 !important;
}

.cc-calc-table__cell {
  padding: 0 6px 0 0;
}

.cc-calc-table__cell:last-of-type {
  padding: 0;
}

.cc-calc-table__cell .cc-calc-input {
  padding: 10px 12px;
  font-size: 14px;
  border-radius: 8px;
}

.cc-calc-input--name {
  font-weight: 500;
}

.cc-calc-table__del {
  color: #dc3545;
  font-size: 16px;
  cursor: pointer;
  text-align: center;
  opacity: 0.5;
  transition: opacity 0.2s ease;
  user-select: none;
  line-height: 1;
}

.cc-calc-table__del:hover {
  opacity: 1;
}

.cc-calc-table__footer {
  padding: 12px 16px;
  border-top: 1px solid #f0f0f0;
}

.cc-calc-add-btn {
  background: none;
  border: 1px dashed rgba(102,126,234,0.4);
  border-radius: 8px;
  color: #667eea;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Montserrat', sans-serif;
  padding: 10px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.cc-calc-add-btn:hover {
  background: rgba(102,126,234,0.04);
  border-color: #667eea;
}

.cc-calc-add-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.cc-calc-table__row-warning {
  grid-column: 1 / -1;
  font-size: 12px;
  color: #e0a800;
  padding: 4px 0 0;
}

/* --- Наценка --- */
.cc-calc-markup-row {
  position: relative;
}

.cc-calc-markup-row .cc-calc-input--markup {
  padding-right: 40px;
  max-width: 200px;
}

.cc-calc-markup-sign {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  font-weight: 600;
  color: #666;
  pointer-events: none;
}

.cc-calc-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  max-width: 320px;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  outline: none;
  margin-top: 12px;
  cursor: pointer;
}

.cc-calc-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #667eea;
  box-shadow: 0 2px 8px rgba(102,126,234,0.3);
  cursor: pointer;
  transition: box-shadow 0.2s ease;
}

.cc-calc-slider::-webkit-slider-thumb:hover {
  box-shadow: 0 2px 12px rgba(102,126,234,0.5);
}

.cc-calc-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #667eea;
  box-shadow: 0 2px 8px rgba(102,126,234,0.3);
  cursor: pointer;
}

/* --- Мобильная: таблица → карточки --- */
@media (max-width: 768px) {
  .cc-calc-table__head {
    display: none;
  }

  .cc-calc-table__row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px;
    position: relative;
    background: #fafbff;
    border-radius: 12px;
    margin: 0 8px 12px;
    border: 1px solid #e8e8e8;
  }

  .cc-calc-table__row:hover {
    background: #fafbff;
  }

  .cc-calc-table__cell {
    flex: 1 1 45%;
    min-width: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .cc-calc-table__cell .cc-calc-input {
    width: 100%;
  }

  .cc-calc-table__cell::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 600;
    color: #667eea;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .cc-calc-table__cell:nth-child(1) {
    flex: 1 1 100%;
  }

  .cc-calc-table__del {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    border-radius: 50%;
    background: rgba(220,53,69,0.08);
  }

  .cc-calc-add-btn {
    margin: 0 8px 0;
  }
}
