/* =========================================
   МОДУЛЬ CTA: УМНЫЙ ВЫБОР ЦВЕТА И РАСЧЕТ
========================================= */

.cta-advanced-module {
    background: #ffffff;
    padding: 35px 40px;
    border-radius: 12px;
    border: 1px solid #eeeeee;
    box-shadow: 0 10px 30px rgba(0,0,0,0.04);
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
}

.cta-advanced-module::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url('/assets/img/logo_watermark.svg');
    background-repeat: no-repeat;
    background-position: right -50px bottom -50px;
    background-size: 300px;
    opacity: 0.02;
    z-index: 0;
    pointer-events: none;
}

.cta-intro-section {
    position: relative;
    z-index: 1;
}

.cta-intro-section h3 {
    font-family: 'Playfair Display', serif;
    font-size: 26px;
    font-weight: 700;
    color: #4a3c5a;
    margin: 0 0 15px 0;
    line-height: 1.2;
}

.cta-highlight-text {
    font-size: 14px;
    font-weight: 600;
    color: #333333;
    background: #fcf9fa;
    padding: 12px 15px;
    border-left: 4px solid #936098;
    border-radius: 4px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.cta-palette-section {
    position: relative;
    z-index: 1;
    margin-top: 15px;
}

.cta-palette-section h4, .cta-brands-section h4 {
    font-size: 16px;
    font-weight: 700;
    color: #333333;
    margin: 0 0 15px 0;
}

.std-colors-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.std-color-btn {
    width: 45px;
    height: 45px;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.std-color-btn:hover {
    transform: scale(1.1);
}

.std-color-btn.active {
    transform: scale(1.1);
    border-color: #333333;
    box-shadow: 0 0 0 3px #ffffff inset, 0 4px 10px rgba(0,0,0,0.15);
}

.cta-brands-section {
    position: relative;
    z-index: 1;
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px dashed #dddddd;
}

.cta-brand-block {
    margin-bottom: 30px;
    background: #fdfafb;
    padding: 25px 20px 20px 20px;
    border-radius: 8px;
    border: 1px solid #f2eef0;
    overflow: hidden; 
}

.cta-brand-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.cta-brand-title {
    font-family: 'Playfair Display', serif;
    font-size: 16px;
    font-weight: 800;
    color: #936098;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.cta-country-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #555555;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.cta-country-badge .flag {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* --- СЕТКА 7 В РЯД БЕЗ ВЫПАДЕНИЙ ЗА КРАЯ --- */
.cta-colors-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr)); 
    gap: 8px; 
    align-items: start;
    justify-items: center;
    padding-top: 15px;
    padding-bottom: 10px;
    width: 100%;
}

.cta-swatch-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    position: relative;
    width: 100%;
    min-width: 0; 
}

.cta-swatch-item.hidden {
    display: none !important;
}

.cta-color-circle-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 65px; 
    margin-top: 5px;
}

/* ОБОДКИ: Идеальное математическое центрирование */
.cta-curved-badge-container {
    position: absolute;
    top: 50%; 
    left: 50%;
    /* Фиксируем центрирование через margin */
    margin-top: -80px; 
    margin-left: -80px;
    width: 160px; 
    height: 160px; 
    pointer-events: none; 
    z-index: 10;
    /* Уменьшаем ободок так, чтобы он был на 1px больше круга 40px */
    transform: scale(0.35); 
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes ctaSpinOrbit {
    0% { transform: scale(0.53) rotate(0deg); }
    100% { transform: scale(0.53) rotate(360deg); }
}

@keyframes ctaSpinOrbitLarge {
    0% { transform: scale(0.68) rotate(0deg); }
    100% { transform: scale(0.68) rotate(360deg); }
}

.cta-curved-badge-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
    transform-origin: 50% 50%;
    display: block;
}

/* При наведении ободок пропорционально растет вместе с кругом (под 65px) */
.cta-swatch-item:hover .cta-curved-badge-container,
.cta-swatch-item.active .cta-curved-badge-container {
    transform: scale(0.53); 
}

.cta-swatch-item:hover .cta-curved-badge-svg,
.cta-swatch-item.active .cta-curved-badge-svg {
    animation: ctaSpinOrbit 2.5s linear infinite;
}

/* КРУЖКИ: Защита от овалов (flex-shrink: 0, min-width) */
.cta-color-circle {
    width: 40px; 
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: 50% !important; 
    background-color: #f5f5f5;
    border: 2px solid transparent;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: relative;
    z-index: 2;
    overflow: hidden !important; 
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0 !important; 
}

.cta-color-circle img {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important; 
    border-radius: 50% !important; 
    display: block; /* УБРАН !important ДЛЯ РАБОТЫ ONERROR */
    pointer-events: none;
}

/* Увеличение при наведении */
.cta-swatch-item:hover .cta-color-circle {
    width: 65px;
    height: 65px;
    min-width: 65px;
    min-height: 65px;
    z-index: 10;
    border-color: #df1b53;
    box-shadow: 0 8px 20px rgba(223, 27, 83, 0.3);
}

.cta-swatch-item.active .cta-color-circle {
    border-color: #df1b53; 
    width: 65px;
    height: 65px;
    min-width: 65px;
    min-height: 65px;
    box-shadow: 0 0 0 3px #fff inset, 0 8px 20px rgba(223, 27, 83, 0.3);
}

.cta-color-name {
    font-size: 10px;
    color: #333333;
    font-weight: 700;
    line-height: 1.1;
    margin-top: 4px;
    transition: color 0.3s;
}

.cta-swatch-item:hover .cta-color-name { color: #df1b53; }

.cta-color-code {
    font-size: 9px;
    color: #888888;
    margin-top: 2px;
}

/* =========================================
   УКРУПНЕННЫЙ ВИД (ПРИ АКТИВНОМ ФИЛЬТРЕ ЦВЕТА)
========================================= */
.cta-colors-grid.filtered-view {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 15px;
}

.cta-colors-grid.filtered-view .cta-color-circle-wrapper {
    height: 85px;
}

.cta-colors-grid.filtered-view .cta-color-circle {
    width: 60px;
    height: 60px;
    min-width: 60px;
    min-height: 60px;
}

.cta-colors-grid.filtered-view .cta-swatch-item:hover .cta-color-circle,
.cta-colors-grid.filtered-view .cta-swatch-item.active .cta-color-circle {
    width: 85px;
    height: 85px;
    min-width: 85px;
    min-height: 85px;
}

/* Математический перерасчет ободка для фильтрованного вида */
.cta-colors-grid.filtered-view .cta-curved-badge-container {
    transform: scale(0.49); 
}

.cta-colors-grid.filtered-view .cta-swatch-item:hover .cta-curved-badge-container,
.cta-colors-grid.filtered-view .cta-swatch-item.active .cta-curved-badge-container {
    transform: scale(0.68); 
}

.cta-colors-grid.filtered-view .cta-swatch-item:hover .cta-curved-badge-svg,
.cta-colors-grid.filtered-view .cta-swatch-item.active .cta-curved-badge-svg {
    animation: ctaSpinOrbitLarge 2.5s linear infinite;
}

.cta-colors-grid.filtered-view .cta-color-name {
    font-size: 12px;
}

/* --- СООБЩЕНИЕ ОБ УСПЕХЕ --- */
.cta-success-section {
    margin-top: 25px;
    padding: 15px 20px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #047857;
    font-weight: 600;
    font-size: 15px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.cta-success-section.visible {
    opacity: 1;
    transform: translateY(0);
}

.cta-success-section svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

/* АДАПТИВНОСТЬ */
@media screen and (max-width: 992px) { 
    .cta-colors-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } 
    .cta-colors-grid.filtered-view { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media screen and (max-width: 576px) { 
    .cta-colors-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } 
    .cta-colors-grid.filtered-view { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media screen and (max-width: 480px) { 
    .cta-colors-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } 
    .cta-colors-grid.filtered-view { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}