/* W6: Commodity code search modal — 3-pane wow layout. */

.commodity-modal .modal-dialog {
    max-width: 95vw;
    margin: 1.5vh auto;
}

.commodity-modal .modal-content {
    height: 97vh;
    box-shadow: var(--shadow-modal);
    border-radius: 12px;
    overflow: hidden;
}

.commodity-modal__body {
    display: grid;
    grid-template-columns: 320px 1fr 360px;
    height: 100%;
    overflow: hidden;
    background: var(--surface-2);
}

.commodity-pane {
    display: flex;
    flex-direction: column;
    background: var(--surface-1);
    border-right: 1px solid var(--border-subtle);
    overflow: hidden;
}

.commodity-pane:last-child {
    border-right: none;
}

.commodity-pane__header {
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--surface-2);
    font-weight: 600;
    font-size: 0.85rem;
    color: #4b5563;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.commodity-pane__content {
    flex: 1;
    overflow-y: auto;
    padding: 0.25rem 0;
}

.commodity-section {
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
}

.commodity-section:last-child {
    border-bottom: none;
}

.commodity-section__title {
    padding: 0.4rem 0.75rem 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.commodity-section__count {
    background: var(--surface-3);
    border-radius: 10px;
    padding: 0 0.5rem;
    font-size: 0.7rem;
    color: #4b5563;
}

.commodity-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 6px;
    margin: 0 0.4rem 1px;
    transition: background var(--duration-fast);
}

.commodity-row:hover {
    background: var(--surface-3);
}

.commodity-row--selected {
    background: rgba(59, 130, 246, 0.12);
    border-left: 3px solid var(--st-signing);
    padding-left: calc(0.6rem - 3px);
}

.commodity-row--excise {
    /* мала иконкa за акциз ставки */
}

.commodity-row__toggle {
    flex-shrink: 0;
    width: 1rem;
    font-size: 0.7rem;
    color: #9ca3af;
    text-align: center;
    user-select: none;
}

.commodity-row__toggle--empty {
    color: #d1d5db;
}

.commodity-row__code {
    flex-shrink: 0;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: #1f2937;
    font-weight: 600;
    min-width: 110px;
}

.commodity-row__desc {
    flex: 1;
    color: #4b5563;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.commodity-row__uses {
    flex-shrink: 0;
    font-size: 0.7rem;
    color: #9ca3af;
}

.commodity-row__excise {
    flex-shrink: 0;
    font-size: 0.85rem;
}

.commodity-confidence {
    flex-shrink: 0;
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    font-weight: 600;
}

.commodity-confidence--high { background: rgba(16, 185, 129, 0.15); color: #047857; }
.commodity-confidence--med  { background: rgba(245, 158, 11, 0.15); color: #b45309; }
.commodity-confidence--low  { background: rgba(107, 114, 128, 0.15); color: #4b5563; }

.commodity-children {
    padding-left: 1.4rem;
}

/* Detail pane. */

.commodity-detail__code {
    font-family: var(--font-mono);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--st-signing);
    padding: 0.9rem 1rem 0.3rem;
}

.commodity-detail__desc {
    padding: 0 1rem 0.5rem;
    font-size: 0.95rem;
    color: #1f2937;
    line-height: 1.4;
}

.commodity-detail__additional {
    padding: 0 1rem 0.75rem;
    font-size: 0.8rem;
    color: #6b7280;
    line-height: 1.5;
}

.commodity-detail__table {
    width: calc(100% - 2rem);
    margin: 0.5rem 1rem 1rem;
    font-size: 0.85rem;
}

.commodity-detail__table th {
    text-align: left;
    color: #6b7280;
    font-weight: 500;
    padding: 0.35rem 0;
    width: 35%;
    border-bottom: 1px solid var(--border-subtle);
}

.commodity-detail__table td {
    color: #1f2937;
    font-weight: 600;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border-subtle);
}

.commodity-detail__siblings {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-subtle);
    background: var(--surface-2);
}

.commodity-detail__siblings-title {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}

.commodity-detail__sibling {
    display: block;
    padding: 0.3rem 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: #4b5563;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    margin-bottom: 2px;
    transition: background var(--duration-fast);
}

.commodity-detail__sibling:hover {
    background: var(--surface-3);
    color: var(--st-signing);
}

/* Responsive — на тесни screens, sections се stack-аат. */
@media (max-width: 1024px) {
    .commodity-modal__body {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }
    .commodity-pane {
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
        max-height: 33vh;
    }
}
