* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-teal-900: #25102e;
    --button-color: #7c65c1;
    --background-color: #17101f;
}

body {
    background-color: #17101f;
    color: #fcfcfc;
    font-family: 'Arial', sans-serif;
    font-size: 14px;
    overflow-x: hidden;
}

.header {
    background: linear-gradient(135deg, var(--background-color) 0%, #190e1d 100%);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--color-teal-900);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo img {
    width: 150px;
    height: 17px;
    border-radius: 4px;
    object-fit: contain;
}

.logo h1 {
    color: var(--color-teal-900);
    font-size: 24px;
    font-weight: bold;
}

.social-links {
    display: flex;
    gap: 10px;
}

.social-btn {
    background: var(--button-color);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
    border: 1px solid var(--color-teal-900);
}

.social-btn:hover {
    background: #7c65c1;
    transform: translateY(-2px);
}

.container {
    display: grid;
    grid-template-columns: 350px 1fr 400px;
    height: calc(100vh - 70px);
    gap: 1px;
}

.token-card.high-gain {
    border: 2px solid #00ff88;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.panel {
    background: var(--background-color);
    border-right: 1px solid var(--color-teal-900);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--color-teal-900) var(--background-color);
}

.panel::-webkit-scrollbar {
    width: 6px;
}

.panel::-webkit-scrollbar-track {
    background: var(--background-color);
}

.panel::-webkit-scrollbar-thumb {
    background: var(--color-teal-900);
    border-radius: 3px;
}

/* Left Panel Tabs */
.left-tabs {
    display: flex;
    background: var(--button-color);
}

.left-tab-btn {
    flex: 1;
    padding: 12px;
    background: #23112f;
    color: #888;
    border: 1px solid var(--color-teal-900);
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
}

.left-tab-btn.active {
    background: #3f315f;
    color: #fcfcfc;
}

.left-tab-content {
    display: none;
    height: calc(100vh - 140px);
    overflow-y: auto;
}

.left-tab-content.active {
    display: block;
}

.panel-header {
    background: #180f1e;
    padding: 15px;
    border-bottom: 1px solid var(--color-teal-900);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.panel-title {
    color: var(--color-teal-900);
    font-size: 16px;
    font-weight: bold;
}

.time-toggle {
    display: flex;
    gap: 5px;
}

.time-btn {
    background: var(--background-color);
    color: #fff;
    border: 1px solid var(--color-teal-900);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
}

.time-btn.active {
    background: var(--color-teal-900);
    color: #fff;
}

.time-btn:hover {
    background: #8161bd;
}

/* Token Cards */
.token-list {
    padding: 10px;
}

.token-card {
    background: #17101f;
    border: 1px solid #431457;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    position: relative;
}

.token-card:hover {
    background: #2a1d33;
    border-color: #c346f9;
    transform: translateY(-2px);
}

.token-card.selected {
    border-color: #431457;
    background: #2a1d33;
}

.token-row1 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 8px;
}

.token-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.token-image {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    background: var(--background-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    border: 1px solid var(--color-teal-900);
}

.token-image img {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    object-fit: cover;
}

.token-name-info {
    min-width: 0;
}

.token-name {
    font-size: 13px;
    font-weight: bold;
    color: #fff;
}

.token-symbol {
    font-size: 11px;
    color: #888;
}

.token-right {
    text-align: right;
    font-size: 11px;
}

.token-price {
    font-size: 12px;
    font-weight: bold;
    color: var(--color-teal-900);
    margin-bottom: 2px;
}

.token-metrics {
    color: #ccc;
    line-height: 1.3;
}

.token-creator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--color-teal-900);
    font-size: 10px;
}

.creator-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--background-color);
    border: 1px solid var(--color-teal-900);
}

.creator-info {
    color: #888;
}

.creator-link {
    color: #7c4b93;
    text-decoration: none;
}

.creator-link:hover {
    text-decoration: underline;
}

.age-badge {
    position: absolute;
    bottom: 4px;
    right: 8px;
    background: var(--color-teal-900);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 9px;
    border: 1px solid var(--color-teal-900);
}

/* Center Panel */
.center-panel {
    display: flex;
    flex-direction: column;
}

.token-details {
    background: #23132d;
    border-bottom: 1px solid var(--color-teal-900);
    padding: 20px;
    display: none;
    position: relative;
}

.token-details.active {
    display: block;
}

.hide-show-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #571c71;
    color: white;
    border: 1px solid var(--color-teal-900);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
}

.details-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.token-info {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 15px;
}

.token-main-image {
    width: 150px;
    height: 150px;
    border-radius: 12px;
    background: var(--background-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
    border: 1px solid var(--color-teal-900);
}

.token-main-image img {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    object-fit: cover;
}

.token-main-info {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.token-title {
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    margin-bottom: 5px;
}

.token-ca {
    font-size: 12px;
    color: #888;
    word-break: break-all;
    margin-bottom: 10px;
}

.token-main-price {
    font-size: 20px;
    font-weight: bold;
    color: #861ab9;
    margin-bottom: 15px;
}

.token-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    font-size: 12px;
}

.stat-item {
    text-align: center;
    padding: 8px;
    background: var(--background-color);
    border-radius: 6px;
    border: 1px solid var(--color-teal-900);
}

.stat-label {
    color: #888;
    font-size: 10px;
    margin-bottom: 2px;
}

.stat-value {
    font-weight: bold;
    color: #fff;
}

.social-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.creator-info-panel {
    background: var(--background-color);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--color-teal-900);
}

.creator-title {
    color: #861ab9;
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 10px;
}

.creator-avatar-large {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--button-color);
    margin-bottom: 10px;
    border: 1px solid var(--color-teal-900);
}

.creator-details {
    font-size: 12px;
    line-height: 1.5;
}

.creator-details .label {
    color: #888;
}

.creator-details .value {
    color: #fff;
    margin-bottom: 8px;
}

.buy-now-btn {
    background: #8a63d2;
    color: white;
    border: 1px solid var(--color-teal-900);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 12px;
    margin-top: 10px;
}

.buy-now-btn:hover {
    background: #8161bd;
}

.uniswap-widget {
    background: #25122c;
    border-radius: 8px;
    padding: 15px;
    margin: 10px;
    display: none;
    position: sticky;
    top: 0;
    z-index: 20;
    border: 2px solid #25122c;
    height: calc(100vh - 120px); /* Giảm xuống để vừa */
    display: flex;
    flex-direction: column;
}

.uniswap-widget.active {
    display: flex;
}

.widget-title {
    color: #88887c;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 15px;
    text-align: center;
    flex-shrink: 0;
}

.widget-iframe {
    width: 100%;
    height: calc(100% - 150px); /* Trừ title và margin */
    border: 1px solid var(--color-teal-900);
    border-radius: 8px;
    background: var(--background-color);
}

.chart-container {
    flex: 1;
    background: var(--background-color);
    position: relative;
}

.chart-iframe {
    width: 100%;
    min-height: 600px;
    border: none;
}

.no-selection {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #888;
    font-size: 18px;
}

/* Right Panel Tabs */
.tabs {
    display: flex;
    background: var(--button-color);
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: transparent;
    color: #888;
    border: 1px solid var(--color-teal-900);
    cursor: pointer;
    font-size: 14px;
}

.tab-btn.active {
    background: var(--color-teal-900);
    color: #fff;
}

.tab-content {
    display: none;
    height: calc(100vh - 100px);
    overflow-y: auto;
}

.tab-content.active {
    display: block;
}

.token-table {
    width: 100%;
    border-collapse: collapse;
}

.token-table th,
.token-table td {
    padding: 8px 6px;
    text-align: left;
    border-bottom: 1px solid var(--color-teal-900);
    font-size: 11px;
}

.token-table th {
    background: #270f2d;
    color: #8161bd;
    position: sticky;
    top: 0;
    font-weight: bold;
}

.token-table tr {
    cursor: pointer;
}

.token-table tr:hover {
    background: var(--button-color);
}

.table-token-cell {
    display: flex;
    align-items: center;
    gap: 6px;
}

.table-token-image {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    background: var(--background-color);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    border: 1px solid var(--color-teal-900);
}

.table-token-image img {
    width: 100%;
    height: 100%;
    border-radius: 4px;
    object-fit: cover;
}

.table-token-info {
    min-width: 0;
}

.table-token-name {
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-token-symbol {
    color: #888;
    font-size: 9px;
}

/* Colors */
.positive { color: #00ff88; }
.negative { color: #ff4444; }

/* Flash animations */
.flash-green {
    animation: flashGreen 0.6s ease-in-out;
}

.flash-red {
    animation: flashRed 0.6s ease-in-out;
}

@keyframes flashGreen {
    0%, 100% { background-color: transparent; }
    50% { background-color: rgba(0, 255, 136, 0.3); }
}

@keyframes flashRed {
    0%, 100% { background-color: transparent; }
    50% { background-color: rgba(255, 68, 68, 0.3); }
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
        height: auto;
    }
    
    .panel {
        height: 400px;
    }
    
    .chart-container {
        min-height: 500px;
    }
    
    .details-grid {
        grid-template-columns: 1fr;
    }
    
    .token-info {
        grid-template-columns: 120px 1fr;
    }
    
    .token-main-image {
        width: 120px;
        height: 120px;
    }
    
    .social-links {
        display: none;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 10px 15px;
    }
    
    .logo h1 {
        font-size: 20px;
    }
    
    .token-row1 {
        grid-template-columns: 1fr;
        gap: 5px;
    }
    
    .token-right {
        text-align: left;
    }
    
    .token-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .token-info {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

.loading {
    text-align: center;
    padding: 20px;
    color: #888;
}

.error {
    color: #ff4444;
    text-align: center;
    padding: 20px;
}

.token-details.hidden {
    padding: 20px;
    height: 60px;
}

.token-details.hidden .details-grid {
    display: none;
}

.share-btn {
    background: #8a63d2;
    color: white;
    border: 1px solid var(--color-teal-900);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    justify-content: center;
    margin-top: 8px;
}

.share-btn:hover {
    background: #7952c4;
}

.share-btn svg {
    flex-shrink: 0;
}

#share-container {
    margin-top: 10px;
}

.token-name,
.table-token-name {
    white-space: normal !important;
    word-break: break-word;
    line-height: 1.2;
    max-width: 120px;
}

.token-name {
    max-height: 2.4em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.table-token-name {
    max-height: 3em;
    overflow: hidden;
}

.uniswap-widget.active ~ .tabs ~ .tab-content {
    height: calc(100vh - 800px);
}

/* Buy/Sell buttons trong token cards */
.buy-sell-buttons {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 70px;
    flex-shrink: 0;
}

.buy-btn, .sell-btn {
    width: 100%;
    padding: 6px 4px;
    border-radius: 4px;
    border: 1px solid;
    cursor: pointer;
    font-size: 9px;
    font-weight: bold;
    text-align: center;
}

.buy-btn {
    background: rgba(0, 255, 136, 0.1);
    color: #00ff88;
    border-color: #198b56;
}

.buy-btn:hover {
    background: rgba(0, 255, 136, 0.2);
    transform: translateY(-1px);
}

.sell-btn {
    background: rgba(255, 68, 68, 0.1);
    color: #ff4444;
    border-color: #ff4444;
}

.sell-btn:hover {
    background: rgba(255, 68, 68, 0.2);
    transform: translateY(-1px);
}

/* Desktop layout */
.token-row1 {
    display: grid;
    grid-template-columns: 1fr 100px;
    gap: 10px;
    margin-bottom: 8px;
    align-items: center;
}

.token-right {
    display: flex;
    justify-content: flex-end;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .token-row1 {
        grid-template-columns: 1fr 60px;
        gap: 8px;
    }
    
    .buy-sell-buttons {
        width: 60px;
        gap: 3px;
    }
    
    .buy-btn, .sell-btn {
        padding: 4px 2px;
        font-size: 8px;
    }
    
    .token-left {
        min-width: 0;
    }
    
    .token-name-info {
        min-width: 0;
    }
    
    .token-name {
        font-size: 11px;
        white-space: normal;
        word-break: break-word;
        line-height: 1.2;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
}