/*
  TM AI Visualizer — fixed CSS for Bitrix/Aspro template
  Replace /upload/tm_ai_visualizer/assets/css/tm-ai-visualizer.css with this file
*/

.tm-ai-page {
  width: 100%;
  overflow-x: hidden;
}

.tm-ai-visualizer {
  width: 100%;
  background: radial-gradient(circle at top center, rgba(88,155,137,.08), transparent 360px), #f7f5f2;
  padding: 28px 18px 44px;
  box-sizing: border-box;
  font-family: Arial, sans-serif;
  color: #21100f;
  overflow-x: hidden;
}

.tm-ai-visualizer * {
  box-sizing: border-box;
}

.tm-ai-visualizer__inner {
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
}

.tm-ai-visualizer__head {
  text-align: center;
  margin-bottom: 18px;
}

.tm-ai-visualizer__label {
  font-size: 16px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #21100f;
  margin-bottom: 6px;
}

.tm-ai-visualizer__title {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  font-size: clamp(36px, 4.2vw, 64px);
  line-height: .98;
  letter-spacing: -.04em;
  color: #2a1110;
}

.tm-ai-visualizer__subtitle {
  margin: 16px 0 0;
  font-size: clamp(16px, 1.35vw, 22px);
  line-height: 1.35;
  color: #8a8582;
}

.tm-ai-visualizer__panel {
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  gap: 28px;
  width: 100%;
  max-width: 100%;
  background: rgba(255,255,255,.94);
  border-radius: 22px;
  padding: 24px;
  box-shadow: 0 18px 45px rgba(42,17,16,.08);
  overflow: hidden;
}

.tm-ai-visualizer__left {
  min-width: 0;
  padding-right: 24px;
  border-right: 1px solid #e9e3df;
}

.tm-ai-visualizer__right,
.tm-result,
.tm-variants {
  min-width: 0;
}

.tm-upload-step {
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid #eee8e4;
}

.tm-upload-step__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.tm-upload-step__title {
  font-size: 17px;
  font-weight: 700;
}

.tm-upload-step__check {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #d8dedc;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: .5;
  flex: 0 0 26px;
}

.tm-upload-step.is-loaded .tm-upload-step__check {
  background: #589B89;
  opacity: 1;
}

.tm-upload-step__body {
  position: relative;
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
}

.tm-upload-step__preview,
.tm-upload-step__placeholder {
  width: 170px;
  height: 145px;
  border-radius: 9px;
}

.tm-upload-step__preview {
  object-fit: cover;
  display: none;
}

.tm-upload-step.is-loaded .tm-upload-step__preview {
  display: block;
}

.tm-upload-step__placeholder {
  background: #f0ece8;
  border: 1px dashed #cfc7c1;
  color: #9c918b;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px;
}

.tm-upload-step.is-loaded .tm-upload-step__placeholder {
  display: none;
}

.tm-upload-step__info {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.tm-upload-step__icon {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #eef3f2;
  color: #376f66;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.tm-upload-step__status {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 7px;
}

.tm-upload-step__format {
  font-size: 14px;
  color: #4f4a48;
}

.tm-upload-step__input {
  display: none;
}

.tm-upload-step__btn {
  grid-column: 2 / 3;
  width: fit-content;
  min-width: 142px;
  max-width: 100%;
  height: 44px;
  border: 0;
  border-radius: 7px;
  background: #589B89;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  padding: 0 18px;
  white-space: nowrap;
}

.tm-upload-step__btn:hover,
.tm-ai-visualizer__generate:hover {
  background: #4c8a7a;
}

.tm-ai-visualizer__generate {
  width: 100%;
  height: 64px;
  border: 0;
  border-radius: 9px;
  background: #589B89;
  color: #fff;
  font-size: 20px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.tm-ai-visualizer__generate:disabled {
  opacity: .7;
  cursor: wait;
}

.tm-result__title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 14px;
}

.tm-result__image-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: 520px;
  border-radius: 12px;
  overflow: hidden;
  background: #f0ece8;
}

.tm-result__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.tm-result.is-ready .tm-result__image {
  display: block;
}

.tm-result__empty {
  position: absolute;
  inset: 0;
  color: #9c918b;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  font-size: 20px;
}

.tm-result.is-ready .tm-result__empty {
  display: none;
}

.tm-result__bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 28px;
  align-items: start;
  margin-top: 18px;
  width: 100%;
  max-width: 100%;
}

.tm-variants__title,
.tm-download__title {
  font-size: 18px;
  margin-bottom: 14px;
}

.tm-variants__list {
  display: grid;
  grid-template-columns: repeat(5, minmax(72px, 1fr));
  gap: 14px;
  width: 100%;
  max-width: 100%;
}

.tm-variant {
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  text-align: center;
  color: #161010;
  font-size: 13px;
  line-height: 1.25;
}

.tm-variant img {
  width: 100%;
  height: 82px;
  aspect-ratio: auto;
  object-fit: cover;
  border-radius: 10px;
  display: block;
  margin-bottom: 8px;
  border: 2px solid transparent;
  transition: all .2s ease;
}

.tm-variant:hover img {
  transform: translateY(-2px);
}

.tm-variant--active img {
  border-color: #589B89;
  box-shadow: 0 0 0 3px rgba(88,155,137,.18);
}

.tm-variant span {
  display: block;
  font-weight: 500;
}

.tm-download {
  width: 240px;
  min-width: 240px;
  max-width: 100%;
}

.tm-download__btn {
  width: 100%;
  height: 58px;
  border: 0;
  border-radius: 7px;
  background: #eef2f1;
  color: #2b6f63;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 14px;
  white-space: nowrap;
}

.tm-download__btn:hover {
  background: #e3eeeb;
}

.tm-ai-advantages {
  margin-top: 36px;
  margin-bottom: 10px;
}

.tm-ai-advantages__inner {
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  background: rgba(255,255,255,.95);
  border-radius: 22px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  box-shadow: 0 15px 40px rgba(0,0,0,.05);
}

.tm-ai-advantages__promo {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 26px;
  background: linear-gradient(135deg,rgba(88,155,137,.12),rgba(88,155,137,.04));
}

.tm-ai-advantages__promo-icon {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: rgba(88,155,137,.12);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #589B89;
  font-size: 38px;
}

.tm-ai-advantages__promo-title {
  font-family: Georgia, serif;
  font-size: 24px;
  line-height: 1.15;
  color: #2A1110;
  margin-bottom: 8px;
}

.tm-ai-advantages__promo-text {
  color: #666;
  line-height: 1.45;
  font-size: 15px;
}

.tm-ai-advantages__items {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  padding: 26px 30px;
  align-items: center;
}

.tm-ai-advantages__item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: #2A1110;
  font-size: 14px;
  line-height: 1.4;
  min-width: 0;
}

.tm-ai-advantages__check {
  width: 26px;
  height: 26px;
  border: 2px solid #589B89;
  border-radius: 50%;
  color: #589B89;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex: 0 0 26px;
}

@media (max-width: 1400px) {
  .tm-ai-visualizer__inner,
  .tm-ai-advantages__inner {
    max-width: 1280px;
  }

  .tm-ai-visualizer__panel {
    grid-template-columns: 390px minmax(0, 1fr);
    gap: 22px;
    padding: 22px;
  }

  .tm-ai-visualizer__left {
    padding-right: 22px;
  }

  .tm-upload-step__body {
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 18px;
  }

  .tm-upload-step__preview,
  .tm-upload-step__placeholder {
    width: 150px;
    height: 130px;
  }

  .tm-result__image-wrap {
    height: 460px;
  }

  .tm-result__bottom {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .tm-download {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }

  .tm-download__title {
    grid-column: 1 / -1;
    margin-bottom: 0;
  }

  .tm-download__btn {
    margin-bottom: 0;
  }

  .tm-ai-advantages__inner {
    grid-template-columns: 1fr;
  }

  .tm-ai-advantages__items {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .tm-ai-visualizer__panel {
    grid-template-columns: 1fr;
  }

  .tm-ai-visualizer__left {
    border-right: 0;
    border-bottom: 1px solid #e9e3df;
    padding-right: 0;
    padding-bottom: 24px;
  }

  .tm-result__image-wrap {
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .tm-ai-advantages__items {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .tm-ai-visualizer {
    padding: 24px 12px 34px;
  }

  .tm-ai-visualizer__title br,
  .tm-ai-visualizer__subtitle br {
    display: none;
  }

  .tm-ai-visualizer__panel {
    padding: 16px;
    border-radius: 18px;
  }

  .tm-upload-step__body {
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 14px;
  }

  .tm-upload-step__preview,
  .tm-upload-step__placeholder {
    width: 120px;
    height: 120px;
  }

  .tm-upload-step__info {
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 10px;
  }

  .tm-upload-step__icon {
    width: 46px;
    height: 46px;
    font-size: 20px;
  }

  .tm-upload-step__btn {
    grid-column: 1 / -1;
    width: 100%;
    height: 42px;
    font-size: 14px;
  }

  .tm-ai-visualizer__generate {
    height: 58px;
    font-size: 16px;
  }

  .tm-result__image-wrap {
    aspect-ratio: 4 / 3;
  }

  .tm-variants__list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .tm-download {
    display: block;
  }

  .tm-download__btn {
    height: 56px;
    margin-bottom: 12px;
    font-size: 15px;
  }

  .tm-ai-advantages__promo {
    flex-direction: column;
    text-align: center;
    padding: 24px;
  }

  .tm-ai-advantages__promo-title {
    font-size: 24px;
  }

  .tm-ai-advantages__items {
    grid-template-columns: 1fr;
    padding: 24px;
    gap: 20px;
  }
}

@media (max-width: 480px) {
  .tm-ai-visualizer__title {
    font-size: 30px;
  }

  .tm-upload-step__body {
    grid-template-columns: 1fr;
  }

  .tm-upload-step__preview,
  .tm-upload-step__placeholder {
    width: 100%;
    height: 180px;
  }

  .tm-variants__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
