* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #F5F5F0;
    color: #333;
    min-height: 100vh;
}

/* ============================================================================
   HEADER
   ============================================================================ */

.header {
    background: linear-gradient(135deg, #4A5568 0%, #2D3748 100%);
    color: white;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

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

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

.back-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-btn:hover {
    background: rgba(255,255,255,0.25);
}

.burger-btn {
    display: none;
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    margin-left: auto;
}

.header-nav {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.header-nav a, .header-nav button {
    color: white;
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    transition: background 0.2s;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.85rem;
}

.header-nav a:hover, .header-nav button:hover {
    background: rgba(255,255,255,0.1);
}

.header-nav a.active {
    background: rgba(255,255,255,0.2);
}

/* Mobile burger menu */
@media (max-width: 768px) {
    .header {
        padding: 0.75rem 1rem;
    }

    .burger-btn {
        display: block;
    }

    .header-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #2D3748;
        flex-direction: column;
        padding: 1rem;
        gap: 0.25rem;
        box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    }

    .header-nav.open {
        display: flex;
    }

    .header-nav a, .header-nav button {
        width: 100%;
        text-align: left;
        padding: 1rem 1.25rem;
        font-size: 1rem;
        min-height: 48px;
    }
}

/* ============================================================================
   CONTAINER & LAYOUT
   ============================================================================ */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.page-title {
    font-size: 1.5rem;
    color: #2D3748;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

/* ============================================================================
   CARDS
   ============================================================================ */

.card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: #4A5568;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #E2E8F0;
}

/* ============================================================================
   STATS GRID
   ============================================================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.stat-label {
    font-size: 0.85rem;
    color: #718096;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2D3748;
}

.stat-value.positive {
    color: #059669;
}

.stat-value.negative {
    color: #DC2626;
}

/* Generic positive/negative colors */
.positive {
    color: #059669;
}

.negative {
    color: #DC2626;
}

/* ============================================================================
   TABLES
   ============================================================================ */

.table-container {
    overflow-x: auto;
}

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

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #E2E8F0;
}

th {
    font-weight: 600;
    color: #4A5568;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #F7FAFC;
}

tr:hover {
    background: #F7FAFC;
}

tr.selected {
    background: #EDF2F7;
}

/* ============================================================================
   MOBILE CARD LIST (rendered conditionally via JS)
   ============================================================================ */

.mobile-card-list-visible {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.mobile-card {
    background: #F7FAFC;
    border-radius: 8px;
    padding: 0.75rem 1rem;
}

.mobile-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.mobile-card-token {
    font-weight: 600;
    color: #2D3748;
}

.mobile-card-mint {
    font-family: monospace;
    font-size: 0.75rem;
    color: #718096;
}

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

.mobile-card-field {
    font-size: 0.85rem;
    min-width: 0;
}

.mobile-card-label {
    color: #718096;
    font-size: 0.75rem;
}

.mobile-card-value {
    font-weight: 500;
    color: #2D3748;
}

.mobile-card-value.positive {
    color: #059669;
}

.mobile-card-value.negative {
    color: #DC2626;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: #4A5568;
    color: white;
}

.btn-primary:hover {
    background: #2D3748;
}

.btn-secondary {
    background: #E2E8F0;
    color: #4A5568;
}

.btn-secondary:hover {
    background: #CBD5E0;
}

.btn-success {
    background: #059669;
    color: white;
}

.btn-success:hover {
    background: #047857;
}

.btn-danger {
    background: #DC2626;
    color: white;
}

.btn-danger:hover {
    background: #B91C1C;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

/* ============================================================================
   FORMS
   ============================================================================ */

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-weight: 500;
    color: #4A5568;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-input, .form-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: #4A5568;
    box-shadow: 0 0 0 3px rgba(74, 85, 104, 0.1);
}

/* ============================================================================
   STATUS BADGES
   ============================================================================ */

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: #D1FAE5;
    color: #059669;
}

.badge-danger {
    background: #FEE2E2;
    color: #DC2626;
}

.badge-warning {
    background: #FEF3C7;
    color: #D97706;
}

.badge-info {
    background: #DBEAFE;
    color: #2563EB;
}

.badge-gray {
    background: #E2E8F0;
    color: #4A5568;
}

/* ============================================================================
   LOGIN PAGE
   ============================================================================ */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
    background: linear-gradient(135deg, #F5F5F0 0%, #E8E8E3 100%);
}

@media (min-width: 768px) {
    .login-container {
        align-items: center;
        padding-top: 0;
    }
}

.login-card {
    background: white;
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2D3748;
    text-align: center;
    margin-bottom: 2rem;
}

.login-error {
    background: #FEE2E2;
    color: #DC2626;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* ============================================================================
   STRATEGIES PAGE
   ============================================================================ */

.strategy-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 1rem;
    border-left: 4px solid #4A5568;
    transition: transform 0.2s, box-shadow 0.2s;
}

.strategy-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.strategy-card.inactive {
    opacity: 0.6;
    border-left-color: #CBD5E0;
}

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

.strategy-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2D3748;
}

.strategy-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.strategy-detail {
    font-size: 0.85rem;
}

.strategy-detail-label {
    color: #718096;
}

.strategy-detail-value {
    font-weight: 600;
    color: #2D3748;
}

.clickable {
    cursor: pointer;
}

.strategy-card.clickable {
    cursor: pointer;
}

.chevron {
    font-size: 1.5rem;
    color: #A0AEC0;
    font-weight: 300;
}

/* ============================================================================
   DETAIL PAGE
   ============================================================================ */

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.detail-item {
    padding: 0.75rem;
    background: #F7FAFC;
    border-radius: 8px;
}

.detail-label {
    font-size: 0.8rem;
    color: #718096;
    margin-bottom: 0.25rem;
}

.detail-value {
    font-weight: 600;
    color: #2D3748;
    word-break: break-all;
}

/* ============================================================================
   TELEGRAM CONNECT
   ============================================================================ */

.telegram-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.telegram-status.connected {
    background: #D1FAE5;
    color: #059669;
}

.telegram-status.disconnected {
    background: #FEE2E2;
    color: #DC2626;
}

.telegram-status.pending {
    background: #FEF3C7;
    color: #D97706;
}

/* ============================================================================
   TRADES LIST
   ============================================================================ */

.trade-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.trade-token {
    font-weight: 600;
    color: #2D3748;
    min-width: 100px;
}

.trade-mint {
    font-family: monospace;
    font-size: 0.8rem;
    color: #718096;
}

.trade-pnl {
    font-weight: 700;
    min-width: 80px;
    text-align: right;
}

.trade-pnl.positive {
    color: #059669;
}

.trade-pnl.negative {
    color: #DC2626;
}

/* ============================================================================
   MODAL
   ============================================================================ */

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

.modal {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2D3748;
    margin-bottom: 1.5rem;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #E2E8F0;
}

/* ============================================================================
   UTILITIES
   ============================================================================ */

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

.text-right {
    text-align: right;
}

.text-muted {
    color: #718096;
}

.text-small {
    font-size: 0.85rem;
}

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.flex {
    display: flex;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .header-nav {
        flex-wrap: wrap;
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .strategy-details {
        grid-template-columns: 1fr;
    }
}
