/* WordPress Gutenberg Sidebar Imitation */
.wp-sidebar {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    height: calc(100vh - 90px);
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    overflow: hidden;
    position: sticky;
    top: 68px;
}

/* Header & Tabs */
.block-editor-inserter__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid #ddd;
    background: #fff;
    flex-shrink: 0;
    height: 52px;
}

.block-editor-inserter__tabs {
    display: flex;
    gap: 16px;
}

.inserter-tab {
    background: none;
    border: none;
    padding: 16px 0;
    font-size: 13px;
    font-weight: 500;
    color: #1e1e1e;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: border-color 0.15s;
}

.inserter-tab.active {
    border-bottom-color: #1e1e1e;
}

.inserter-tab:hover:not(.active) {
    border-bottom-color: #ccc;
    color: #007cba;
}

.inserter-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-right: -8px;
    color: #757575;
    border-radius: 4px;
    transition: background 0.1s;
}
.inserter-close:hover { background: #f0f0f0; }

/* Tab Panels - each panel takes the remaining height */
.tab-panel {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.tab-panel.active {
    display: flex;
}

/* Search */
.block-editor-inserter__search {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.components-text-control__input {
    width: 100%;
    padding: 6px 12px;
    border: 1px solid #757575;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
}
.components-text-control__input:focus {
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0,124,186,0.15);
}

/* Scrollable Area - the key fix */
.block-editor-inserter__results {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
    padding: 0 0 16px 0;
}

/* Inner padding wrapper so scrollbar doesn't overlap content */
.block-editor-inserter__all-blocks {
    padding: 0 16px;
}

.block-editor-inserter__panel-header {
    margin-bottom: 8px;
    margin-top: 20px;
    padding: 0;
}

.block-editor-inserter__panel-header:first-child {
    margin-top: 12px;
}

.block-editor-inserter__panel-title {
    font-size: 11px;
    font-weight: 500;
    color: #757575;
    text-transform: uppercase;
    margin: 0;
    letter-spacing: 0.5px;
}

/* Grid */
.block-editor-block-types-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.block-editor-block-types-list__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    padding: 10px 4px;
    height: auto;
    width: 100%;
    transition: background-color 0.1s, border-color 0.1s, transform 0.1s;
    color: #1e1e1e;
}

.block-editor-block-types-list__item:hover {
    background-color: #f0f0f0;
    border-color: #ddd;
    color: #007cba;
    transform: translateY(-1px);
}

.block-editor-block-types-list__item:active {
    transform: scale(0.95);
    background: #e8f0fe;
}

.block-editor-block-types-list__item-icon {
    margin-bottom: 6px;
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.block-editor-block-icon svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.block-editor-block-types-list__item-title {
    font-size: 11px;
    text-align: center;
    line-height: 1.3;
    color: inherit;
    max-width: 100%;
    word-wrap: break-word;
}

/* Patterns Panel */
.patterns-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 4px 16px 16px;
}

.pattern-item {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 12px 14px;
    cursor: pointer;
    background: #f9f9f9;
    font-size: 13px;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.pattern-item:hover {
    background: #e8f0fe;
    border-color: #007cba;
    transform: translateX(2px);
}

.pattern-item strong {
    display: block;
    margin-bottom: 4px;
    color: #1e1e1e;
    font-size: 13px;
}

.pattern-item small {
    color: #757575;
    font-size: 11px;
}

/* Media Panel */
.media-panel-content {
    padding: 8px 16px 16px;
}

.media-upload-area {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 28px 12px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    text-align: center;
    margin-bottom: 12px;
    background: #fafafa;
}

.media-upload-area:hover {
    border-color: #007cba;
    background: #f0f7ff;
}

.media-upload-area i {
    font-size: 32px;
    color: #aaa;
    margin-bottom: 10px;
    display: block;
}

.media-upload-area p {
    font-size: 12px;
    color: #757575;
    margin: 2px 0;
}

.media-preview-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border: 1px solid #eee;
    border-radius: 4px;
    margin-bottom: 8px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.1s;
    word-break: break-all;
}

.media-preview-item:hover {
    background: #f0f7ff;
    border-color: #007cba;
}

.media-preview-item img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 3px;
    flex-shrink: 0;
}