/* ==================== CSS Variables ==================== */
:root {
    --primary: #FF6B35;
    --primary-dark: #E55A2B;
    --primary-light: #FF8B5E;
    --secondary: #1a1a2e;
    --background: #0f0f1a;
    --surface: #16162a;
    --surface-light: #1e1e38;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #666680;
    --success: #00C853;
    --danger: #FF1744;
    --warning: #FFD600;
    --border: #2a2a45;
    --gradient-primary: linear-gradient(135deg, #FF6B35 0%, #FF8B5E 100%);
    --gradient-dark: linear-gradient(180deg, #1a1a2e 0%, #0f0f1a 100%);
    --shadow-primary: 0 4px 20px rgba(255, 107, 53, 0.3);
    --shadow-dark: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* ==================== Reset & Base ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ==================== Header ==================== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.brand-name {
    font-size: 1.75rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-tagline {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.header-center {
    display: flex;
    align-items: center;
}

.social-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--surface-light);
    border-radius: 50px;
    border: 1px solid var(--border);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.social-link:hover {
    border-color: var(--primary);
    background: rgba(255, 107, 53, 0.1);
    color: var(--primary);
}

.twitter-icon {
    flex-shrink: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--surface-light);
    border-radius: 50px;
    border: 1px solid var(--border);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
}

.status-dot.offline {
    background: var(--text-muted);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 1px;
}

/* ==================== Buttons ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(255, 107, 53, 0.4);
}

.btn-secondary {
    background: var(--surface-light);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
    width: 100%;
}

.btn-icon {
    font-size: 1.1rem;
}

.btn-wallet {
    background: linear-gradient(135deg, #AB9FF2 0%, #7B68EE 100%);
    color: white;
    border: none;
}

.btn-wallet:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(123, 104, 238, 0.4);
}

.btn-wallet svg {
    flex-shrink: 0;
}

/* ==================== Wallet Info ==================== */
.wallet-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--surface-light);
    border-radius: 50px;
    border: 1px solid var(--border);
}

.wallet-address {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 500;
}

.wallet-info .btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
}

#refreshBalance {
    padding: 0.4rem 0.5rem;
    min-width: auto;
}

/* ==================== Main Layout ==================== */
.main-container {
    display: flex;
    gap: 2rem;
    padding: 2rem;
    max-width: 1800px;
    margin: 0 auto;
}

/* ==================== Sidebar ==================== */
.sidebar {
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stat-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid var(--border);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.pnl-positive {
    color: var(--success);
}

.pnl-negative {
    color: var(--danger);
}

.settings-panel {
    background: var(--surface);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border);
    margin-top: 1rem;
}

.settings-panel h3 {
    font-size: 1rem;
    margin-bottom: 1.25rem;
    color: var(--primary);
}

.setting-item {
    margin-bottom: 1rem;
}

.setting-item label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.input-field {
    width: 100%;
    padding: 0.75rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

/* ==================== Content ==================== */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    min-width: 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

/* ==================== Search Section ==================== */
.search-section {
    background: var(--surface);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.search-box {
    display: flex;
    gap: 1rem;
}

.search-input {
    flex: 1;
    padding: 1rem 1.5rem;
    background: var(--background);
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* ==================== Target Section ==================== */
.target-section {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.1) 0%, rgba(255, 107, 53, 0.05) 100%);
    border-radius: 16px;
    padding: 1.5rem;
    border: 2px solid var(--primary);
}

.target-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1.5rem;
    align-items: center;
}

.target-token-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.target-token-logo {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--surface);
}

.target-token-name {
    font-size: 1.25rem;
    font-weight: 700;
}

.target-token-symbol {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.target-token-stats {
    display: flex;
    gap: 2rem;
}

.target-stat {
    text-align: center;
}

.target-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.target-stat-value {
    font-size: 1.1rem;
    font-weight: 600;
}

/* ==================== Analysis Section ==================== */
.analysis-section {
    background: var(--surface);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.analysis-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.analysis-signal {
    background: var(--background);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
}

.signal-badge {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.signal-badge.buy {
    background: rgba(0, 200, 83, 0.2);
    color: var(--success);
    border: 2px solid var(--success);
}

.signal-badge.sell {
    background: rgba(255, 23, 68, 0.2);
    color: var(--danger);
    border: 2px solid var(--danger);
}

.signal-badge.hold {
    background: rgba(255, 214, 0, 0.2);
    color: var(--warning);
    border: 2px solid var(--warning);
}

.confidence-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 1rem;
}

.confidence-fill {
    height: 100%;
    background: var(--gradient-primary);
    transition: width 0.5s ease;
}

.analysis-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.metric-item {
    background: var(--background);
    border-radius: 8px;
    padding: 1rem;
}

.metric-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.metric-value {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

.analysis-reasons {
    grid-column: 1 / -1;
    background: var(--background);
    border-radius: 12px;
    padding: 1rem;
}

.analysis-reasons h4 {
    font-size: 0.875rem;
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.reason-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.reason-item {
    background: var(--surface-light);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.analysis-action {
    grid-column: 1 / -1;
    display: flex;
    gap: 1rem;
}

/* ==================== Results Grid ==================== */
.results-section, .trending-section {
    background: var(--surface);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.results-grid, .trending-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.token-card {
    background: var(--background);
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.3s ease;
}

.token-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.token-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.token-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--surface);
}

.token-name {
    font-weight: 600;
    font-size: 1rem;
}

.token-symbol {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.token-card-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.token-stat {
    font-size: 0.75rem;
}

.token-stat-label {
    color: var(--text-muted);
}

.token-stat-value {
    font-weight: 600;
    margin-top: 0.25rem;
}

.token-stat-value.positive {
    color: var(--success);
}

.token-stat-value.negative {
    color: var(--danger);
}

.token-card-footer {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
}

/* ==================== Positions & History Tables ==================== */
.positions-section, .history-section {
    background: var(--surface);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.positions-table, .history-table {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th, .table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.table td {
    font-size: 0.875rem;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

/* ==================== Modal ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--surface);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.token-preview {
    background: var(--background);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.trade-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.trade-actions {
    display: flex;
    gap: 1rem;
}

.trade-type {
    flex: 1;
    opacity: 0.5;
}

.trade-type.active {
    opacity: 1;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.trade-summary {
    background: var(--background);
    border-radius: 8px;
    padding: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ==================== Toast ==================== */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--surface);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    border: 1px solid var(--primary);
    box-shadow: var(--shadow-primary);
    z-index: 1001;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toast-icon {
    font-size: 1.5rem;
}

.toast-message {
    font-size: 0.875rem;
}

/* ==================== Loading ==================== */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.loading::after {
    content: '';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* ==================== Responsive ==================== */
@media (max-width: 1200px) {
    .main-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .stat-card {
        flex: 1;
        min-width: 150px;
    }
    
    .settings-panel {
        width: 100%;
        margin-top: 0;
    }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .header-center {
        order: 3;
    }
    
    .header-right {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .wallet-info {
        order: -1;
        width: 100%;
        justify-content: center;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .target-card {
        grid-template-columns: 1fr;
    }
    
    .analysis-card {
        grid-template-columns: 1fr;
    }
    
    .results-grid, .trending-grid {
        grid-template-columns: 1fr;
    }
}
