/**
 * 🦢 Community Swan Dashboard Styles
 * =================================
 * 
 * CSS styling for the revolutionary Community Swan Dashboard that transforms
 * ethical investing into a collaborative social experience.
 * 
 * @author MunkSwan Philosophy + Claude Sonnet 4 Implementation
 * @version 1.0.0 - Community Foundation Release
 * @created November 29, 2025
 */

/* 🦢 Community Swan Dashboard Styles */
.swan-dashboard-container {
    margin: 2rem 0;
    padding: 0;
}

.swan-dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

/* Community Stats Bar (Compact) */
.community-stats {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.community-stats .stat-item {
    flex: 0 0 auto;
    width: fit-content;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    text-align: left;
    min-width: 0; /* Prevent overflow */
}

.community-stats .stat-value {
    margin: 0;
    font-size: 1.1rem;
}

.community-stats .stat-label {
    font-size: 0.8rem;
    white-space: nowrap;
}

.dashboard-title h2 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.5rem;
}

.dashboard-subtitle {
    margin: 0.25rem 0 0 0;
    color: var(--text-secondary);
    font-style: italic;
}

.dashboard-status {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.connection-status {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.connection-status.connected {
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.connection-status.offline {
    background: rgba(244, 67, 54, 0.2);
    color: #F44336;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

.user-reputation {
    padding: 0.5rem 1rem;
    background: var(--accent-color, #FFB74D);
    color: var(--background-color);
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.empty-state-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
    background: rgba(0,0,0,0.02);
    border-radius: 8px;
    border: 2px dashed var(--border-color);
}

.empty-state-container h3 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
}

.empty-state-container p {
    margin: 0 0 1.5rem 0;
    color: var(--text-secondary);
    max-width: 300px;
}

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

.dashboard-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.dashboard-card h3 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.card-header h3 {
    margin: 0;
}

.refresh-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.refresh-btn:hover {
    background: var(--hover-color);
    color: var(--primary-color);
}

.refresh-icon {
    display: inline-block;
    transition: transform 0.5s ease;
}

.refresh-btn:hover .refresh-icon {
    transform: rotate(180deg);
}

/* Global Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background: var(--background-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Top Stocks */
.top-stocks-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.top-stock-item {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 1rem;
    align-items: center;
    padding: 0.75rem;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.top-stock-item:hover {
    background: var(--hover-color);
    transform: translateX(4px);
}

.stock-rank {
    font-weight: 700;
    color: var(--accent-color);
    font-size: 1.1rem;
}

.stock-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

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

.stock-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.stock-swan-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.swan-score {
    font-weight: 700;
    font-size: 1.1rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.swan-score.a { color: #4CAF50; background: rgba(76, 175, 80, 0.1); }
.swan-score.b { color: #8BC34A; background: rgba(139, 195, 74, 0.1); }
.swan-score.c { color: #FFC107; background: rgba(255, 193, 7, 0.1); }
.swan-score.d { color: #FF9800; background: rgba(255, 152, 0, 0.1); }
.swan-score.f { color: #F44336; background: rgba(244, 67, 54, 0.1); }

.swan-grade {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.stock-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    font-size: 0.8rem;
}

.community-votes {
    color: var(--text-secondary);
}

.trend {
    font-weight: 500;
}

.trend.up { color: #4CAF50; }
.trend.down { color: #F44336; }

/* Community Insights */
.insights-list, .activity-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.insight-item, .activity-item {
    padding: 1rem;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.insight-item:hover, .activity-item:hover {
    background: var(--hover-color);
}

.insight-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.insight-author {
    color: var(--primary-color);
    font-weight: 500;
}

.insight-time {
    color: var(--text-secondary);
}

.insight-content {
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 0.75rem;
}

.insight-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Activity Feed */
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.activity-icon {
    font-size: 1.2rem;
    margin-top: 0.1rem;
}

.activity-content {
    flex: 1;
}

.activity-text {
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.activity-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.activity-user {
    color: var(--primary-color);
    font-weight: 500;
}

/* Trending Discussions */
.discussions-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.discussion-item {
    padding: 1rem;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.discussion-item:hover {
    background: var(--hover-color);
    border-color: var(--primary-color);
}

.discussion-title {
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.discussion-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Contribution Center */
.contribution-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.contribute-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    font-size: 0.9rem;
}

.contribute-btn:hover {
    background: var(--primary-color);
    color: var(--background-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(78, 205, 196, 0.3);
}

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

/* Modal Styles */
.swan-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.swan-modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
}

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

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

.modal-body {
    padding: 1.5rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--background-color);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(78, 205, 196, 0.2);
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.submit-btn, .cancel-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

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

.submit-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

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

.cancel-btn:hover {
    background: var(--hover-color);
}

/* Success Toast */
.success-toast {
    animation: slideIn 0.3s ease-out;
}

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

/* Review and Peer Validation Styles */
.pending-reviews {
    margin: 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

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

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

.review-author {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.review-content {
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 0.75rem;
}

.review-actions {
    display: flex;
    gap: 0.5rem;
}

.approve-btn, .reject-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.approve-btn {
    background: rgba(76, 175, 80, 0.1);
    color: #4CAF50;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.approve-btn:hover {
    background: #4CAF50;
    color: white;
}

.reject-btn {
    background: rgba(244, 67, 54, 0.1);
    color: #F44336;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

.reject-btn:hover {
    background: #F44336;
    color: white;
}

/* Discussion View Styles */
.discussion-view {
    max-height: 60vh;
    overflow-y: auto;
}

.discussion-messages {
    margin: 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem;
    background: var(--background-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.message-item {
    padding: 0.75rem;
    background: var(--surface-color);
    border-radius: 6px;
    border-left: 3px solid var(--primary-color);
}

.message-item:last-child {
    border-left-color: var(--accent-color);
    background: var(--hover-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .swan-dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .dashboard-status {
        align-self: stretch;
        justify-content: space-between;
    }
    
    .top-stock-item {
        grid-template-columns: auto 1fr auto;
        gap: 0.75rem;
    }
    
    .stock-stats {
        flex-direction: row;
        gap: 0.5rem;
    }
    
    .contribution-options {
        gap: 0.5rem;
    }
    
    .contribute-btn {
        padding: 0.75rem;
        font-size: 0.85rem;
    }
    
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .submit-btn, .cancel-btn {
        width: 100%;
    }
    
    .dashboard-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .action-button {
        width: 200px;
        justify-content: center;
    }

    /* Mobile Table Optimization */
    .swan-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .swan-table th, .swan-table td {
        padding: 0.75rem 0.5rem;
    }
    
    /* Hide less important columns on very small screens */
    @media (max-width: 480px) {
        .swan-table th:nth-child(3), .swan-table td:nth-child(3), /* Source */
        .swan-table th:nth-child(4), .swan-table td:nth-child(4)  /* Sector */
        {
            display: none;
        }
    }
}

/* Dashboard Actions */
.dashboard-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border-color);
    margin-top: 2rem;
}

.action-button {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.action-button:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

/* P2P Network Status Bar */
.p2p-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(16, 185, 129, 0.1); /* Subtle green tint */
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    border-radius: 4px;
}

.p2p-status-bar .status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.p2p-status-bar .status-item i {
    color: var(--primary-color);
}

.p2p-status-bar .status-online {
    color: var(--success-color);
    font-weight: bold;
    text-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
}

/* Dashboard Grid Layout */
.swan-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
}

@media (min-width: 1400px) {
    .swan-dashboard-grid {
        grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    }
}

/* Swan Leaderboard */
.leaderboard-header-row {
    display: grid;
    grid-template-columns: 40px 1fr 80px 140px;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    font-weight: bold;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
    background: var(--surface-color-hover);
    border-radius: 4px 4px 0 0;
}

.leaderboard-header-row span:nth-child(3) {
    text-align: center;
}

.leaderboard-header-row span:nth-child(4) {
    text-align: right;
}

.leaderboard-content {
    max-height: 400px;
    overflow-y: auto;
}

.leaderboard-item {
    display: grid;
    grid-template-columns: 40px 1fr 80px 140px;
    align-items: center;
    gap: 10px;
    padding: 12px 12px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s ease;
}

.leaderboard-item:hover {
    background: var(--background-color);
    border-radius: 4px;
}

.leaderboard-rank {
    font-weight: bold;
    color: var(--accent-color);
}

.leaderboard-symbol {
    font-weight: bold;
}

.leaderboard-swan-score {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: bold;
    text-align: center;
    width: fit-content;
    justify-self: center;
}

.consensus-badge {
    background: var(--background-color);
    color: var(--text-secondary);
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.75rem;
    border: 1px solid var(--border-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    justify-self: end;
    max-width: 100%;
}

/* Scrollable Panel Content Areas */
.esg-content,
.voting-content,
.research-content,
.leaderboard-content,
.predictions-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem; /* Prevent content from hiding behind scrollbar */
}

/* Custom Scrollbar for Panels */
.esg-content::-webkit-scrollbar,
.voting-content::-webkit-scrollbar,
.research-content::-webkit-scrollbar,
.leaderboard-content::-webkit-scrollbar,
.predictions-list::-webkit-scrollbar {
    width: 6px;
}

.esg-content::-webkit-scrollbar-track,
.voting-content::-webkit-scrollbar-track,
.research-content::-webkit-scrollbar-track,
.leaderboard-content::-webkit-scrollbar-track,
.predictions-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

.esg-content::-webkit-scrollbar-thumb,
.voting-content::-webkit-scrollbar-thumb,
.research-content::-webkit-scrollbar-thumb,
.leaderboard-content::-webkit-scrollbar-thumb,
.predictions-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.esg-content::-webkit-scrollbar-thumb:hover,
.voting-content::-webkit-scrollbar-thumb:hover,
.research-content::-webkit-scrollbar-thumb:hover,
.leaderboard-content::-webkit-scrollbar-thumb:hover,
.predictions-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}
/* P2P Network Visualizer */
.p2p-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.p2p-stat {
    background: var(--background-color);
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.p2p-stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.p2p-stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.p2p-visualizer {
    position: relative;
    height: 120px;
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.05) 0%, rgba(0,0,0,0) 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px dashed var(--border-color);
}

.network-pulse {
    position: absolute;
    width: 20px;
    height: 20px;
    background: var(--success-color);
    border-radius: 50%;
    box-shadow: 0 0 0 rgba(76, 175, 80, 0.4);
    animation: pulse 2s infinite;
}

.network-status-text {
    position: relative;
    z-index: 1;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--surface-color);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    70% {
        box-shadow: 0 0 0 20px rgba(76, 175, 80, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}


/* Shared Panel Styles */
.swan-leaderboard-panel,
.esg-analysis-panel,
.community-voting-panel,
.p2p-network-panel,
.research-news-panel,
.trends-analysis-panel,
.price-prediction-panel {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    min-height: 300px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: all 0.3s ease;
}

.swan-leaderboard-panel:hover,
.esg-analysis-panel:hover,
.community-voting-panel:hover,
.p2p-network-panel:hover,
.research-news-panel:hover,
.trends-analysis-panel:hover,
.price-prediction-panel:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

/* Panel Header Structure */
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: var(--surface-color-hover, rgba(0,0,0,0.02));
    border-bottom: 1px solid var(--border-color);
    min-height: 60px;
    flex-wrap: wrap; /* Allow wrapping on small screens */
    gap: 0.5rem;
}

[data-theme="dark"] .panel-header {
    background: rgba(255, 255, 255, 0.02);
}

.panel-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
    white-space: nowrap; /* Keep title on one line if possible */
    flex-shrink: 0;
}

.panel-header h2 i {
    color: var(--primary-color);
}

.panel-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap; /* Allow controls to wrap */
    justify-content: flex-end; /* Align to right */
    flex: 1; /* Take up remaining space */
}

.panel-controls select {
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--background-color);
    color: var(--text-primary);
    font-size: 0.85rem;
    height: 32px;
}

.panel-controls .add-btn,
.panel-controls .refresh-btn {
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.75rem;
    font-size: 0.85rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.panel-controls .add-btn:hover,
.panel-controls .refresh-btn:hover {
    background: var(--surface-color-hover);
    color: var(--primary-color);
    border-color: var(--primary-color);
}


/* Maximized Panel Styles */
.dashboard-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.dashboard-backdrop.active {
    display: block;
    opacity: 1;
}

section.maximized,
.dashboard-panel.maximized {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 95vw !important;
    height: 95vh !important;
    z-index: 10000 !important;
    background: var(--surface-color) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
    border-radius: 12px !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important; /* Content scrolls, not the container */
}

section.maximized .panel-header,
.dashboard-panel.maximized .panel-header {
    flex-shrink: 0;
    background: var(--surface-color);
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    margin: 0;
}

/* Make inner content fill the space when maximized */
section.maximized .esg-content,
section.maximized .voting-content,
section.maximized .research-content,
section.maximized .leaderboard-content,
section.maximized .predictions-list,
section.maximized .trends-content,
section.maximized .p2p-content,
.dashboard-panel.maximized .panel-content {
    flex: 1 !important;
    height: auto !important;
    max-height: none !important;
    overflow-y: auto !important;
    padding: 2rem !important;
}

[data-theme="dark"] section.maximized,
[data-theme="dark"] .dashboard-panel.maximized {
    background: var(--surface-color) !important;
}

/* Maximize Button */
.maximize-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.5rem;
    transition: all 0.2s;
    margin-left: 0.5rem;
    border-radius: 4px;
}

.maximize-btn:hover {
    background: var(--surface-hover, rgba(255,255,255,0.1));
    color: var(--primary-color);
}

/* --- SWAN AI PANEL STYLES (Phase 3) --- */
.swan-ai-panel {
    background: linear-gradient(180deg, rgba(82, 82, 91, 0.1) 0%, rgba(39, 39, 42, 0.2) 100%);
    border: 1px solid rgba(52, 211, 153, 0.2); /* Emerald tint */
    border-radius: 12px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.swan-ai-panel .panel-header h2 i {
    color: #34d399; /* Emerald 400 */
}

.swan-ai-panel input.search-input {
    background: rgba(15, 23, 42, 0.6) !important; /* Force visible bg */
    border: 1px solid rgba(148, 163, 184, 0.3) !important;
    color: #e2e8f0 !important;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 1rem;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
    
    /* FIX: Override conflicting .drop-zone styles that hide this input */
    opacity: 1 !important;
    max-height: none !important;
    overflow: visible !important;
    display: block !important;
    margin: 0 !important;
}

.swan-ai-panel input.search-input::placeholder {
    color: #94a3b8;
}

.swan-ai-panel input.search-input:focus {
    background: rgba(15, 23, 42, 0.9) !important;
    border-color: #34d399 !important; /* Emerald focus */
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.2) !important;
    outline: none;
}

.swan-ai-panel input.search-input.drag-over {
    background: rgba(52, 211, 153, 0.15) !important; /* Emerald tint for drag over */
    border-color: #34d399 !important;
    transform: scale(1.02);
    box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.2) !important;
}

/* Scrollable Content for AI Panel */
.swan-ai-panel .ai-content {
    overflow-y: auto;
    max-height: 450px; /* Constrain height to enable scrolling */
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: rgba(52, 211, 153, 0.5) rgba(0,0,0,0.1);
}

.swan-ai-panel .ai-content::-webkit-scrollbar {
    width: 6px;
}

.swan-ai-panel .ai-content::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
    border-radius: 3px;
}

.swan-ai-panel .ai-content::-webkit-scrollbar-thumb {
    background: rgba(52, 211, 153, 0.5);
    border-radius: 3px;
}

.swan-ai-panel .ai-content::-webkit-scrollbar-thumb:hover {
    background: rgba(52, 211, 153, 0.8);
}



