/* ============================================
   HOMEPAGE CUSTOMIZER - Настройка главной страницы
   ============================================ */

/* Модальное окно */
.homepage-customizer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.homepage-customizer-modal.active {
    display: flex;
}

.homepage-customizer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Контент модального окна */
.homepage-customizer-content {
    position: relative;
    z-index: 1;
    background: linear-gradient(145deg, rgba(25, 25, 25, 0.98) 0%, rgba(40, 40, 40, 0.98) 100%);
    border-radius: 24px;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.5),
                0 0 0 1px rgba(255, 140, 0, 0.1);
    animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Заголовок */
.homepage-customizer-header {
    padding: 24px 28px;
    border-bottom: 1px solid rgba(255, 140, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(255, 140, 0, 0.08) 0%, transparent 100%);
}

.homepage-customizer-title {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: var(--white);
    display: flex;
    align-items: center;
    gap: 12px;
}

.customizer-icon {
    font-size: 28px;
    animation: rotate 3s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.customizer-close-btn {
    background: rgba(255, 140, 0, 0.1);
    border: 1px solid rgba(255, 140, 0, 0.2);
    border-radius: 12px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: rgba(255, 255, 255, 0.7);
}

.customizer-close-btn:hover {
    background: rgba(255, 140, 0, 0.2);
    border-color: rgba(255, 140, 0, 0.4);
    color: var(--white);
    transform: rotate(90deg);
}

/* Описание */
.homepage-customizer-description {
    padding: 16px 28px;
    background: rgba(255, 140, 0, 0.05);
    border-bottom: 1px solid rgba(255, 140, 0, 0.1);
}

.homepage-customizer-description p {
    margin: 0;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
}

/* Список блоков */
.homepage-customizer-blocks {
    flex: 1;
    overflow-y: auto;
    padding: 20px 28px;
}

.homepage-customizer-blocks::-webkit-scrollbar {
    width: 8px;
}

.homepage-customizer-blocks::-webkit-scrollbar-track {
    background: rgba(255, 140, 0, 0.05);
    border-radius: 4px;
}

.homepage-customizer-blocks::-webkit-scrollbar-thumb {
    background: rgba(255, 140, 0, 0.3);
    border-radius: 4px;
}

.homepage-customizer-blocks::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 140, 0, 0.5);
}

/* Элемент блока */
.customizer-block-item {
    background: linear-gradient(135deg, rgba(28, 28, 28, 0.9) 0%, rgba(46, 46, 46, 0.9) 100%);
    border: 2px solid rgba(255, 140, 0, 0.15);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: grab;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.customizer-block-item:hover {
    border-color: rgba(255, 140, 0, 0.4);
    transform: translateX(4px);
    box-shadow: 0 4px 20px rgba(255, 140, 0, 0.2);
}

.customizer-block-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
    transform: rotate(3deg) scale(1.02);
}

.customizer-block-item.drag-over {
    border-color: var(--main-color);
    background: rgba(255, 140, 0, 0.1);
    transform: translateY(-2px);
}

.customizer-block-item.disabled {
    opacity: 0.5;
    filter: grayscale(0.7);
}

/* Drag handle */
.customizer-block-drag-handle {
    color: rgba(255, 255, 255, 0.4);
    transition: color 0.3s ease;
    flex-shrink: 0;
}

.customizer-block-item:hover .customizer-block-drag-handle {
    color: var(--main-color);
}

/* Иконка блока */
.customizer-block-icon {
    font-size: 32px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 140, 0, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(255, 140, 0, 0.2);
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.customizer-block-item:hover .customizer-block-icon {
    background: rgba(255, 140, 0, 0.2);
    border-color: rgba(255, 140, 0, 0.4);
    transform: scale(1.1) rotate(-5deg);
}

/* Информация о блоке */
.customizer-block-info {
    flex: 1;
    min-width: 0;
}

.customizer-block-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 4px;
    line-height: 1.3;
}

.customizer-block-description {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.4;
}

/* Toggle переключатель */
.customizer-toggle {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
}

.customizer-toggle.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.customizer-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.customizer-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(145, 145, 145, 0.3);
    border: 2px solid rgba(145, 145, 145, 0.4);
    transition: all 0.3s ease;
    border-radius: 34px;
}

.customizer-toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background: var(--white);
    transition: all 0.3s ease;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.customizer-toggle input:checked + .customizer-toggle-slider {
    background: rgba(255, 140, 0, 0.3);
    border-color: var(--main-color);
}

.customizer-toggle input:checked + .customizer-toggle-slider:before {
    transform: translateX(24px);
    background: var(--main-color);
    box-shadow: 0 2px 8px rgba(255, 140, 0, 0.4);
}

.customizer-toggle:not(.disabled) .customizer-toggle-slider:hover {
    border-color: rgba(255, 140, 0, 0.6);
}

/* Footer с кнопками */
.homepage-customizer-footer {
    padding: 20px 28px;
    border-top: 1px solid rgba(255, 140, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: linear-gradient(180deg, transparent 0%, rgba(255, 140, 0, 0.05) 100%);
}

.customizer-btn-group {
    display: flex;
    gap: 12px;
}

.customizer-btn {
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 8px;
    border: none;
    white-space: nowrap;
}

.customizer-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.customizer-btn-primary {
    background: linear-gradient(135deg, var(--main-color) 0%, #FF6B00 100%);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(255, 140, 0, 0.3);
}

.customizer-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(255, 140, 0, 0.5);
}

.customizer-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.customizer-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.customizer-btn-reset {
    background: rgba(255, 60, 60, 0.1);
    color: #FF6B6B;
    border: 1px solid rgba(255, 60, 60, 0.3);
}

.customizer-btn-reset:hover {
    background: rgba(255, 60, 60, 0.2);
    border-color: rgba(255, 60, 60, 0.5);
    transform: translateY(-2px);
}

/* Spinner для загрузки */
.spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Кнопка настроек в навигации */
.homepage-settings-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: rgba(255, 140, 0, 0.1);
    border: 1px solid rgba(255, 140, 0, 0.2);
    border-radius: 12px;
    color: var(--white);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.homepage-settings-trigger:hover {
    background: rgba(255, 140, 0, 0.2);
    border-color: rgba(255, 140, 0, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 140, 0, 0.3);
}

.homepage-settings-trigger svg {
    animation: rotate 4s linear infinite;
}

/* Адаптивность */
@media screen and (max-width: 768px) {
    .homepage-customizer-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }

    .homepage-customizer-header,
    .homepage-customizer-description,
    .homepage-customizer-blocks,
    .homepage-customizer-footer {
        padding-left: 20px;
        padding-right: 20px;
    }

    .homepage-customizer-title {
        font-size: 20px;
    }

    .customizer-block-item {
        padding: 12px;
        gap: 10px;
    }

    .customizer-block-icon {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }

    .customizer-block-title {
        font-size: 15px;
    }

    .customizer-block-description {
        font-size: 12px;
    }

    .homepage-customizer-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .customizer-btn-group {
        width: 100%;
    }

    .customizer-btn {
        flex: 1;
        justify-content: center;
    }

    .customizer-btn-reset {
        width: 100%;
        justify-content: center;
    }
}

@media screen and (max-width: 480px) {
    .customizer-block-drag-handle {
        display: none;
    }

    .customizer-block-item {
        cursor: default;
    }

    .customizer-btn {
        padding: 10px 16px;
        font-size: 14px;
    }
}

