/* ===== ОСНОВНОЙ КОНТЕЙНЕР ===== */
#asb-app {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-sizing: border-box;
}

#asb-app * {
    box-sizing: border-box;
}

.asb-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    width: 100%;
    max-width: 100%;
    background: #f1f5f9;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    overflow: hidden;
}

/* ===== ШАПКА ===== */
.asb-header {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
}

.asb-header h2 {
    margin: 0;
    font-size: clamp(18px, 2.5vw, 24px);
    font-weight: 800;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.asb-header-actions {
    display: grid;
    grid-template-columns: repeat(4, auto);
    gap: 8px;
}

.asb-btn {
    padding: 8px 14px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.asb-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(102,126,234,0.25);
}
.asb-btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(102,126,234,0.35); }

.asb-btn-success {
    background: #10b981;
    color: #fff;
}
.asb-btn-success:hover { background: #059669; transform: translateY(-2px); }

.asb-btn-danger {
    background: #ef4444;
    color: #fff;
}
.asb-btn-danger:hover { background: #dc2626; transform: translateY(-2px); }

.asb-btn-outline {
    background: transparent;
    border: 2px solid #e2e8f0;
    color: #475569;
}
.asb-btn-outline:hover { border-color: #667eea; color: #667eea; background: #f8fafc; }

/* ===== ОСНОВНАЯ СЕТКА ===== */
.asb-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    width: 100%;
}

/* ===== ПАНЕЛЬ НАСТРОЕК ===== */
.asb-settings {
    background: #ffffff;
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    max-height: 600px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px;
    width: 100%;
}

.asb-settings::-webkit-scrollbar { width: 5px; }
.asb-settings::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

.asb-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f1f5f9;
}
.asb-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.asb-section-title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px;
    align-items: center;
}

/* ===== ПОЛЯ ВВОДА ===== */
.asb-field {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3px;
}

.asb-field label {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
}

.asb-field input[type="text"],
.asb-field input[type="number"],
.asb-field select {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    transition: all 0.3s;
    background: #fff;
    color: #0f172a;
    box-sizing: border-box;
}

.asb-field input:focus,
.asb-field select:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

.asb-field input[type="range"] {
    width: 100%;
    padding: 0;
    border: none;
    accent-color: #667eea;
    cursor: pointer;
}

.asb-range-value {
    display: inline-block;
    font-weight: 600;
    color: #667eea;
    margin-left: 6px;
    font-size: 13px;
}

.asb-field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.asb-color-row {
    display: grid;
    grid-template-columns: 38px 1fr;
    gap: 8px;
    align-items: center;
}

.asb-color-row input[type="color"] {
    width: 38px;
    height: 38px;
    padding: 2px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    background: none;
}

.asb-color-hex {
    font-size: 12px;
    color: #64748b;
    font-family: monospace;
}

.asb-checkbox {
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 8px;
    align-items: center;
    cursor: pointer;
    padding: 3px 0;
}

.asb-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #667eea;
    cursor: pointer;
}

.asb-checkbox span {
    font-size: 13px;
    color: #0f172a;
    font-weight: 500;
}

.asb-width-control {
    display: grid;
    grid-template-columns: 1fr 70px;
    gap: 8px;
}

/* ===== ПАНЕЛЬ ПРЕВЬЮ ===== */
.asb-preview {
    background: #ffffff;
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    align-content: start;
    width: 100%;
}

.asb-preview-header {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
}

.asb-preview-header h3 {
    margin: 0;
    font-size: 15px;
    color: #0f172a;
}

.asb-preview-area {
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px 15px;
    min-height: 200px;
    display: grid;
    place-items: center;
    border: 2px dashed #e2e8f0;
    transition: all 0.3s;
    width: 100%;
}

/* ===== ЖИВОЙ ПОИСК В ПРЕВЬЮ ===== */
.asb-search-preview {
    width: 100%;
    max-width: 100%;
}

.asb-search-preview .asb-search-form {
    display: grid;
    gap: 8px;
    width: 100%;
}

.asb-search-preview .asb-search-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
}

.asb-search-preview .asb-input-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    position: relative;
    align-items: stretch;
    width: 100%;
}

.asb-search-preview .asb-search-input {
    width: 100%;
    padding: 10px 16px;
    border: 2px solid #ddd;
    border-radius: 30px;
    font-size: 14px;
    transition: all 0.3s;
    background: #fff;
    color: #333;
    min-height: 44px;
    padding-left: 40px;
    box-sizing: border-box;
    grid-column: 1 / -1;
}

.asb-search-preview .asb-search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

.asb-search-preview .asb-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
    display: grid;
    place-items: center;
    z-index: 2;
}

.asb-search-preview .asb-search-icon svg {
    width: 18px;
    height: 18px;
}

.asb-search-preview .asb-search-button {
    padding: 10px 20px;
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    min-height: 44px;
    display: grid;
    place-items: center;
    grid-column: 1 / -1;
}

.asb-search-preview .asb-search-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102,126,234,0.3);
}

/* Позиции кнопки */
.asb-button-inside .asb-input-wrapper {
    grid-template-columns: 1fr;
}

.asb-button-inside .asb-search-button.asb-button-inside {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    padding: 6px 16px;
    min-height: 34px;
    border-radius: 25px;
    width: auto;
    grid-column: auto;
}

.asb-button-inside .asb-search-button.asb-button-inside:hover {
    transform: translateY(-50%);
}

.asb-button-outside .asb-search-wrapper {
    grid-template-columns: 1fr auto;
}

.asb-button-outside .asb-button-outside-wrapper {
    display: grid;
    align-items: stretch;
    grid-column: 2 / 3;
}

.asb-button-both .asb-search-wrapper {
    grid-template-columns: 1fr;
}

.asb-button-both .asb-button-outside-wrapper {
    display: grid;
    grid-template-columns: 1fr;
}

/* ===== КОД ===== */
.asb-code-section {
    margin-top: 0;
    background: #ffffff;
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
}

.asb-code-tabs {
    display: grid;
    grid-template-columns: repeat(4, auto);
    gap: 6px;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 10px;
}

.asb-code-tab {
    padding: 6px 14px;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: 600;
    color: #94a3b8;
    border-radius: 6px;
    transition: all 0.3s;
    font-size: 13px;
}

.asb-code-tab.active {
    background: #667eea;
    color: #fff;
}

.asb-code-tab:hover:not(.active) {
    background: #f1f5f9;
    color: #0f172a;
}

.asb-code-block {
    position: relative;
    background: #0f172a;
    border-radius: 10px;
    padding: 16px;
    overflow: auto;
    max-height: 350px;
    width: 100%;
}

.asb-code-block::-webkit-scrollbar { width: 6px; }
.asb-code-block::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }

.asb-code-block pre {
    margin: 0;
    color: #e2e8f0;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
    max-width: 100%;
}

.asb-code-block .asb-copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255,255,255,0.08);
    color: #fff;
    border: none;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.3s;
}

.asb-code-block .asb-copy-btn:hover {
    background: rgba(255,255,255,0.15);
}
.asb-code-block .asb-copy-btn.copied {
    background: #10b981;
}

/* ===== УВЕДОМЛЕНИЯ ===== */
.asb-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    background: #0f172a;
    color: #fff;
    border-radius: 12px;
    font-weight: 500;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    transform: translateY(80px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 99999;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: center;
    font-size: 14px;
}

.asb-toast.show {
    transform: translateY(0);
    opacity: 1;
}
.asb-toast.success { background: #10b981; }
.asb-toast.error { background: #ef4444; }

/* ===== БЛОК ВОЗМОЖНОСТЕЙ ===== */
.asb-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    padding: 16px;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    width: 100%;
}

.asb-feature {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: start;
    padding: 10px 12px;
    background: #f8fafc;
    border-radius: 10px;
    transition: all 0.3s;
}

.asb-feature:hover {
    background: #f1f5f9;
    transform: translateY(-2px);
}

.asb-feature .icon {
    font-size: 20px;
    line-height: 1;
}

.asb-feature .text {
    display: grid;
    gap: 1px;
}

.asb-feature .text .title {
    font-weight: 600;
    font-size: 13px;
    color: #0f172a;
}

.asb-feature .text .desc {
    font-size: 11px;
    color: #64748b;
    line-height: 1.3;
}

/* ============================================ */
/* ===== АДАПТИВНОСТЬ (CSS GRID) ===== */
/* ============================================ */

/* Планшеты и маленькие ноутбуки */
@media (max-width: 1024px) {
    .asb-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .asb-settings {
        max-height: 500px;
    }
}

/* Мобильные устройства */
@media (max-width: 768px) {
    .asb-container {
        padding: 14px;
        border-radius: 12px;
        gap: 14px;
    }
    
    .asb-header {
        grid-template-columns: 1fr;
        gap: 10px;
        text-align: center;
    }
    
    .asb-header h2 {
        text-align: center;
        font-size: 20px;
    }
    
    .asb-header-actions {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
        justify-content: center;
    }
    
    .asb-header-actions .asb-btn {
        justify-content: center;
        font-size: 12px;
        padding: 6px 10px;
    }
    
    .asb-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    
    .asb-settings {
        max-height: 400px;
        padding: 14px;
    }
    
    .asb-preview-area {
        padding: 14px;
        min-height: 160px;
    }
    
    .asb-code-tabs {
        grid-template-columns: repeat(2, 1fr);
        gap: 4px;
    }
    
    .asb-code-tab {
        font-size: 12px;
        padding: 5px 10px;
        text-align: center;
    }
    
    .asb-code-block {
        max-height: 280px;
        padding: 12px;
    }
    
    .asb-code-block pre {
        font-size: 11px;
    }
    
    .asb-features {
        grid-template-columns: 1fr 1fr;
        padding: 12px;
        gap: 8px;
    }
    
    .asb-feature {
        padding: 8px 10px;
    }
    
    .asb-feature .icon {
        font-size: 18px;
    }
    
    .asb-feature .text .title {
        font-size: 12px;
    }
    
    .asb-feature .text .desc {
        font-size: 10px;
    }
    
    .asb-field-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .asb-width-control {
        grid-template-columns: 1fr 60px;
    }
    
    .asb-search-preview .asb-search-input {
        font-size: 13px;
        padding: 8px 14px;
        min-height: 38px;
        padding-left: 36px;
    }
    
    .asb-search-preview .asb-search-button {
        font-size: 13px;
        padding: 8px 16px;
        min-height: 38px;
    }
    
    .asb-search-preview .asb-search-icon svg {
        width: 16px;
        height: 16px;
    }
}

/* Маленькие мобильные */
@media (max-width: 480px) {
    .asb-container {
        padding: 10px;
        border-radius: 10px;
        gap: 10px;
    }
    
    .asb-header h2 {
        font-size: 17px;
    }
    
    .asb-header-actions {
        grid-template-columns: 1fr 1fr;
        gap: 4px;
    }
    
    .asb-header-actions .asb-btn {
        font-size: 11px;
        padding: 5px 8px;
        gap: 4px;
    }
    
    .asb-settings {
        max-height: 350px;
        padding: 10px;
        border-radius: 10px;
    }
    
    .asb-section {
        margin-bottom: 12px;
        padding-bottom: 12px;
    }
    
    .asb-section-title {
        font-size: 13px;
    }
    
    .asb-field label {
        font-size: 11px;
    }
    
    .asb-field input[type="text"],
    .asb-field input[type="number"],
    .asb-field select {
        padding: 6px 10px;
        font-size: 12px;
        border-radius: 6px;
    }
    
    .asb-preview {
        padding: 12px;
        border-radius: 10px;
        gap: 10px;
    }
    
    .asb-preview-area {
        padding: 10px;
        min-height: 130px;
        border-radius: 10px;
    }
    
    .asb-code-section {
        padding: 12px;
        border-radius: 10px;
        gap: 10px;
    }
    
    .asb-code-tabs {
        grid-template-columns: 1fr 1fr;
        gap: 4px;
        padding-bottom: 8px;
    }
    
    .asb-code-tab {
        font-size: 11px;
        padding: 4px 8px;
        border-radius: 4px;
    }
    
    .asb-code-block {
        max-height: 220px;
        padding: 10px;
        border-radius: 8px;
    }
    
    .asb-code-block pre {
        font-size: 10px;
        line-height: 1.5;
    }
    
    .asb-code-block .asb-copy-btn {
        top: 6px;
        right: 6px;
        padding: 3px 10px;
        font-size: 10px;
    }
    
    .asb-features {
        grid-template-columns: 1fr;
        padding: 10px;
        gap: 6px;
        border-radius: 10px;
    }
    
    .asb-feature {
        padding: 6px 10px;
        border-radius: 8px;
        grid-template-columns: 20px 1fr;
        gap: 8px;
    }
    
    .asb-feature .icon {
        font-size: 16px;
    }
    
    .asb-feature .text .title {
        font-size: 11px;
    }
    
    .asb-feature .text .desc {
        font-size: 10px;
    }
    
    .asb-field-grid {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    
    .asb-width-control {
        grid-template-columns: 1fr 50px;
        gap: 6px;
    }
    
    .asb-color-row {
        grid-template-columns: 32px 1fr;
        gap: 6px;
    }
    
    .asb-color-row input[type="color"] {
        width: 32px;
        height: 32px;
        border-radius: 6px;
    }
    
    .asb-color-hex {
        font-size: 11px;
    }
    
    .asb-checkbox {
        grid-template-columns: 16px 1fr;
        gap: 6px;
    }
    
    .asb-checkbox input[type="checkbox"] {
        width: 16px;
        height: 16px;
    }
    
    .asb-checkbox span {
        font-size: 12px;
    }
    
    .asb-search-preview .asb-search-input {
        font-size: 12px;
        padding: 6px 12px;
        min-height: 34px;
        padding-left: 32px;
        border-radius: 25px;
    }
    
    .asb-search-preview .asb-search-button {
        font-size: 12px;
        padding: 6px 14px;
        min-height: 34px;
        border-radius: 25px;
    }
    
    .asb-search-preview .asb-search-icon svg {
        width: 14px;
        height: 14px;
    }
    
    .asb-search-preview .asb-search-icon {
        left: 10px;
    }
    
    .asb-toast {
        bottom: 12px;
        right: 12px;
        left: 12px;
        padding: 10px 16px;
        font-size: 13px;
        border-radius: 10px;
    }
}

/* Очень маленькие экраны */
@media (max-width: 360px) {
    .asb-container {
        padding: 8px;
        border-radius: 8px;
    }
    
    .asb-header-actions {
        grid-template-columns: 1fr 1fr;
        gap: 3px;
    }
    
    .asb-header-actions .asb-btn {
        font-size: 10px;
        padding: 4px 6px;
        gap: 3px;
    }
    
    .asb-settings {
        max-height: 300px;
        padding: 8px;
    }
    
    .asb-preview-area {
        padding: 8px;
        min-height: 100px;
    }
    
    .asb-code-tabs {
        grid-template-columns: 1fr 1fr;
    }
    
    .asb-code-tab {
        font-size: 10px;
        padding: 3px 6px;
    }
    
    .asb-code-block {
        max-height: 180px;
        padding: 8px;
    }
    
    .asb-code-block pre {
        font-size: 9px;
    }
}