@import url("../variables.css?v=20260212a");

.builder-layout {
    position: absolute;
    inset: 0;
    display: flex;
    background: var(--bg-app);
}

.library-panel {
    width: 330px;
    min-width: 330px;
    height: 100%;
    background: var(--white);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 8;
}

.library-panel.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.canvas-panel {
    flex: 1;
    height: 100%;
    overflow-y: auto;
    background: var(--bg-app);
}

.canvas-panel.fine-tune-mode {
    background: #fffaf0;
}

.canvas-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 22px 24px 90px;
}

/* HEADER */
.builder-header-row {
    position: sticky;
    top: 0;
    z-index: 12;
    margin-bottom: 18px;
    padding: 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(248, 250, 252, 0.94);
    backdrop-filter: blur(3px);
    border-bottom: 1px solid #e9eef4;
}

.fine-tune-mode .builder-header-row {
    background: rgba(255, 250, 240, 0.95);
}

.header-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pretty-select-wrapper {
    position: relative;
    min-width: 180px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--white);
    display: flex;
    align-items: center;
    gap: 7px;
    transition: all 0.12s ease;
}

.pretty-select-wrapper:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.pretty-select-wrapper i {
    color: var(--slate-400);
    font-size: 11px;
}

.pretty-select-wrapper select {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--slate-700);
    font-size: 12px;
    font-weight: 700;
    font-family: var(--font-main);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    padding-right: 18px;
}

.pretty-select-wrapper .chevron {
    position: absolute;
    right: 9px;
    pointer-events: none;
}

.pretty-select-wrapper.is-fine-tune {
    border-color: #fcd34d;
    background: #fffbeb;
}

.pretty-select-wrapper.is-fine-tune i,
.pretty-select-wrapper.is-fine-tune select {
    color: #92400e;
}

.ft-badge {
    height: 28px;
    border-radius: 16px;
    padding: 0 10px;
    border: 1px solid #fcd34d;
    background: #fef3c7;
    color: #92400e;
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.45px;
}

.link-count {
    margin-left: 5px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 20px;
    background: var(--slate-100);
    color: var(--slate-700);
    font-size: 10px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-menu-delete {
    color: #b91c1c;
    border-color: #fca5a5;
}

.btn-menu-delete:hover {
    color: #991b1b;
    border-color: #f87171;
    background: #fff5f5;
}

/* LIBRARY */
.lib-tabs {
    margin: 12px;
    padding: 3px;
    border-radius: var(--radius-md);
    background: var(--slate-200);
    display: flex;
    gap: 3px;
}

.library-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: var(--slate-50);
}

.lib-tab {
    flex: 1;
    height: 30px;
    border-radius: var(--radius-sm);
    color: var(--slate-600);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.2px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.lib-tab.active {
    background: var(--white);
    color: var(--primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.lib-card {
    margin-bottom: 8px;
    padding: 8px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--white);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.12s ease;
    cursor: grab;
}

.lib-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.lib-thumb {
    width: 40px;
    height: 40px;
    border-radius: 5px;
    border: 1px solid var(--slate-100);
    background: var(--slate-100);
    object-fit: cover;
    flex-shrink: 0;
}

.lib-card-body {
    flex: 1;
    min-width: 0;
}

.lib-card-title {
    font-size: 13px;
    font-weight: 700;
}

/* HERO */
.hero-card {
    margin-bottom: 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--white);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.hero-card.dimmed {
    opacity: 0.75;
    filter: grayscale(1);
}

.hero-cover {
    height: 168px;
    background: linear-gradient(135deg, #dbeafe, #e2e8f0);
    background-size: cover;
    background-position: center;
}

.hero-placeholder {
    width: 100%;
    height: 100%;
    color: var(--slate-400);
    font-size: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-content {
    padding: 18px;
}

.hero-title {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--slate-800);
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 6px;
}

.hero-desc {
    width: 100%;
    border: none;
    resize: none;
    background: transparent;
    color: var(--slate-500);
    font-size: 13px;
    line-height: 1.45;
}

/* SECTIONS */
.menu-section {
    margin-bottom: 28px;
}

.section-header {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-handle {
    cursor: grab;
    color: var(--slate-300);
}

.section-remove-btn {
    color: var(--danger);
}

.section-inputs {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.section-title-input {
    border: none;
    background: transparent;
    color: var(--slate-800);
    font-size: 18px;
    font-weight: 800;
    width: 100%;
}

.section-desc-input {
    border: none;
    background: transparent;
    color: var(--slate-500);
    font-size: 12px;
    width: 100%;
}

.section-grid {
    min-height: 78px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px;
}

.section-empty {
    grid-column: 1 / -1;
    min-height: 84px;
    border-radius: var(--radius-lg);
    border: 2px dashed var(--slate-200);
    color: var(--slate-400);
    background: var(--white);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
}

.btn-add-section {
    border-style: dashed;
    margin-top: 32px;
    height: 48px;
}

/* ITEM CARD */
.item-card {
    height: 142px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--white);
    box-shadow: var(--shadow-sm);
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    transition: all 0.14s ease;
}

.item-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.item-card.overridden {
    border-color: #fcd34d;
    background: #fffdf3;
}

.item-card.hidden-item {
    opacity: 0.58;
    filter: grayscale(1);
}

.item-actions-overlay {
    position: absolute;
    top: 8px;
    right: 8px;
    opacity: 0;
    transition: opacity 0.12s ease;
    display: flex;
    gap: 5px;
    border-radius: 8px;
    padding: 3px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--slate-100);
}

.item-card:hover .item-actions-overlay {
    opacity: 1;
}

.action-btn {
    width: 26px;
    height: 26px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--slate-500);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.action-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.action-btn.delete:hover {
    color: var(--danger);
    border-color: #fecaca;
}

.item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.item-name {
    color: var(--slate-800);
    font-size: 14px;
    font-weight: 800;
    margin-bottom: 3px;
}

.item-desc {
    color: var(--slate-500);
    font-size: 11px;
    line-height: 1.4;
    margin-bottom: 7px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.item-mods {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.mod-badge {
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--primary-light);
    background: var(--primary-light);
    color: var(--primary);
    font-size: 10px;
    font-weight: 700;
}

.btn-mod-add {
    border: 1px dashed var(--slate-300);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--slate-500);
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
}

.btn-mod-add:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.item-bottom {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.item-price {
    color: var(--slate-800);
    font-weight: 800;
    font-size: 14px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
}

.item-thumb-lg {
    width: 90px;
    height: 90px;
    border-radius: 8px;
    border: 1px solid var(--slate-200);
    background: var(--slate-50);
    object-fit: cover;
    flex-shrink: 0;
}

.thumb-placeholder {
    color: var(--slate-400);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

/* FINE-TUNE TOGGLE */
.ft-toggle {
    min-height: 24px;
    padding: 0 8px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.ft-toggle.is-visible {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #047857;
}

.ft-toggle.is-hidden {
    background: #fff5f5;
    border-color: #fecaca;
    color: #b91c1c;
}

/* RESPONSIVE */
@media (max-width: 1200px) {
    .library-panel {
        width: 300px;
        min-width: 300px;
    }

    .section-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 980px) {
    .builder-layout {
        flex-direction: column;
    }

    .library-panel {
        width: 100%;
        min-width: 100%;
        height: 42%;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .canvas-panel {
        height: 58%;
    }

    .canvas-container {
        padding: 14px;
    }

    .builder-header-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .header-group {
        width: 100%;
    }
}
