* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    width: 100%;
    min-height: 100%;
    background: #0d0d0f;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        Helvetica, Arial, sans-serif;
}

.trading-terminal-root {
    width: 100%;
}

.tv-terminal {
    width: 100%;
    height: 68vh;
    max-height: 700px;
    min-height: 480px;
    display: flex;
    flex-direction: column;
    background: #0d0d0f;
    color: #f1f1f1;
    overflow: hidden;
    border: 1px solid #29292d;
}

.tv-terminal-header {
    height: 70px;
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    border-bottom: 1px solid #252529;
}

.tv-pair-left {
    display: flex;
    align-items: center;
    gap: 13px;
}

.tv-star {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    color: #bdbdc2;
    cursor: pointer;
    padding: 0;
}

.tv-star svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tv-star.active {
    color: #fafe37;
}

.tv-star.active svg {
    fill: currentColor;
}

.tv-network-wrap {
    position: relative;
    flex-shrink: 0;
}

.tv-network-btn {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
}

.tv-network-btn svg {
    width: 100%;
    height: 100%;
}

.tv-pair-name {
    font-size: 23px;
    font-weight: 700;
}

.tv-leverage {
    padding: 7px 11px;
    border-radius: 7px;
    background: #29292e;
    color: #e8e8e8;
    font-size: 14px;
    font-weight: 700;
}

.tv-pair-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border: none;
    background: transparent;
    color: #aaaab0;
    cursor: pointer;
    padding: 0;
}

.tv-pair-arrow svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tv-live-status {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #7fdf9a;
    font-size: 11px;
    font-weight: 700;
}

.tv-live-status span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #31d56a;
    box-shadow: 0 0 8px #31d56a;
}

.tv-tabs {
    height: 58px;
    min-height: 58px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-bottom: 1px solid #252529;
}

.tv-tab {
    position: relative;
    border: none;
    background: transparent;
    color: #8e8e95;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.tv-tab.active {
    color: #fafe37;
}

.tv-tab.active::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 12%;
    right: 12%;
    height: 3px;
    background: #fafe37;
}

.tv-panel {
    display: none;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.tv-panel.active {
    display: flex;
    flex-direction: column;
}

.tv-chart-wrapper {
    flex: 1;
    min-height: 0;
    width: 100%;
}

#tv-chart-container {
    width: 100%;
    height: 100%;
}

.tradingview-widget-container__widget {
    width: 100%;
    height: 100%;
}

.tradingview-widget-copyright {
    height: 20px;
    padding-left: 10px;
    background: #0d0d0f;
    font-size: 10px;
}

.tradingview-widget-copyright a {
    color: #777;
    text-decoration: none;
}

.tv-chart-bottom {
    height: 42px;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    border-top: 1px solid #252529;
}

.tv-range-button {
    border: none;
    background: transparent;
    color: #999;
    font-size: 13px;
    cursor: pointer;
}

.tv-market-price {
    color: #fafe37;
    font-size: 13px;
    font-weight: 700;
}

.tv-orderbook-toolbar {
    height: 58px;
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 1px solid #252529;
}

.tv-depth-options {
    display: flex;
    gap: 5px;
}

.tv-depth-options button {
    border: none;
    background: transparent;
    color: #777;
    padding: 7px 9px;
    border-radius: 5px;
    cursor: pointer;
}

.tv-depth-options button.depth-active {
    background: #2a2a2e;
    color: #ddd;
}

.tv-orderbook-coin {
    color: #aaa;
    font-size: 13px;
}

.tv-orderbook-head {
    display: grid;
    grid-template-columns: 1.3fr 1fr 1fr;
    padding: 11px 15px;
    color: #6e6e74;
    font-size: 12px;
}

.tv-orderbook-head span:nth-child(n+2) {
    text-align: right;
}

.tv-orderbook {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 8px;
}

.tv-order-row {
    position: relative;
    display: grid;
    grid-template-columns: 1.3fr 1fr 1fr;
    padding: 6px 8px;
    font-size: 13px;
    overflow: hidden;
}

.tv-order-row span {
    position: relative;
    z-index: 2;
}

.tv-order-row span:nth-child(n+2) {
    text-align: right;
}

.tv-depth-bar {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    opacity: .15;
}

.tv-ask {
    color: #f05b66;
}

.tv-bid {
    color: #25c78a;
}

.tv-ask-depth {
    background: #ef4e5c;
}

.tv-bid-depth {
    background: #1bc484;
}

.tv-spread {
    display: flex;
    justify-content: space-between;
    margin: 7px 0;
    padding: 9px 12px;
    background: #1a1a1d;
    color: #888;
    font-size: 12px;
}

.tv-spread strong {
    color: #f1f1f1;
}

.tv-trades-head {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 15px;
    color: #6e6e74;
    font-size: 12px;
}

.tv-trades-head span:nth-child(n+2) {
    text-align: right;
}

.tv-trades {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 15px;
}

.tv-trade-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 7px 0;
    font-size: 13px;
}

.tv-trade-row span:nth-child(n+2) {
    text-align: right;
}

.tv-trade-buy {
    color: #25c78a;
}

.tv-trade-sell {
    color: #f05b66;
}

.tv-loading {
    padding: 35px 15px;
    text-align: center;
    color: #666;
    font-size: 13px;
}

.tv-terminal-footer {
    height: 54px;
    min-height: 54px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-top: 1px solid #252529;
    background: #101012;
}

.tv-footer-item {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 12px;
    cursor: pointer;
}

.tv-footer-item.active {
    color: #fafe37;
}

.tv-orderbook::-webkit-scrollbar,
.tv-trades::-webkit-scrollbar {
    width: 4px;
}

.tv-orderbook::-webkit-scrollbar-thumb,
.tv-trades::-webkit-scrollbar-thumb {
    background: #343438;
    border-radius: 10px;
}

@media (max-width: 600px) {
    .tv-terminal {
        height: 75vh;
        max-height: none;
        min-height: 420px;
        border: none;
    }

    .tv-terminal-header {
        height: 64px;
        min-height: 64px;
        padding: 0 13px;
    }

    .tv-pair-name {
        font-size: 17px;
    }

    .tv-network-btn {
        width: 18px;
        height: 18px;
    }

    .tv-live-status {
        font-size: 9px;
    }

    .tv-tabs {
        height: 54px;
        min-height: 54px;
    }

    .tv-tab {
        font-size: 14px;
    }

    .tv-orderbook-head,
    .tv-order-row {
        font-size: 12px;
    }
}

@media (min-width: 900px) {
    .tv-terminal-header {
        height: auto;
        min-height: 70px;
        flex-wrap: wrap;
        row-gap: 10px;
        padding: 14px 18px;
    }
}
