/* ============================================
   Cart Page — Sidebar + Detail Layout
   ============================================ */

.cart-page-layout {
    display: flex;
    gap: 0;
    min-height: 500px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    overflow: hidden;
}

/* ── Sidebar ── */
.cart-sidebar {
    width: 240px;
    min-width: 240px;
    background: rgba(255, 255, 255, 0.02);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
}

.cart-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.cart-sidebar-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background 0.15s;
}

.cart-sidebar-item:hover {
    background: rgba(79, 195, 247, 0.06);
}

.cart-sidebar-item.active {
    background: rgba(79, 195, 247, 0.1);
    border-left: 3px solid #4fc3f7;
}

.cart-sidebar-item-name {
    font-size: 0.85em;
    font-weight: 600;
    margin-bottom: 2px;
}

.cart-sidebar-item-meta {
    font-size: 0.72em;
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Detail ── */
.cart-detail {
    flex: 1;
    padding: 16px 20px;
    overflow-y: auto;
    max-height: 80vh;
}

.cart-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.cart-detail-title {
    font-size: 1.15em;
    font-weight: 700;
}

.cart-detail-actions {
    display: flex;
    gap: 4px;
}

.cart-editable {
    cursor: pointer;
    transition: color 0.15s;
}

.cart-editable:hover {
    color: #4fc3f7;
}

.cart-detail-meta {
    font-size: 0.82em;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.cart-status-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 0.78em;
    font-weight: 600;
}

/* ── Build cards ── */
.cart-build-card {
    background: rgba(79, 195, 247, 0.03);
    border: 1px solid rgba(79, 195, 247, 0.12);
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
}

.cart-build-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    font-size: 0.9em;
    font-weight: 600;
    background: rgba(79, 195, 247, 0.04);
    border-bottom: 1px solid rgba(79, 195, 247, 0.08);
}

.cart-build-total {
    color: #4fc3f7;
    font-weight: 700;
}

.cart-build-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 14px;
    font-size: 0.8em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.cart-build-item:last-child {
    border-bottom: none;
}

.cart-build-item-cat {
    min-width: 90px;
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.9em;
}

.cart-build-item-name {
    flex: 1;
    word-break: break-word;
}

.cart-build-item-price {
    color: #81c784;
    font-weight: 600;
    flex-shrink: 0;
}

.cart-build-item-pvp {
    color: #4fc3f7;
    font-weight: 600;
    flex-shrink: 0;
    min-width: 60px;
    text-align: right;
}

/* ── PVP price display ── */
.cart-price-pvd {
    color: #81c784;
    font-weight: 600;
    font-size: 0.85em;
    opacity: 0.7;
    min-width: 55px;
    text-align: right;
    flex-shrink: 0;
}

.cart-pvp-edit {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.cart-pvp-input {
    background: rgba(79, 195, 247, 0.06);
    border: 1px solid rgba(79, 195, 247, 0.2);
    border-radius: 4px;
    color: #4fc3f7;
    font-size: 0.85em;
    font-weight: 600;
    padding: 2px 6px;
    text-align: right;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.cart-pvp-input:focus {
    border-color: #4fc3f7;
    box-shadow: 0 0 0 2px rgba(79, 195, 247, 0.15);
}

.cart-pvp-input.custom {
    border-color: #ffa726;
    color: #ffa726;
}

.cart-pvp-suffix {
    font-size: 0.75em;
    color: rgba(255, 255, 255, 0.4);
    flex-shrink: 0;
}

/* ── Section labels ── */
.cart-section-label {
    font-size: 0.82em;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    margin: 14px 0 6px;
}

/* ── Individual items ── */
.cart-item-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.cart-item-info {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-size: 0.85em;
    word-break: break-word;
}

.cart-item-supplier {
    font-size: 0.72em;
    color: rgba(255, 255, 255, 0.4);
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.cart-item-qty {
    min-width: 22px;
    text-align: center;
    font-size: 0.85em;
    font-weight: 600;
}

.cart-item-price {
    color: #81c784;
    font-weight: 600;
    min-width: 65px;
    text-align: right;
    font-size: 0.9em;
}

/* ── Total bar ── */
.cart-total-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    margin-top: 12px;
    border-top: 2px solid rgba(79, 195, 247, 0.3);
}

.cart-total-label {
    font-size: 1.1em;
    font-weight: 600;
}

.cart-total-amount {
    font-size: 1.3em;
    font-weight: 700;
    color: #4fc3f7;
}

/* ── Action bar ── */
.cart-action-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .cart-page-layout {
        flex-direction: column;
    }

    .cart-sidebar {
        width: 100%;
        min-width: auto;
        flex-direction: row;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }

    .cart-sidebar-item {
        white-space: nowrap;
        min-width: 140px;
    }

    .cart-item-row {
        flex-wrap: wrap;
    }

    .cart-item-controls {
        margin-left: auto;
    }
}

/* ── Client autocomplete dropdown ── */
.cart-client-search-wrap {
    position: relative;
}

.cart-client-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(20, 25, 35, 0.98);
    border: 1px solid rgba(79, 195, 247, 0.25);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 220px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
}

.cart-client-dropdown.show {
    display: block;
}

.cart-client-option {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.15s;
}

.cart-client-option:hover {
    background: rgba(79, 195, 247, 0.1);
}

.cart-client-option:last-child {
    border-bottom: none;
}

.cart-client-option-name {
    font-size: 0.85em;
    font-weight: 600;
}

.cart-client-option-meta {
    font-size: 0.72em;
    color: rgba(255, 255, 255, 0.45);
    margin-top: 1px;
}

.cart-client-no-results {
    padding: 10px 12px;
    font-size: 0.82em;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
}

/* ── Move popup ── */
.cart-move-popup {
    position: fixed;
    z-index: 1050;
    min-width: 200px;
    max-width: 280px;
    background: rgba(20, 25, 35, 0.98);
    border: 1px solid rgba(79, 195, 247, 0.25);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    overflow: hidden;
    animation: cartPopupIn 0.15s ease-out;
}

@keyframes cartPopupIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.cart-move-popup-title {
    padding: 8px 12px;
    font-size: 0.78em;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cart-move-popup-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.85em;
    transition: background 0.15s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.cart-move-popup-option:hover {
    background: rgba(79, 195, 247, 0.1);
}

.cart-move-popup-count {
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.4);
}

.cart-move-popup-new {
    color: #4fc3f7;
    gap: 6px;
    border-bottom: none;
}

.cart-move-popup-empty {
    padding: 10px 12px;
    font-size: 0.82em;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
}