/**
 * Наши поправки върху шаблона (оригиналният styles.css не се пипа).
 */

/* Галерията на продукта: снимките са квадратни, не се режат */
.tf-product-media-main .item,
.tf-product-media-thumbs .item {
  aspect-ratio: 1 / 1 !important;
  height: auto !important;
  padding-top: 0 !important;
}

.tf-product-media-main .item img,
.tf-product-media-thumbs .item img {
  width: 100% !important;
  height: 100% !important;
  aspect-ratio: 1 / 1 !important;
  object-fit: cover !important;
}

/* Страница за поръчка */
.checkout-field { margin-bottom: 16px; }
.checkout-field label { display: block; margin-bottom: 6px; font-size: 14px; }
.checkout-field input,
.checkout-field textarea {
    width: 100%;
    border: 1px solid #e5e5e5;
    border-radius: 3px;
    padding: 11px 14px;
    font-size: 15px;
}
.checkout-error { color: #db1215; font-size: 13px; margin-top: 4px; }
.checkout-summary { border: 1px solid #e5e5e5; border-radius: 3px; padding: 24px; }
.checkout-line { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid #f0f0f0; }
.checkout-total { font-weight: 600; font-size: 18px; border-bottom: 0; }

/* Страници и новини */
.page-hero { margin-bottom: 32px; }
.page-hero img { width: 100%; height: auto; display: block; border-radius: 3px; }
.page-text { margin-bottom: 32px; line-height: 1.7; }
.page-text img { max-width: 100%; height: auto; }
.page-section { display: flex; align-items: center; gap: 40px; margin-bottom: 48px; }
.page-section > * { flex: 1 1 0; min-width: 0; }
.page-section-image img { width: 100%; height: auto; display: block; border-radius: 3px; }
.page-section-title { margin-bottom: 16px; }
.page-section.is-stacked { flex-direction: column; align-items: stretch; gap: 24px; }
.page-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 32px; }
.page-gallery-item { display: block; }
.page-gallery-item img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; border-radius: 3px; }
.page-gallery-item span { display: block; margin-top: 6px; font-size: 14px; }
.news-card-image img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; border-radius: 3px; }
.news-card-body { padding-top: 14px; }
.news-card-date { font-size: 13px; opacity: .7; margin-bottom: 6px; }
.news-card-title { display: block; font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.news-article { max-width: 820px; margin: 0 auto; }
@media (max-width: 767px) {
    .page-section { flex-direction: column; align-items: stretch; gap: 20px; }
}

/* Профил */
.account-nav { list-style: none; margin: 0; padding: 0; }
.account-nav li { margin-bottom: 8px; }
.account-nav a, .account-logout { display: block; padding: 8px 0; background: none; border: 0; color: inherit; text-align: left; cursor: pointer; font-size: inherit; }
.account-nav a.active { font-weight: 600; text-decoration: underline; }
.account-table { width: 100%; border-collapse: collapse; margin-bottom: 24px; }
.account-table th, .account-table td { padding: 12px 10px; border-bottom: 1px solid #e5e5e5; text-align: left; }
.account-status { background: #e8f5e9; border: 1px solid #c8e6c9; padding: 10px 14px; border-radius: 3px; margin-bottom: 20px; max-width: 520px; }

/* Заглавие на тизъра: пренася се на няколко реда според дължината */
.tf-slideshow .slide-title {
    white-space: normal !important;
    max-width: min(100%, 720px);
    line-height: 1.15 !important;
    overflow-wrap: break-word;
    text-wrap: balance;
}
.tf-slideshow .slide-title.is-medium { font-size: clamp(30px, 4vw, 56px) !important; }
.tf-slideshow .slide-title.is-long { font-size: clamp(26px, 3.2vw, 44px) !important; }

/* Кратко описание на тизъра: същата логика като заглавието */
.tf-slideshow .slide-desc {
    white-space: normal !important;
    max-width: min(100%, 640px);
    line-height: 1.4 !important;
    overflow-wrap: break-word;
    text-wrap: balance;
}
.tf-slideshow .slide-desc.is-medium { font-size: clamp(15px, 1.5vw, 18px) !important; }
.tf-slideshow .slide-desc.is-long { font-size: clamp(14px, 1.3vw, 16px) !important; }

/* Мобилна версия: ширината идва от екрана, не от родителите в шаблона */
@media (max-width: 991px) {
    .tf-slideshow .slide-title,
    .tf-slideshow .slide-desc {
        width: calc(100vw - 40px) !important;
        max-width: calc(100vw - 40px) !important;
        white-space: normal !important;
        word-break: normal;
        overflow-wrap: anywhere;
    }
    .tf-slideshow .box-content .container {
        white-space: normal !important;
    }
}

/* Бърза поръчка на страницата на продукта */
.quick-order { margin-top: 24px; padding: 22px; border: 1px solid #cfcfcf; border-radius: 6px; background: #fafafa; }
.quick-order-title { font-weight: 600; font-size: 16px; margin-bottom: 6px; }
.quick-order-text { margin-bottom: 16px; font-size: 13px; opacity: .8; }
.quick-order form { display: flex; flex-direction: column; gap: 14px; }
.quick-order input { width: 100%; border: 1px solid #d9d9d9; border-radius: 3px; padding: 11px 14px; font-size: 15px; background: #fff; }
.quick-order form button { margin-top: 10px; }
.quick-order-popup { padding: 8px 28px 32px; text-align: center; }
.quick-order-popup p { font-size: 17px; line-height: 1.5; margin-bottom: 22px; }

/* Подсказка за доставката */
.checkout-hint { font-size: 13px; opacity: .75; margin: 4px 0 10px; }

/* Размери под продукта в картата: по-малки на мобилно */
@media (max-width: 767px) {
    .card-product .list-size-product,
    .list-size-product {
        gap: 1px !important;
        margin-top: 4px !important;
        margin-bottom: 4px !important;
        padding: 0 !important;
        flex-wrap: wrap;
    }
    .card-product .list-size-product li,
    .list-size-product li {
        padding: 0 1px !important;
        margin: 0 !important;
        line-height: 1.3 !important;
        min-width: 0 !important;
    }
    .card-product .list-size-product li,
    .card-product .list-size-product li .swatch-value,
    .list-size-product li,
    .list-size-product li .swatch-value {
        font-size: 10px !important;
    }
}

/* Плочки с категории на началната страница: по-малки на мобилно */
@media (max-width: 767px) {
    .collection-item .collection-content {
        left: 10px !important;
        right: 10px !important;
        bottom: 10px !important;
        width: auto !important;
        max-width: calc(100% - 20px) !important;
    }
    .collection-item .collection-content .collection-title,
    .collection-item .collection-title.tf-btn {
        font-size: 12px !important;
        line-height: 1.3 !important;
        padding: 8px 12px !important;
        gap: 6px !important;
        min-width: 0 !important;
        max-width: 100% !important;
        width: auto !important;
        white-space: normal !important;
        word-break: normal;
        overflow-wrap: anywhere;
    }
    .collection-item .collection-title .icon {
        font-size: 10px !important;
        flex-shrink: 0;
    }
}
