/**
 * Watchlist Modal Styles
 */

/* Modal Container */
#sae-modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
}

#sae-modal-container.is-active {
    display: block;
}

/* Overlay */
.sae-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    transition: opacity 0.3s ease;
}

/* Modal */
.sae-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -48%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* Modal Header */
.sae-modal-header {
    padding: 20px 30px;
    border-bottom: 1px solid #e8e8e8;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.sae-modal-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.modal-count {
    font-size: 18px;
    font-weight: 400;
    color: #666;
}

.sae-modal-close {
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.sae-modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

/* Modal Content */
.sae-modal-content {
    padding: 0;
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Modal Tabs */
.sae-modal-tabs {
    display: flex;
    background: #f8f9fa;
    padding: 0;
    border-bottom: 2px solid #e8e8e8;
    flex-shrink: 0;
}

.sae-modal-tab {
    flex: 1;
    padding: 15px 20px;
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    text-align: center;
}

.sae-modal-tab:hover {
    background: #e9ecef;
    color: #333;
}

.sae-modal-tab.active {
    color: #0073aa;
    background: #fff;
}

.sae-modal-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #0073aa;
}

.tab-count {
    font-weight: 400;
    color: #999;
    font-size: 13px;
}

.sae-modal-tab.active .tab-count {
    color: #0073aa;
}

.sae-modal-tab[disabled],
.sae-modal-tab.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.sae-modal-tab[disabled]:hover,
.sae-modal-tab.disabled:hover {
    background: none;
    color: #666;
}

/* Tab Content */
.sae-modal-tab-content {
    flex-grow: 1;
    padding: 20px 30px;
}

.sae-tab-pane {
    display: none;
}

.sae-tab-pane.active {
    display: block;
}

/* Loading State */
.sae-modal-loading {
    text-align: center;
    padding: 60px 20px;
}

.sae-modal-loading .spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid #f0f0f0;
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.sae-modal-loading p {
    color: #666;
    font-size: 16px;
    margin: 0;
}

/* Posts List */
.sae-modal-posts {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sae-modal-post {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.sae-modal-post:hover {
    background: #e9ecef;
    transform: translateX(4px);
}

/* Post Badges */
.sae-post-badges {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.sae-modal-post .sentiment-badge,
.sae-modal-post .post-type-badge,
.sae-modal-post .mention-badge {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Sentiment badge colors */
.sae-modal-post .sentiment-badge.sentiment-buy {
    background: #4CAF50;
    color: white;
}

.sae-modal-post .sentiment-badge.sentiment-sell {
    background: #f44336;
    color: white;
}

.sae-modal-post .sentiment-badge.sentiment-hold {
    background: #FF9800;
    color: white;
}

.sae-modal-post .sentiment-badge.sentiment-reduce {
    background: #ff5722;
    color: white;
}

.sae-modal-post .sentiment-badge.sentiment-add {
    background: #2196F3;
    color: white;
}

.sae-modal-post .post-type-badge.deep-dive {
    background: #673ab7;
    color: white;
}

.sae-modal-post .mention-badge {
    background: #e3f2fd;
    color: #1976d2;
}

/* Post Title */
.sae-modal-post .sae-post-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
}

.sae-modal-post .sae-post-title a {
    color: #1a1a1a;
    text-decoration: none;
    transition: color 0.2s ease;
}

.sae-modal-post .sae-post-title a:hover {
    color: #0073aa;
}

/* Post Excerpt */
.sae-modal-post .sae-post-excerpt {
    font-size: 14px;
    line-height: 1.5;
    color: #666;
    margin-bottom: 12px;
}

/* Post Meta */
.sae-modal-post .sae-post-meta {
    font-size: 13px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.sae-modal-post .sae-post-date {
    font-weight: 500;
}

.sae-modal-post .sae-post-tickers {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ticker-tag {
    background: #e0e0e0;
    padding: 2px 8px;
    border-radius: 3px;
    font-weight: 600;
    font-size: 12px;
}

.ticker-tag.current {
    background: #0073aa;
    color: white;
}

/* Empty State */
.sae-modal-empty {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

/* Error State */
.sae-modal-error {
    text-align: center;
    padding: 60px 20px;
    color: #dc3545;
}

/* Modal Footer */
.sae-modal-footer {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e8e8e8;
    text-align: center;
}

.sae-view-all-link {
    display: inline-block;
    padding: 10px 24px;
    background: #0073aa;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: background 0.2s ease;
}

.sae-view-all-link:hover {
    background: #005a87;
    color: white;
}

/* Body Modal Open */
body.sae-modal-open {
    overflow: hidden;
}

/* Responsive */
@media (max-width: 768px) {
    .sae-modal {
        width: 95%;
        max-height: 90vh;
    }
    
    .sae-modal-header {
        padding: 15px 20px;
    }
    
    .sae-modal-title {
        font-size: 20px;
    }
    
    .sae-modal-tab-content {
        padding: 15px 20px;
    }
    
    .sae-modal-post {
        padding: 15px;
    }
    
    .sae-modal-post .sae-post-title {
        font-size: 16px;
    }
    
    .sae-modal-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .sae-modal-tab {
        min-width: 120px;
        font-size: 13px;
        padding: 12px 15px;
    }
}