/* ============================================
   Clip-path Maker — Стили
   ============================================ */

/* ============================================
   Базовая структура
   ============================================ */
.clippath-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.page-header {
    text-align: center;
    margin-bottom: 3rem;
}

.page-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(90deg, #fa709a, #fee140, #43e97b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    color: #a0a0b0;
    font-size: 1.1rem;
}

/* ============================================
   Контейнер
   ============================================ */
.clippath-container {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 2rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 2rem;
}

/* ============================================
   Превью
   ============================================ */
.preview-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.preview-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 12px;
    padding: 2rem;
    min-height: 500px;
    transition: background 0.3s ease;
}

.preview-wrapper.bg-light {
    background: #f5f5f5;
}

.preview-wrapper.bg-dark {
    background: #1a1a2e;
}

.preview-wrapper.bg-checker {
    background: 
        linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
        linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
        linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    background-color: #f5f5f5;
}

/* Clip превью */
.clip-preview {
    width: 300px;
    height: 300px;
    position: relative;
    transition: clip-path 0.3s ease;
}

.preview-image {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    clip-path: inherit;
}

/* Точки для редактирования */
.points-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.edit-point {
    position: absolute;
    width: 16px;
    height: 16px;
    background: #fa709a;
    border: 2px solid white;
    border-radius: 50%;
    cursor: move;
    pointer-events: all;
    transform: translate(-50%, -50%);
    transition: transform 0.1s ease;
    z-index: 10;
}

.edit-point:hover {
    transform: translate(-50%, -50%) scale(1.3);
}

.edit-point.dragging {
    transform: translate(-50%, -50%) scale(1.5);
    background: #fee140;
}

/* Настройки превью */
.preview-settings {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.preview-setting {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: #a0a0b0;
}

.preview-setting label {
    min-width: 100px;
}

.preview-setting input[type="color"] {
    width: 40px;
    height: 30px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: none;
}

/* Переключатель фона */
.bg-switcher {
    display: flex;
    gap: 0.5rem;
}

.bg-btn {
    width: 36px;
    height: 36px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bg-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.bg-btn.active {
    background: rgba(250, 112, 154, 0.3);
    border-color: #fa709a;
    box-shadow: 0 0 10px rgba(250, 112, 154, 0.5);
}

/* ============================================
   Панель управления
   ============================================ */
.controls-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-height: 800px;
    overflow-y: auto;
    padding-right: 1rem;
}

.controls-section::-webkit-scrollbar {
    width: 6px;
}

.controls-section::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.controls-section::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

.control-title {
    color: #fa709a;
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.control-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-item label {
    color: #a0a0b0;
    font-size: 0.85rem;
    font-weight: 500;
}

.control-item select,
.control-item input {
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #ffffff;
    cursor: pointer;
    font-size: 0.9rem;
}

.control-item select option {
    background: #2a2a3e;
    color: #ffffff;
}

/* ============================================
   Пресеты
   ============================================ */
.presets-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
}

.preset-btn {
    aspect-ratio: 1;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preset-btn:hover {
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
}

.preset-btn:active {
    transform: scale(0.95);
}

/* ============================================
   Список точек
   ============================================ */
.points-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.point-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.point-item.removing {
    animation: slideOut 0.3s ease forwards;
}

@keyframes slideOut {
    to {
        opacity: 0;
        transform: translateX(20px);
        height: 0;
        padding: 0;
        margin: 0;
    }
}

.point-number {
    color: #fa709a;
    font-weight: 600;
    font-size: 0.85rem;
    min-width: 20px;
}

.point-inputs {
    display: flex;
    gap: 0.5rem;
    flex: 1;
}

.point-inputs input {
    width: 60px;
    padding: 0.3rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: white;
    font-size: 0.8rem;
    text-align: center;
}

.remove-point-btn {
    background: rgba(245, 87, 108, 0.15);
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    color: #f5576c;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.remove-point-btn:hover {
    background: rgba(245, 87, 108, 0.3);
    transform: scale(1.1);
}

/* Кнопка добавления точки */
.add-point-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: rgba(250, 112, 154, 0.1);
    border: 1px dashed rgba(250, 112, 154, 0.4);
    border-radius: 8px;
    color: #fa709a;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-top: 0.5rem;
}

.add-point-btn:hover {
    background: rgba(250, 112, 154, 0.2);
    border-color: rgba(250, 112, 154, 0.6);
    transform: translateY(-1px);
}

.plus-icon {
    font-size: 1.2rem;
    font-weight: bold;
}

/* ============================================
   Range slider
   ============================================ */
input[type="range"] {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #fa709a, #fee140);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(250, 112, 154, 0.5);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #fa709a, #fee140);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 10px rgba(250, 112, 154, 0.5);
}

/* ============================================
   Переключатель форматов
   ============================================ */
.format-switcher {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.format-btn {
    flex: 1;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #a0a0b0;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.format-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.format-btn.active {
    background: rgba(250, 112, 154, 0.2);
    border-color: #fa709a;
    color: #fa709a;
}

/* Подсказка для Tailwind */
.format-hint {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(56, 189, 248, 0.1);
    border-left: 3px solid #38bdf8;
    border-radius: 6px;
    color: #7dd3fc;
    font-size: 0.8rem;
    line-height: 1.5;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   Box с CSS кодом
   ============================================ */
.code-box {
    position: relative;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1rem;
    padding-right: 3.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: #fa709a;
    overflow-x: auto;
    word-break: break-all;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 6px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.copy-btn.copied {
    background: rgba(76, 217, 100, 0.3);
}

/* ============================================
   Кнопки действий
   ============================================ */
.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reset-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.reset-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.action-btn:active {
    transform: translateY(0);
}

/* ============================================
   Адаптивность
   ============================================ */
@media (max-width: 1024px) {
    .clippath-container {
        grid-template-columns: 1fr;
    }
    
    .preview-wrapper {
        min-height: 400px;
    }
    
    .controls-section {
        max-height: none;
    }
}

@media (max-width: 768px) {
    .page-header h1 {
        font-size: 2rem;
    }
    
    .presets-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .action-buttons {
        flex-direction: column;
    }
}