/* Social Sentinel - Bloomberg Terminal Inspired Social Intelligence CSS */


:root {
    /* Pure black terminal design - matching chat frontend */
    --bg-primary: #000000;          /* Pure black background */
    --bg-secondary: #000000;        /* Pure black secondary */
    --bg-tertiary: #000000;         /* Pure black tertiary */
    --bg-panel: #000000;            /* Pure black panels */
    
    /* Dynamic layout heights */
    --alert-height: 50px;           /* Collapsed alert panel height */
    --header-height: 60px;          /* Header bar height */
    
    /* Mobile grid section heights - initialize to prevent layout issues */
    --feed-height: 24vh;
    --activity-height: 24vh;
    --price-height: 24vh;
    
    /* Primary color - matching chat frontend */
    --social-primary: #4a90e2;      /* Primary blue from chat */
    --social-secondary: #4a90e2;    /* Keep consistent with primary */
    --social-accent: #4a90e2;       /* Keep consistent with primary */
    
    /* Sentiment colors - keeping vibrant for visibility */
    --sentiment-bullish: #3ECF8E;   /* Green from chat frontend */
    --sentiment-bearish: #FF7B72;   /* Red from chat frontend */
    --sentiment-neutral: #4a90e2;   /* Blue neutral */
    
    /* Alert colors - adjusted for black background */
    --alert-warning: #F1C40F;       /* Yellow from chat frontend */
    --alert-danger: #FF7B72;        /* Red from chat frontend */
    --alert-success: #3ECF8E;       /* Green from chat frontend */
    
    /* Connection status colors */
    --status-connected: #3ECF8E;    /* Green from chat frontend */
    --status-disconnected: #FF7B72; /* Red from chat frontend */
    
    /* Text colors - matching chat frontend */
    --text-primary: #EAEAEA;        /* Primary text from chat */
    --text-secondary: #AAAAAA;      /* Secondary text */
    --text-muted: #888888;          /* Muted text */
    --text-accent: #4a90e2;         /* Blue accent text */
    
    /* Border and UI - minimal borders on black */
    --border-color: #2A2A2A;        /* Subtle border from chat */
    --border-accent: #4a90e2;       /* Blue accent border */
    --shadow-color: rgba(0, 0, 0, 0.5);
    
    /* Typography - matching chat frontend */
    --font-mono: 'Fira Code', 'SF Mono', 'Menlo', 'Consolas', monospace;
    --font-size-xs: 10px;
    --font-size-sm: 11px;
    --font-size-base: 14px;         /* Match chat base size */
    --font-size-lg: 16px;
    --font-size-xl: 18px;
}

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

body {
    font-family: var(--font-mono);
    font-size: var(--font-size-base);
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Mobile Tab Navigation - Hidden by default (desktop) */
.mobile-tab-navigation {
    display: none;
}

.mobile-tab {
    flex: 1;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 10px;
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: 4px;
}

.mobile-tab:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.mobile-tab.active {
    background: var(--social-primary);
    color: var(--text-primary);
    border-color: var(--social-primary);
}

/* Mobile spacing helper - keeps content above alert panel */
@media (max-width: 768px) {
    body {
        padding-bottom: var(--alert-height);
    }
    
    /* When alert panel is expanded, increase the height */
    body.alert-expanded {
        --alert-height: 160px;
    }
}

/* Mobile-specific body adjustments */
@media (max-width: 768px) {
    body {
        overflow-x: hidden; /* Prevent horizontal scrolling */
        overflow-y: auto; /* Allow vertical scrolling on mobile */
    }
    
    .terminal-container {
        height: 100vh; /* Ensure full height */
        overflow-y: auto; /* Allow container to scroll */
    }
}

.terminal-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Bar */
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    min-height: 60px;
}

.logo {
    display: flex;
    flex-direction: column;
}

.logo-text {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--social-primary);
    letter-spacing: 2px;
}

.logo-subtitle {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.header-stats {
    display: flex;
    gap: 30px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-accent);
}

.stat-value.alert-count {
    color: var(--alert-warning);
}

.system-time {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    font-weight: 500;
}

/* Connection Status - matching chat frontend */
.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    border-radius: 9999px; /* rounded-full */
    font-size: var(--font-size-xs);
    font-weight: 500;
    letter-spacing: 0.5px;
    transition: all 0.2s;
}

.connection-status.connected {
    background: rgba(62, 207, 142, 0.2); /* dark:bg-green-900/20 */
    color: var(--status-connected); /* dark:text-green-400 */
    border: 1px solid rgba(62, 207, 142, 0.3);
}

.connection-status.disconnected {
    background: rgba(255, 123, 114, 0.2); /* dark:bg-red-900/20 */
    color: var(--status-disconnected); /* dark:text-red-400 */
    border: 1px solid rgba(255, 123, 114, 0.3);
}

.wifi-icon {
    width: 12px;
    height: 12px;
    stroke-width: 2;
}


/* Main Grid Layout */
.main-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 10px;
    padding: 10px;
    flex: 1;
    overflow: hidden;
}

/* Panel Base Styles */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    min-height: 50px;
}

.panel-header h3 {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--social-primary);
    letter-spacing: 1px;
}

/* Feed Panel (Left 2/3) */
.feed-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.feed-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.filter-select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 4px 8px;
    font-size: var(--font-size-xs);
    font-family: var(--font-mono);
}

.sentiment-filter {
    display: flex;
    gap: 2px;
}

.sentiment-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 3px 8px;
    font-size: var(--font-size-xs);
    font-family: var(--font-mono);
    cursor: pointer;
    transition: all 0.2s;
}

.sentiment-btn:hover {
    color: var(--text-primary);
}

.sentiment-btn.active {
    background: var(--social-primary);
    color: var(--text-primary);
    border-color: var(--social-primary);
}

.sentiment-btn.positive {
    border-color: var(--sentiment-bullish);
}

.sentiment-btn.positive.active {
    background: var(--sentiment-bullish);
}

.sentiment-btn.negative {
    border-color: var(--sentiment-bearish);
}

.sentiment-btn.negative.active {
    background: var(--sentiment-bearish);
}

.feed-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.feed-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 12px;
    transition: border-color 0.2s;
}

.feed-item:hover {
    border-color: var(--social-primary);
}

.feed-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--social-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xs);
    font-weight: 600;
}

.username {
    font-weight: 600;
    color: var(--text-primary);
}

.handle {
    color: var(--text-muted);
    font-size: var(--font-size-xs);
}

.post-time {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.feed-item-content {
    margin-bottom: 8px;
    line-height: 1.4;
}

.feed-item-metrics {
    display: flex;
    gap: 15px;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.metric {
    display: flex;
    align-items: center;
    gap: 4px;
}

.sentiment-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 8px;
}

.sentiment-indicator.positive { background: var(--sentiment-bullish); }
.sentiment-indicator.negative { background: var(--sentiment-bearish); }
.sentiment-indicator.neutral { background: var(--sentiment-neutral); }

/* Right Panels Container */
.right-panels {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
}

/* Influencer Panel */
.influencer-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.activity-filter select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 4px 8px;
    font-size: var(--font-size-xs);
    font-family: var(--font-mono);
}

.activity-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 8px;
    transition: border-color 0.2s;
    font-size: var(--font-size-sm);
}

.activity-item:hover {
    border-color: var(--social-secondary);
}

.activity-time {
    color: var(--text-muted);
    font-size: var(--font-size-xs);
    min-width: 35px;
}

.activity-text {
    flex: 1;
    color: var(--text-primary);
}

.activity-text .follower {
    color: var(--social-primary);
    font-weight: 600;
}

.activity-text .followed {
    color: var(--social-secondary);
    font-weight: 600;
}

.activity-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--sentiment-bullish);
    flex-shrink: 0;
}

/* Price Panel */
.price-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.price-filter select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 4px 8px;
    font-size: var(--font-size-xs);
    font-family: var(--font-mono);
}

.price-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 8px;
    padding: 12px;
    flex: 1;
    overflow-y: auto;
}

.price-square {
    aspect-ratio: 1;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    border: 1px solid var(--border-color);
    text-align: center;
    padding: 8px;
}

.price-square:hover {
    transform: scale(1.05);
    border-color: var(--text-accent);
}

.price-square.positive {
    background: linear-gradient(135deg, var(--sentiment-bullish), rgba(0, 255, 136, 0.2));
    color: var(--text-primary);
}

.price-square.negative {
    background: linear-gradient(135deg, var(--sentiment-bearish), rgba(255, 71, 87, 0.2));
    color: var(--text-primary);
}

.price-square.neutral {
    background: linear-gradient(135deg, var(--sentiment-neutral), rgba(112, 161, 255, 0.2));
    color: var(--text-primary);
}

.price-symbol {
    font-size: var(--font-size-sm);
    font-weight: 700;
    margin-bottom: 2px;
}

.price-change {
    font-size: var(--font-size-xs);
    font-weight: 500;
}

.price-value {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: 1px;
}

/* Alert Panel - Collapsible */
.alert-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-top: 2px solid var(--alert-warning);
    height: 50px; /* Collapsed height - just header */
    display: flex;
    flex-direction: column;
    margin: 16px;
    margin-top: 0;
    border-radius: 6px;
    transition: height 0.3s ease-in-out;
    overflow: hidden;
    position: relative;
}

.alert-panel.expanded {
    height: 200px; /* Expanded height */
}

.alert-header {
    cursor: pointer;
    user-select: none;
}

.alert-header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.expand-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 3px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.expand-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.expand-icon {
    transition: transform 0.3s ease-in-out;
}

.alert-panel.expanded .expand-icon {
    transform: rotate(180deg);
}

.add-alert-btn {
    background: var(--alert-warning);
    border: none;
    color: var(--bg-primary);
    padding: 4px 12px;
    font-size: var(--font-size-xs);
    font-family: var(--font-mono);
    font-weight: 600;
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.2s;
}

.add-alert-btn:hover {
    background: #e67e22;
}

.alert-rules {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    display: flex;
    gap: 12px;
}

.alert-rule {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--alert-warning);
    padding: 12px;
    border-radius: 6px;
    min-width: 220px;
    font-size: var(--font-size-sm);
}

.alert-rule-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.alert-type {
    font-weight: 600;
    color: var(--alert-warning);
}

.alert-status {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.alert-target {
    color: var(--text-primary);
    margin-bottom: 2px;
}

.alert-threshold {
    color: var(--text-muted);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: var(--bg-panel);
    border: 2px solid var(--social-primary);
    border-radius: 6px;
    width: 400px;
    max-width: 90vw;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    color: var(--social-primary);
    font-size: var(--font-size-lg);
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.modal-content {
    padding: 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
    border-radius: 3px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--social-primary);
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.btn-primary,
.btn-secondary {
    padding: 8px 16px;
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary {
    background: var(--social-primary);
    color: var(--text-primary);
}

.btn-primary:hover {
    background: #357abd;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    color: var(--text-primary);
    border-color: var(--border-accent);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-accent);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .main-grid {
        grid-template-columns: 1fr;
        grid-template-rows: 2fr 1fr;
    }
    
    .right-panels {
        flex-direction: row;
    }
    
    .price-grid {
        grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    }
}

@media (max-width: 768px) and (min-width: 481px) {
    /* Header optimizations for tablets only (not mobile phones) */
    .header-bar {
        padding: 8px 12px;
        min-height: 50px;
    }
    
    .header-stats {
        gap: 12px;
    }
    
    .stat-item {
        min-width: 50px;
    }
    
    .logo-text {
        font-size: var(--font-size-lg);
    }
    
    .logo-subtitle {
        display: none; /* Hide subtitle on smaller screens */
    }
    
    
    /* Feed controls */
    .feed-controls {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }
    
    .sentiment-filter {
        justify-content: space-between;
    }
    
    .sentiment-btn {
        padding: 6px 8px;
        min-height: 32px; /* Better touch target */
        flex: 1;
        text-align: center;
    }
    
    /* Main grid adjustments */
    .main-grid {
        padding: 8px;
        gap: 8px;
    }
    
    .right-panels {
        flex-direction: column;
        min-height: 35vh; /* Ensure panels are visible on tablets */
    }
    
    .right-panels > * {
        min-height: 160px; /* Ensure each panel has minimum readable height */
    }
    
    /* Feed item optimizations */
    .feed-item {
        padding: 12px;
        margin-bottom: 8px;
    }
    
    .feed-item-header {
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .user-info {
        flex: 1;
        min-width: 0; /* Prevent text overflow */
    }
    
    .username, .handle {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Alert panel adjustments */
    .alert-panel {
        height: 45px; /* Collapsed height on tablets */
        margin: 8px;
    }
    
    .alert-panel.expanded {
        height: 180px; /* Expanded height on tablets */
    }
    
    .alert-rules {
        flex-direction: column;
        gap: 8px;
    }
    
    .alert-rule {
        min-width: auto;
    }
    
    /* Modal improvements */
    .modal {
        width: 90vw;
        max-width: 350px;
        margin: 0 16px;
    }
    
    .modal-content {
        padding: 12px;
    }
    
    .modal-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .btn-primary, .btn-secondary {
        width: 100%;
        min-height: 40px; /* Better touch target */
        justify-content: center;
        display: flex;
        align-items: center;
    }
}

@media (max-width: 768px) {
    /* Mobile phone optimizations */
    
    /* Header - more compact */
    .header-bar {
        flex-wrap: wrap;
        gap: 8px;
        padding: 8px;
        min-height: auto;
    }
    
    .logo {
        order: 1;
        flex: 1;
    }
    
    .connection-status {
        order: 2;
        font-size: var(--font-size-xs);
        padding: 2px 8px;
    }
    
    .header-stats {
        order: 3;
        width: 100%;
        justify-content: space-around;
        gap: 8px;
        padding-top: 8px;
        border-top: 1px solid var(--border-color);
    }
    
    .stat-item {
        min-width: auto;
        flex: 1;
    }
    
    .stat-label {
        font-size: 9px;
    }
    
    .stat-value {
        font-size: var(--font-size-base);
    }
    
    
    /* Panel headers more compact */
    .panel-header {
        padding: 8px 12px;
        min-height: 50px;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .panel-header h3 {
        font-size: var(--font-size-xs);
        text-align: center;
        margin-bottom: 4px;
    }
    
    /* Feed controls layout on mobile */
    .feed-controls {
        justify-content: space-between;
        align-items: center;
        flex-direction: row !important; /* Override the tablet column layout */
        gap: 8px;
    }
    
    .filter-select {
        min-width: 120px;
        flex-shrink: 0;
    }
    
    .sentiment-filter {
        justify-content: flex-start;
        flex: 1;
        gap: 4px;
    }
    
    .sentiment-btn {
        flex: 1;
        max-width: 45px;
        padding: 4px 2px;
        font-size: 9px;
        text-align: center;
    }
    
    /* Feed optimizations */
    .feed-content {
        padding: 8px;
    }
    
    .feed-item {
        padding: 8px;
        border-radius: 4px;
    }
    
    .user-avatar {
        width: 20px;
        height: 20px;
        font-size: 8px;
    }
    
    .username {
        font-size: var(--font-size-sm);
        max-width: 120px;
    }
    
    .handle {
        max-width: 80px;
    }
    
    .feed-item-content {
        font-size: var(--font-size-sm);
        line-height: 1.3;
    }
    
    .feed-item-metrics {
        gap: 8px;
        flex-wrap: wrap;
    }
    
    /* Right panels adjustments */
    .activity-list, .price-grid {
        padding: 8px;
    }
    
    .activity-item {
        padding: 8px;
        font-size: var(--font-size-xs);
        gap: 6px;
    }
    
    .activity-time {
        min-width: 25px;
        font-size: 9px;
    }
    
    /* Price grid - smaller squares for mobile */
    .price-grid {
        grid-template-columns: repeat(auto-fit, minmax(45px, 1fr));
        gap: 4px;
    }
    
    .price-square {
        padding: 4px;
        font-size: var(--font-size-xs);
    }
    
    .price-symbol {
        font-size: var(--font-size-xs);
    }
    
    .price-change, .price-value {
        font-size: 9px;
    }
    
    /* Alert panel mobile - FIXED at bottom, completely outside grid */
    .alert-panel {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        height: 50px !important; /* FIXED height */
        margin: 0 !important;
        border-radius: 0;
        z-index: 1000;
        transition: all 0.3s ease-in-out;
        display: flex;
        flex-direction: column;
        /* DEBUG: Make it super visible */
        background: var(--bg-panel) !important;
        border: 2px solid var(--alert-warning) !important;
        border-bottom: none;
        overflow: hidden; /* Hide overflowing content when collapsed */
    }
    
    .alert-panel.expanded {
        position: absolute; /* Break out of grid when expanded */
        bottom: 0;
        left: 0;
        right: 0;
        height: 160px !important; /* Expanded height overlays others */
        z-index: 9999; /* Top priority when expanded */
        box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
    }
    
    /* Ensure alert panel header is properly sized on mobile */
    .alert-panel .panel-header {
        min-height: 40px;
        padding: 4px 12px;
        flex-shrink: 0; /* Don't shrink the header */
        font-size: var(--font-size-xs);
        justify-content: center; /* Center the title when collapsed */
        align-items: center;
    }
    
    .alert-panel .panel-header h3 {
        font-size: var(--font-size-xs);
        margin: 0;
        flex: 1;
        text-align: center; /* Center the text */
    }
    
    /* Hide controls when panel is collapsed (not expanded) */
    .alert-panel:not(.expanded) .alert-header-controls {
        display: none;
    }
    
    /* Show controls when panel is expanded */
    .alert-panel.expanded .panel-header {
        justify-content: space-between; /* Restore normal layout when expanded */
    }
    
    .alert-panel.expanded .panel-header h3 {
        text-align: left; /* Restore left alignment when expanded */
        flex: initial;
    }
    
    .alert-panel .add-alert-btn {
        font-size: var(--font-size-xs);
        padding: 2px 8px;
        min-height: 28px;
    }
    
    .alert-panel .alert-rules {
        flex: 1;
        overflow-y: auto;
        padding: 8px;
    }
    
    /* Hide scrollbars when alert panel is collapsed for ultra-clean look */
    .alert-panel:not(.expanded) .alert-rules {
        overflow: hidden; /* Hide all scrollbars when collapsed */
    }
    
    .alert-rule {
        padding: 8px;
        font-size: var(--font-size-xs);
    }
    
    .add-alert-btn {
        padding: 6px 10px;
        font-size: var(--font-size-xs);
        min-height: 32px;
    }
    
    /* Modal mobile optimizations */
    .modal {
        width: calc(100vw - 16px);
        max-width: none;
        max-height: calc(100vh - 32px);
        margin: 16px 8px;
        border-radius: 4px;
    }
    
    .modal-header {
        padding: 8px 12px;
    }
    
    .modal-header h3 {
        font-size: var(--font-size-base);
    }
    
    .form-group {
        margin-bottom: 12px;
    }
    
    .form-group input,
    .form-group select {
        padding: 10px 12px;
        font-size: var(--font-size-base);
        min-height: 40px; /* Better touch target */
        border-radius: 4px;
    }
    
    /* Hide less important elements on very small screens */
    .connection-status span {
        display: none; /* Keep only the icon */
    }
    
    .wifi-icon {
        width: 16px;
        height: 16px;
    }
    
    /* Improve touch targets for all interactive elements */
    .filter-select {
        min-height: 36px;
        padding: 6px 8px;
        font-size: var(--font-size-sm);
    }
    
    /* Ensure proper spacing in main grid */
    .main-grid {
        padding: 4px;
        gap: 4px;
        height: calc(100vh - 80px); /* Adjust based on header height only */
    }
    
    /* COMMENTED OUT - Using tabs instead of resizable grid
    .main-grid {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: 
            var(--feed-height, 24vh) 
            8px 
            var(--activity-height, 24vh) 
            8px 
            var(--price-height, 24vh);
        height: calc(100dvh - var(--header-height) - var(--alert-height));
        max-height: calc(100dvh - var(--header-height) - var(--alert-height));
        overflow: hidden;
    }
    */
    
    /* Show mobile tab navigation */
    .mobile-tab-navigation {
        display: flex;
        gap: 4px;
        margin-bottom: 8px;
        background: var(--bg-primary);
        padding: 4px;
        border: 1px solid var(--border-color);
        border-radius: 6px;
    }
    
    /* Hide panels based on active tab */
    .feed-panel:not(.mobile-active),
    .influencer-panel:not(.mobile-active),
    .price-panel:not(.mobile-active) {
        display: none !important;
    }
    
    /* When a panel is active on mobile, make it take full available space */
    .feed-panel.mobile-active,
    .influencer-panel.mobile-active,
    .price-panel.mobile-active {
        flex: 1;
        display: flex;
        flex-direction: column;
        height: calc(100dvh - var(--header-height) - var(--alert-height) - 60px); /* Account for tab nav */
        max-height: calc(100dvh - var(--header-height) - var(--alert-height) - 60px);
        overflow: hidden;
    }
    
    /* Adjust main grid for tab-based display */
    .main-grid {
        display: flex;
        flex-direction: column;
        height: calc(100dvh - var(--header-height) - var(--alert-height));
        max-height: calc(100dvh - var(--header-height) - var(--alert-height));
        overflow: hidden;
    }
    
    /* Hide resize handles when using tabs */
    .resize-handle {
        display: none !important;
    }
    
    .feed-panel {
        overflow: hidden;
        display: flex;
        flex-direction: column;
        min-height: 100px; /* Absolute minimum */
    }
    
    .feed-content {
        flex: 1;
        overflow-y: auto;
        padding: 8px;
    }
    
    .right-panels {
        display: contents; /* Let children participate in the grid directly */
    }
    
    .influencer-panel {
        overflow: hidden;
        display: flex;
        flex-direction: column;
        min-height: 60px; /* Absolute minimum for header + dropdown */
    }
    
    .price-panel {
        overflow: hidden;
        display: flex;
        flex-direction: column;
        min-height: 60px; /* Absolute minimum for header + dropdown */
    }
    
    /* When using tabs, let content fill available space */
    .influencer-panel.mobile-active .activity-list,
    .price-panel.mobile-active .price-grid {
        flex: 1;
        overflow-y: auto;
        padding: 8px;
        max-height: none; /* Remove height restrictions when in tab mode */
    }
    
    .price-panel.mobile-active .price-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(45px, 1fr));
        gap: 4px;
        align-content: start;
    }
}

@media (max-width: 320px) {
    /* Extra small phones */
    
    .header-stats {
        gap: 4px;
    }
    
    .stat-label {
        font-size: 8px;
    }
    
    .stat-value {
        font-size: var(--font-size-sm);
    }
    
    .price-grid {
        grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
        gap: 2px;
    }
    
    .price-square {
        padding: 2px;
    }
    
    .price-symbol {
        font-size: 8px;
    }
    
    .price-change, .price-value {
        font-size: 7px;
    }
    
    .panel-header h3 {
        font-size: 9px;
    }
    
    .username {
        max-width: 100px;
    }
    
    .handle {
        max-width: 60px;
    }
}

/* Animation for live updates */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.live-update {
    animation: pulse 1s ease-in-out;
}

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

.feed-item.new {
    animation: slideIn 0.5s ease-out;
}

/* Resize Handles - Mobile Only */
.resize-handle {
    display: none; /* Hidden by default */
    background: var(--border-color);
    position: relative;
    cursor: row-resize;
    user-select: none;
    touch-action: none;
    transition: background-color 0.2s;
}

.resize-handle:hover,
.resize-handle:active {
    background: var(--border-accent);
}

.resize-handle.horizontal-handle {
    height: 8px;
    width: 100%;
    cursor: row-resize;
}

.resize-handle.vertical-handle {
    height: 8px;
    width: 100%;
    cursor: row-resize;
}

.handle-line {
    position: absolute;
    background: var(--text-muted);
    border-radius: 2px;
    transition: background-color 0.2s;
}

.horizontal-handle .handle-line {
    height: 2px;
    width: 40px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.vertical-handle .handle-line {
    height: 2px;
    width: 40px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.resize-handle:hover .handle-line,
.resize-handle:active .handle-line {
    background: var(--social-primary);
}

/* Tooltip styles */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: 3px;
    font-size: var(--font-size-xs);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    border: 1px solid var(--border-color);
}

.tooltip:hover::after {
    opacity: 1;
}

/* Future-proof dynamic alert height system using CSS custom properties */
/* This replaces magic numbers with dynamic values that JS can update */
@media (max-width:480px){
  .main-grid,
  .price-panel,
  .price-grid {   /* any scrollable child */
      padding-bottom:50px;   /* matches collapsed alert height  */
  }
}
