/* ============================================
   Grid Builder — Стили
   ============================================ */

/* ============================================
   Базовая структура
   ============================================ */
.grid-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, #f093fb, #f5576c, #4facfe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

/* ============================================
   Контейнер
   ============================================ */
.grid-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 {
    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;
}

/* Grid контейнер */
.grid-container-preview {
    width: 100%;
    min-height: 400px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px dashed rgba(240, 147, 251, 0.5);
    border-radius: 8px;
    padding: 1rem;
    display: grid;
    transition: all 0.3s ease;
}

/* Grid элементы */
.grid-item {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: white;
    padding: 1rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.2rem;
    min-height: 80px;
    position: relative;
    transition: all 0.3s ease;
}

.grid-item:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(240, 147, 251, 0.4);
}

.grid-item-number {
    position: absolute;
    top: 5px;
    left: 5px;
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
}

/* Настройки превью */
.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: 120px;
}

/* Переключатель фона */
.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(240, 147, 251, 0.3);
    border-color: #f093fb;
    box-shadow: 0 0 10px rgba(240, 147, 251, 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: #f093fb;
    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;
}

.input-group {
    display: flex;
    gap: 0.5rem;
}

.small-input {
    width: 60px;
}

/* ============================================
   Список элементов
   ============================================ */
.elements-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.element-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.75rem;
    animation: slideIn 0.3s ease;
}

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

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

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

.element-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.element-title {
    color: #f093fb;
    font-weight: 600;
    font-size: 0.9rem;
}

.remove-element-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-element-btn:hover {
    background: rgba(245, 87, 108, 0.3);
    transform: scale(1.1);
}

.element-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.element-control {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.element-control label {
    color: #888;
    font-size: 0.75rem;
}

.element-control input {
    padding: 0.4rem;
    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;
}

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

.add-element-btn:hover {
    background: rgba(240, 147, 251, 0.2);
    border-color: rgba(240, 147, 251, 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, #f093fb, #f5576c);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(240, 147, 251, 0.5);
}

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

/* ============================================
   Пресеты
   ============================================ */
.presets {
    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);
}

/* ============================================
   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: #f093fb;
    overflow-x: auto;
    word-break: break-all;
    white-space: pre-wrap;
    max-height: 300px;
    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);
}


/* ============================================
   Переключатель форматов (CSS / Tailwind)
   ============================================ */
.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(240, 147, 251, 0.2);
    border-color: #f093fb;
    color: #f093fb;
}

/* Подсказка для 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);
    }
}
         
/* ============================================
   Адаптивность
   ============================================ */
@media (max-width: 1024px) {
    .grid-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-template-columns: repeat(3, 1fr);
    }
    
    .element-controls {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
}

