﻿/* ═══════════════════════════════════════════════════
   CustomChartBuilder — component styles
   ═══════════════════════════════════════════════════ */

.custom-chart-builder {
    height: 100%;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--surface-muted), 0.5) transparent;
}

/* ── Utility ── */
.ccb-hidden {
    display: none !important;
}

/* ── Wrapper ── */
.ccb-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 12px;
    gap: 16px;
}

/* ── Header ── */
.ccb-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(var(--divider), 0.12);
}

.ccb-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(var(--spread-blue), 0.1);
    flex-shrink: 0;
}

.ccb-icon-main {
    font-size: 20px !important;
    color: rgba(var(--spread-blue));
}

.ccb-header-text {
    min-width: 0;
}

.ccb-title {
    font-size: 15px;
    font-weight: 600;
    color: rgba(var(--dark));
    line-height: 1.3;
    margin: 0;
}

.ccb-subtitle {
    font-size: 11px;
    color: rgba(var(--inactive-dark));
    margin: 2px 0 0;
    line-height: 1.3;
}

/* ── Body: side-by-side ── */
.ccb-body {
    display: flex;
    gap: 8px;
    flex: 1;
    min-height: 0;
    align-items: flex-start;
}

.ccb-side {
    flex: 1;
    display: flex;
    width: 100%;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

/* Side label */
.ccb-side-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 2px;
}

.ccb-side-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ccb-dot-bid {
    background: rgba(var(--money));
}

.ccb-dot-ask {
    background: rgba(var(--failure));
}

.ccb-side-label-text {
    font-size: 12px;
    font-weight: 600;
    color: rgba(var(--dark));
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Swap column ── */
.ccb-swap-col {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 60px;
    flex-shrink: 0;
}

.ccb-swap-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(var(--divider), 0.15);
    background: rgba(var(--surface-muted), 0.3);
    color: rgba(var(--inactive-dark));
    cursor: pointer;
    transition: all 0.2s ease;
}

    .ccb-swap-btn:hover {
        background: rgba(var(--surface-muted), 0.6);
        color: rgba(var(--dark));
        border-color: rgba(var(--divider), 0.3);
        transform: scale(1.08);
    }

    .ccb-swap-btn:active {
        transform: scale(0.95);
    }

.ccb-swap-icon {
    font-size: 18px !important;
}

/* ── Field ── */
.ccb-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
}

.ccb-field-label {
    font-size: 10px;
    font-weight: 500;
    color: rgba(var(--inactive-dark));
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-left: 2px;
}

.ccb-field-symbol {
    position: relative;
}

/* ── Select ── */
.ccb-select {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    padding: 8px 28px 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(var(--divider), 0.15);
    background-color: rgba(var(--surface), 1);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    font-size: 13px;
    color: rgba(var(--dark));
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

    .ccb-select:hover {
        border-color: rgba(var(--divider), 0.3);
    }

    .ccb-select:focus {
        border-color: rgba(var(--accent-primary), 0.5);
        box-shadow: 0 0 0 2px rgba(var(--accent-primary), 0.08);
    }

.ccb-select-placeholder {
    color: rgba(var(--inactive-dark));
}

/* ── Symbol row (input + prices) ── */
.ccb-symbol-row {
    display: flex;
    align-items: stretch;
    gap: 6px;
}

.ccb-input-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
}

.ccb-input {
    width: 100%;
    padding: 8px 32px 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(var(--divider), 0.15);
    background: rgba(var(--surface), 1);
    font-size: 13px;
    color: rgba(var(--dark));
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

    .ccb-input::placeholder {
        color: rgba(var(--inactive-dark), 0.6);
    }

    .ccb-input:hover:not(:disabled) {
        border-color: rgba(var(--divider), 0.3);
    }

    .ccb-input:focus {
        border-color: rgba(var(--accent-primary), 0.5);
        box-shadow: 0 0 0 2px rgba(var(--accent-primary), 0.08);
    }

    .ccb-input:disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }

/* When token is selected — subtle accent border */
.ccb-input-selected {
    border-color: rgba(var(--accent-primary), 0.3);
    font-weight: 600;
}

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

/* ── Inline prices (beside input when selected) ── */
.ccb-inline-prices {
    display: flex;
    align-items: center;
    gap: 0;
    border-radius: 8px;
    border: 1px solid rgba(var(--divider), 0.12);
    background: rgba(var(--surface), 1);
    overflow: hidden;
    flex-shrink: 0;
    animation: ccb-prices-in 0.15s ease-out;
}

@keyframes ccb-prices-in {
    from {
        opacity: 0;
        transform: translateX(-4px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.ccb-ip-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 8px;
    gap: 1px;
}

.ccb-ip-sep {
    width: 1px;
    align-self: stretch;
    background: rgba(var(--divider), 0.1);
}

.ccb-ip-label {
    font-size: 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(var(--inactive-dark));
}

.ccb-ip-value {
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.ccb-price-bid .ccb-ip-value,
.ccb-mini-price.ccb-price-bid {
    color: rgba(var(--money));
}

.ccb-price-ask .ccb-ip-value,
.ccb-mini-price.ccb-price-ask {
    color: rgba(var(--failure));
}

/* ── Spinner inside input ── */
.ccb-input-spinner {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

.ccb-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(var(--surface-muted), 0.6);
    border-top-color: rgba(var(--accent-primary));
    border-radius: 50%;
    animation: ccb-spin 0.6s linear infinite;
}

.ccb-spinner-light {
    border-color: rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
}

@keyframes ccb-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Results dropdown ── */
.ccb-dropdown-zone {
    position: relative;
}

.ccb-results-dropdown {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: rgba(var(--surface), 1);
    border: 1px solid rgba(var(--divider), 0.2);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    /* No animation by default — only with explicit class */
}

    /* Only animate on first appearance */
    .ccb-results-dropdown.ccb-anim-dropdown-in {
        animation: ccb-dropdown-in 0.15s ease-out;
    }

@keyframes ccb-dropdown-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ccb-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    cursor: pointer;
    transition: background 0.1s;
    /* No animation by default */
}

    /* Only animate newly inserted items */
    .ccb-result-item.ccb-anim-item-in {
        animation: ccb-item-in 0.15s ease-out both;
    }

@keyframes ccb-item-in {
    from {
        opacity: 0;
        transform: translateX(-6px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.ccb-result-item:hover,
.ccb-result-item.ccb-result-highlighted {
    background: rgba(var(--selected-item), 0.5);
}

.ccb-result-item:active {
    background: rgba(var(--selected-item), 0.8);
}

.ccb-result-item + .ccb-result-item {
    border-top: 1px solid rgba(var(--divider), 0.08);
}

.ccb-result-name {
    font-size: 13px;
    font-weight: 600;
    color: rgba(var(--dark));
}

.ccb-result-prices {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
}

.ccb-mini-price {
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.ccb-mini-sep {
    color: rgba(var(--inactive-dark), 0.4);
    font-size: 10px;
}

/* ── No results ── */
.ccb-no-results {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 4px 0;
    color: rgba(var(--inactive-dark));
    font-size: 12px;
    animation: ccb-fade-in 0.2s ease-out;
}

.ccb-no-results-icon {
    font-size: 16px !important;
    color: rgba(var(--inactive-dark), 0.6);
}

@keyframes ccb-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ── Footer / Create button ── */
.ccb-footer {
    padding-top: 8px;
    border-top: 1px solid rgba(var(--divider), 0.08);
    margin-top: auto;
}

.ccb-create-btn {
    width: 100%;
    padding: 10px 16px;
    border-radius: 10px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: not-allowed;
    transition: all 0.25s ease;
    background: rgba(var(--surface-muted), 0.5);
    color: rgba(var(--inactive-dark));
    opacity: 0.6;
}

.ccb-create-btn-active {
    cursor: pointer;
    opacity: 1;
    background: rgba(var(--accent-primary));
    color: rgba(var(--accent-text));
    box-shadow: 0 2px 8px rgba(var(--accent-primary), 0.2);
}

    .ccb-create-btn-active:hover {
        box-shadow: 0 4px 16px rgba(var(--accent-primary), 0.3);
        transform: translateY(-1px);
    }

    .ccb-create-btn-active:active {
        transform: translateY(0);
        box-shadow: 0 1px 4px rgba(var(--accent-primary), 0.15);
    }

.ccb-create-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

    .ccb-create-inner .material-symbols-outlined {
        font-size: 18px !important;
    }

/* ═══ Responsive ═══ */
@media (max-width: 768px) {
    .ccb-body {
        flex-direction: column;
        gap: 14px;
    }

    .ccb-swap-col {
        padding-top: 0;
        align-self: center;
    }

    .ccb-swap-icon {
        transform: rotate(90deg);
    }

    .ccb-symbol-row {
        flex-direction: column;
    }
}
