/* Component-specific styles for Advanced Dashboard */

/* === TONE ANALYSIS COMPONENTS === */
.tone-analysis-panel {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--gray-200);
}

.tone-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-6);
    padding: var(--space-6);
}

.word-cloud-section, .example-captions-section {
    padding: var(--space-4);
    background: var(--gray-50);
    border-radius: var(--border-radius);
}

.word-cloud-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    background: var(--white);
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
}

.caption-samples {
    display: grid;
    gap: var(--space-3);
    max-height: 300px;
    overflow-y: auto;
}

.caption-card {
    background: var(--white);
    padding: var(--space-3);
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
    transition: var(--transition);
}

.caption-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.caption-text {
    font-style: italic;
    color: var(--gray-700);
    margin-bottom: var(--space-2);
    line-height: 1.5;
}

.caption-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--gray-500);
}

.caption-tone {
    background: var(--primary-color);
    color: var(--white);
    padding: 0.2rem 0.5rem;
    border-radius: var(--border-radius);
    font-size: 0.7rem;
}

.tone-distribution-section {
    padding: var(--space-6);
    border-top: 1px solid var(--gray-200);
}

.tone-bars {
    display: grid;
    gap: var(--space-3);
}

.tone-bar-container {
    background: var(--gray-50);
    padding: var(--space-3);
    border-radius: var(--border-radius);
}

.tone-bar-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-2);
    font-size: 0.9rem;
    font-weight: 600;
}

.tone-value {
    color: var(--primary-color);
}

.tone-bar-track {
    background: var(--gray-200);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
}

.tone-bar-fill {
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    height: 100%;
    transition: width 1s ease-in-out;
}

/* === SENTIMENT ANALYSIS COMPONENTS === */
.sentiment-analysis-panel {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--gray-200);
}

.sentiment-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-6);
    padding: var(--space-6);
}

.sentiment-circle-section {
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--gray-50);
    border-radius: var(--border-radius);
    padding: var(--space-6);
}

.sentiment-circle {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.circle-center {
    position: absolute;
    text-align: center;
}

.sentiment-score {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: var(--success);
}

.sentiment-label {
    display: block;
    font-size: 0.9rem;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sentiment-circle.positive .sentiment-score { color: var(--success); }
.sentiment-circle.negative .sentiment-score { color: var(--error); }
.sentiment-circle.neutral .sentiment-score { color: var(--gray-500); }

.reactions-section {
    background: var(--gray-50);
    padding: var(--space-4);
    border-radius: var(--border-radius);
}

.reaction-bars {
    display: grid;
    gap: var(--space-3);
    max-height: 250px;
    overflow-y: auto;
}

.reaction-bar-container {
    background: var(--white);
    padding: var(--space-2);
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
}

.reaction-bar-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-2);
    font-size: 0.9rem;
}

.reaction-emoji {
    font-size: 1.2rem;
    margin-right: var(--space-2);
}

.reaction-name {
    flex: 1;
    font-weight: 500;
}

.reaction-count {
    color: var(--primary-color);
    font-weight: 600;
}

.reaction-bar-track {
    background: var(--gray-200);
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
}

.reaction-bar-fill {
    background: var(--primary-color);
    height: 100%;
    transition: width 1s ease-in-out;
}

.engagement-metrics-section {
    padding: var(--space-6);
    border-top: 1px solid var(--gray-200);
}

.chart-container {
    position: relative;
    height: 250px;
    background: var(--white);
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
    padding: var(--space-4);
}

/* === POSTING BEHAVIOR COMPONENTS === */
.posting-behavior-panel {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--gray-200);
}

.posting-sections {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-6);
    padding: var(--space-6);
}

.frequency-section {
    background: var(--gray-50);
    padding: var(--space-4);
    border-radius: var(--border-radius);
}

.heatmap-grid {
    display: grid;
    gap: var(--space-2);
    margin: var(--space-4) 0;
}

.heatmap-day-labels {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: var(--space-1);
    margin-bottom: var(--space-2);
}

.day-label {
    text-align: center;
    font-size: 0.8rem;
    color: var(--gray-600);
    font-weight: 500;
}

.heatmap-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: var(--space-1);
}

.heatmap-cell {
    aspect-ratio: 1;
    border-radius: 3px;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--gray-200);
}

.heatmap-cell:hover {
    transform: scale(1.1);
    border-color: var(--primary-color);
}

.heatmap-legend {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-top: var(--space-4);
    font-size: 0.8rem;
}

.legend-scale {
    display: flex;
    gap: var(--space-2);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    border: 1px solid var(--gray-200);
}

.heatmap-tooltip {
    background: var(--gray-900);
    color: var(--white);
    padding: var(--space-2);
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    pointer-events: none;
    z-index: 1000;
}

.post-types-section {
    background: var(--gray-50);
    padding: var(--space-4);
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.engagement-by-type-section {
    padding: var(--space-6);
    border-top: 1px solid var(--gray-200);
}

.type-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-4);
}

.type-metric-card {
    background: var(--gradient-card);
    padding: var(--space-4);
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
}

.metric-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}

.metric-type {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-800);
}

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

.metric-stats {
    display: grid;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.metric-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2);
    background: var(--white);
    border-radius: var(--border-radius);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--gray-600);
}

.stat-value {
    font-weight: 600;
    color: var(--gray-800);
}

.metric-recommendation {
    padding: var(--space-2);
    background: var(--info);
    color: var(--white);
    border-radius: var(--border-radius);
    font-size: 0.8rem;
}

/* === COMPETITIVE ANALYSIS COMPONENTS === */
.competitive-analysis-panel {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--gray-200);
}

.comparison-table-section {
    padding: var(--space-6);
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.comparison-table th,
.comparison-table td {
    padding: var(--space-3);
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.table-header {
    background: var(--gradient-primary);
    color: var(--white);
}

.table-header th {
    font-weight: 600;
    border-bottom: none;
}

.metric-row:nth-child(even) {
    background: var(--gray-50);
}

.metric-label {
    font-weight: 600;
    color: var(--gray-700);
}

.brand-value {
    background: rgba(102, 126, 234, 0.1);
    font-weight: 600;
    color: var(--primary-color);
}

.competitor-value.better {
    color: var(--success);
}

.competitor-value.worse {
    color: var(--error);
}

.competitor-value.similar {
    color: var(--gray-600);
}

.market-position-section {
    padding: var(--space-6);
    border-top: 1px solid var(--gray-200);
}

.position-map-container {
    position: relative;
    background: var(--gray-50);
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
}

.axis-label {
    position: absolute;
    font-size: 0.9rem;
    color: var(--gray-600);
    font-weight: 500;
}

.axis-label.x-axis {
    bottom: 10px;
    right: 20px;
}

.axis-label.y-axis {
    top: 20px;
    left: 20px;
    transform: rotate(-90deg);
    transform-origin: center;
}

.position-grid {
    position: relative;
    height: 400px;
    margin: var(--space-6);
    background: linear-gradient(to right, var(--gray-200) 1px, transparent 1px),
                linear-gradient(to bottom, var(--gray-200) 1px, transparent 1px);
    background-size: 50px 50px;
}

.quadrant-label {
    position: absolute;
    font-size: 0.8rem;
    color: var(--gray-500);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.quadrant-label.top-left {
    top: 20px;
    left: 20px;
}

.quadrant-label.top-right {
    top: 20px;
    right: 20px;
}

.quadrant-label.bottom-left {
    bottom: 20px;
    left: 20px;
}

.quadrant-label.bottom-right {
    bottom: 20px;
    right: 20px;
}

.position-dot {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    transform: translate(-50%, -50%);
}

.position-dot:hover {
    transform: translate(-50%, -50%) scale(1.5);
}

.brand-dot {
    background: var(--primary-color);
    border: 3px solid var(--white);
    box-shadow: var(--shadow-md);
    z-index: 10;
}

.competitor-dot {
    background: var(--gray-400);
    border: 2px solid var(--white);
    box-shadow: var(--shadow-sm);
}

.dot-content {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    background: var(--gray-900);
    color: var(--white);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--border-radius);
    font-size: 0.7rem;
    opacity: 0;
    transition: var(--transition);
}

.position-dot:hover .dot-content {
    opacity: 1;
}

.competitive-insights {
    margin-top: var(--space-6);
    padding: var(--space-4);
    background: var(--gray-50);
    border-radius: var(--border-radius);
}

.competitive-insights h4 {
    color: var(--gray-800);
    margin-bottom: var(--space-3);
}

.insights-list {
    list-style: none;
    display: grid;
    gap: var(--space-2);
}

.insight-item {
    padding: var(--space-2);
    background: var(--white);
    border-radius: var(--border-radius);
    border-left: 3px solid var(--primary-color);
}

/* === STRATEGIC RECOMMENDATIONS COMPONENTS === */
.strategy-panel {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--gray-200);
}

.insights-section {
    padding: var(--space-6);
}

.insights-list {
    display: grid;
    gap: var(--space-4);
}

.insight-card {
    background: var(--gradient-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
    padding: var(--space-4);
    transition: var(--transition);
}

.insight-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.insight-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.insight-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.insight-meta {
    flex: 1;
}

.insight-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: var(--space-2);
}

.insight-badges {
    display: flex;
    gap: var(--space-2);
}

.impact-badge, .confidence-badge {
    padding: var(--space-1) var(--space-2);
    border-radius: var(--border-radius);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.impact-badge.high {
    background: var(--error);
    color: var(--white);
}

.impact-badge.medium {
    background: var(--warning);
    color: var(--white);
}

.impact-badge.low {
    background: var(--gray-300);
    color: var(--gray-700);
}

.confidence-badge {
    background: var(--gray-100);
    color: var(--gray-700);
}

.insight-description {
    color: var(--gray-600);
    line-height: 1.6;
    margin-bottom: var(--space-3);
}

.insight-actions {
    display: flex;
    gap: var(--space-2);
}

.recommendations-section {
    padding: var(--space-6);
    border-top: 1px solid var(--gray-200);
}

.recommendation-filters {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-6);
    overflow-x: auto;
    padding-bottom: var(--space-2);
}

.filter-btn {
    background: var(--gray-100);
    border: none;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gray-700);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.filter-btn:hover {
    background: var(--gray-200);
}

.filter-btn.active {
    background: var(--primary-color);
    color: var(--white);
}

.recommendations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: var(--space-4);
}

.recommendation-card {
    background: var(--gradient-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
    padding: var(--space-4);
    transition: var(--transition);
}

.recommendation-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.rec-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.rec-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.rec-meta {
    flex: 1;
}

.rec-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: var(--space-2);
}

.rec-badges {
    display: flex;
    gap: var(--space-2);
}

.priority-badge, .effort-badge {
    padding: var(--space-1) var(--space-2);
    border-radius: var(--border-radius);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.priority-badge.high {
    background: var(--error);
    color: var(--white);
}

.priority-badge.medium {
    background: var(--warning);
    color: var(--white);
}

.priority-badge.low {
    background: var(--gray-300);
    color: var(--gray-700);
}

.effort-badge {
    background: var(--gray-100);
    color: var(--gray-700);
}

.rec-description {
    color: var(--gray-600);
    line-height: 1.6;
    margin-bottom: var(--space-3);
}

.rec-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.rec-metric {
    padding: var(--space-2);
    background: var(--white);
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
}

.metric-label {
    display: block;
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-bottom: var(--space-1);
}

.metric-value {
    font-weight: 600;
    color: var(--gray-800);
}

.metric-value.impact {
    color: var(--success);
}

.rec-actions {
    display: flex;
    gap: var(--space-2);
}

.action-btn {
    padding: var(--space-2) var(--space-3);
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

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

.action-btn.primary:hover {
    background: var(--primary-dark);
}

.action-btn.secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

.action-btn.secondary:hover {
    background: var(--gray-200);
}

/* === SHARED COMPONENTS === */
.filter-indicator {
    background: var(--info);
    color: var(--white);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--border-radius);
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.9rem;
}

.filter-indicator button {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 var(--space-2);
}

.image-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;
}

.image-modal .modal-content {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: var(--space-4);
    max-width: 80vw;
    max-height: 80vh;
}

.image-modal img {
    max-width: 100%;
    max-height: 60vh;
    border-radius: var(--border-radius);
}

.image-details {
    margin-top: var(--space-3);
    text-align: center;
}

.insight-modal, .recommendation-modal {
    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;
}

.insight-modal .modal-content,
.recommendation-modal .modal-content {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

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

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

.modal-body {
    padding: var(--space-6);
}

.modal-actions {
    padding: var(--space-6);
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
}

.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    padding: var(--space-3) var(--space-4);
    box-shadow: var(--shadow-lg);
    z-index: 1100;
    animation: slideIn 0.3s ease-out;
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--error);
}

.toast.info {
    border-left: 4px solid var(--info);
}

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

.no-data {
    text-align: center;
    color: var(--gray-500);
    padding: var(--space-6);
    font-style: italic;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .tone-sections,
    .sentiment-sections,
    .posting-sections {
        grid-template-columns: 1fr;
    }
    
    .recommendations-grid {
        grid-template-columns: 1fr;
    }
    
    .rec-metrics {
        grid-template-columns: 1fr;
    }
    
    .comparison-table {
        font-size: 0.8rem;
    }
    
    .position-grid {
        height: 300px;
    }
    
    .recommendation-filters {
        flex-wrap: wrap;
    }
}