/* Eucerin WTB widget — отступы/типографика по Figma */

.eucerin-widget {
    display: block;
    width: 100%;
    max-width: 250px;
    font-family: Arial, Helvetica, sans-serif;
    color: #333;
    box-sizing: border-box;
}

.eucerin-widget *,
.eucerin-overlay *,
.eucerin-panel-shell *,
.eucerin-widget *::before,
.eucerin-widget *::after {
    box-sizing: border-box;
}

/* —— Кнопка (только для ручного .eucerin-widget, не для PDP CMS) —— */
.eucerin-buy-btn {
    width: 100%;
    background-color: #cc0033;
    color: #f5f5f5;
    padding: 14px 20px;
    border: 1px solid #333;
    font-size: 15px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-family: inherit;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    box-sizing: border-box;
}

.eucerin-buy-btn:hover {
    background-color: #dc143c;
    color: #f5f5f5;
    text-decoration: none;
}

/* —— Overlay —— */
.eucerin-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.eucerin-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

/* —— Панель (база: drawer справа — режим cards) —— */
.eucerin-panel-shell {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    max-width: 375px;
    background: #fff;
    z-index: 999999;
    font-family: Arial, Helvetica, sans-serif;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

.eucerin-panel-shell.open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.eucerin-panel-shell--cards {
    max-width: 375px;
}

/*
 * PREVIEW (главная / листинг) — центрированный попап,
 * как Where to Buy на eucerinus.com (не выезд сбоку).
 */
.eucerin-panel-shell--preview {
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    width: calc(100% - 40px);
    max-width: 520px;
    height: auto;
    max-height: min(88vh, 640px);
    border-radius: 4px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    transform: translate(-50%, -46%) scale(0.96);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s ease;
}

.eucerin-panel-shell--preview.open {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* Шапка: Где купить: → Онлайн магазины → (сортировка) */
.eucerin-drawer-header {
    padding: 32px 24px 0;
    flex-shrink: 0;
}

.eucerin-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin: 0;
    gap: 16px;
}

.eucerin-panel-title {
    margin: 0;
    padding: 0;
    font-size: 18px;
    line-height: 1.3;
    font-weight: 700;
    color: #1a1a1a;
}

.eucerin-close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    margin: -4px 0 0;
    font-weight: 300;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
}

.eucerin-close-btn:hover {
    color: #333;
}

/* Отступ title → subtitle */
.eucerin-subtitle {
    margin: 8px 0 0;
    padding: 0;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 400;
    color: #888;
}

/* Сортировка только в cards: отступ после subtitle */
.eucerin-sorting {
    margin-top: 20px;
}

.eucerin-sorting label {
    display: block;
    font-size: 14px;
    line-height: 1.3;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 8px;
}

.eucerin-sort-select {
    display: block;
    width: auto;
    min-width: 148px;
    max-width: 180px;
    height: 40px;
    padding: 0 32px 0 12px;
    font-size: 14px;
    border: 1px solid #d0d0d0;
    border-radius: 2px;
    background-color: #fff;
    color: #1a1a1a;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23666' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

/* Контент: отступ от шапки до сетки/списка */
.eucerin-drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px 24px 32px;
    -webkit-overflow-scrolling: touch;
}

.eucerin-panel-shell--preview .eucerin-drawer-content {
    padding-top: 20px;
    min-height: 0;
    overflow-y: auto;
}

.eucerin-panel-shell--cards .eucerin-drawer-content {
    padding-top: 20px;
}

.eucerin-status-msg {
    padding: 12px 0;
    color: #888;
    font-size: 14px;
}

.eucerin-logo-fallback {
    font-size: 11px;
    font-weight: 700;
    color: #333;
    text-align: center;
    line-height: 1.2;
}

/* —— PREVIEW: сетка —— */
.eucerin-logo-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 0;
    padding: 0;
}

.eucerin-logo-card {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 64px;
    padding: 12px 10px;
    border: 1px solid #dedede;
    border-radius: 2px;
    background: #fff;
    text-decoration: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.eucerin-logo-card:hover {
    border-color: #c8c8c8;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.eucerin-logo-card img {
    max-width: 100%;
    max-height: 32px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

/* —— CARDS: список в прямоугольниках —— */
.eucerin-retailer-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 12px 14px;
    border: 1px solid #dedede;
    border-radius: 2px;
    margin: 0 0 8px;
    text-decoration: none;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.eucerin-retailer-card:last-child {
    margin-bottom: 0;
}

.eucerin-retailer-card:hover {
    border-color: #c8c8c8;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.eucerin-retailer-link-text {
    font-size: 15px;
    line-height: 1.35;
    color: #1a1a1a;
    text-decoration: none;
    font-weight: 400;
    flex: 1;
    min-width: 0;
    text-align: left;
}

.eucerin-retailer-logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.eucerin-retailer-logo--icon {
    width: 40px;
    height: 40px;
}

.eucerin-retailer-logo--icon img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    display: block;
    border-radius: 50%;
}

/* —— Desktop —— */
@media (min-width: 768px) {
    .eucerin-panel-shell--preview {
        max-width: 560px;
        width: 560px;
        max-height: min(90vh, 680px);
    }

    .eucerin-panel-shell--cards {
        max-width: 420px;
    }

    .eucerin-drawer-header {
        padding: 40px 40px 0;
    }

    .eucerin-panel-title {
        font-size: 20px;
    }

    .eucerin-subtitle {
        margin-top: 8px;
        font-size: 14px;
    }

    .eucerin-sorting {
        margin-top: 24px;
    }

    .eucerin-sorting label {
        font-size: 15px;
    }

    .eucerin-sort-select {
        min-width: 160px;
        max-width: 200px;
        height: 42px;
    }

    .eucerin-drawer-content {
        padding: 28px 40px 40px;
    }

    .eucerin-panel-shell--preview .eucerin-logo-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }

    .eucerin-panel-shell--preview .eucerin-logo-card {
        min-height: 76px;
        padding: 16px 14px;
    }

    .eucerin-panel-shell--preview .eucerin-logo-card img {
        max-height: 36px;
    }

    .eucerin-panel-shell--cards .eucerin-retailer-card {
        min-height: 60px;
        padding: 14px 16px;
        margin-bottom: 10px;
    }

    .eucerin-panel-shell--cards .eucerin-retailer-link-text {
        font-size: 16px;
    }
}
