/**
 * Article Intelligence Page Styles
 * Split-screen editor with live scoring dashboard
 * ClickUp-inspired design with color-coded scores
 */

/* ===========================
   Page Layout
   =========================== */
.article-intelligence-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--bg-primary, #0f0f0f);
    color: var(--text-primary, #ffffff);
    overflow: hidden;
}

/* ===========================
   Top Bar
   =========================== */
.ai-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: var(--bg-secondary, #1a1a1a);
    border-bottom: 1px solid var(--border-color, #2a2a2a);
    gap: 16px;
}

.ai-top-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.ai-back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid var(--border-color, #2a2a2a);
    border-radius: 6px;
    color: var(--text-secondary, #a0a0a0);
    cursor: pointer;
    transition: all 0.2s;
}

.ai-back-btn:hover {
    background: var(--bg-tertiary, #252525);
    color: var(--text-primary, #ffffff);
}

.ai-title-input {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-primary, #ffffff);
    font-size: 18px;
    font-weight: 600;
    max-width: 400px;
}

.ai-title-input:hover {
    background: var(--bg-tertiary, #252525);
}

.ai-title-input:focus {
    outline: none;
    border-color: var(--accent-primary, #f46a54);
    background: var(--bg-tertiary, #252525);
}

.ai-top-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-save-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-tertiary, #252525);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-secondary, #a0a0a0);
}

.ai-save-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10B981;
}

.ai-pub-select {
    padding: 8px 12px;
    background: var(--bg-tertiary, #252525);
    border: 1px solid var(--border-color, #2a2a2a);
    border-radius: 6px;
    color: var(--text-primary, #ffffff);
    font-size: 14px;
    cursor: pointer;
    min-width: 180px;
}

.ai-pub-select:focus {
    outline: none;
    border-color: var(--accent-primary, #f46a54);
}

.ai-style-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--accent-primary, #f46a54);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-style-btn:hover {
    background: #e55a44;
    transform: translateY(-1px);
}

/* ===========================
   Main Content - Split Screen
   =========================== */
.ai-main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Editor Panel (60%) */
.ai-editor-panel {
    flex: 0 0 60%;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color, #2a2a2a);
    background: var(--bg-primary, #0f0f0f);
}

/* Intelligence Panel (40%) */
.ai-intelligence-panel {
    flex: 0 0 40%;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: var(--bg-secondary, #1a1a1a);
    padding: 20px;
    gap: 20px;
}

/* ===========================
   Editor Toolbar
   =========================== */
.ai-editor-toolbar {
    display: flex;
    gap: 16px;
    padding: 12px 20px;
    background: var(--bg-secondary, #1a1a1a);
    border-bottom: 1px solid var(--border-color, #2a2a2a);
}

.toolbar-group {
    display: flex;
    gap: 4px;
}

.toolbar-group button {
    padding: 6px 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--text-secondary, #a0a0a0);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 32px;
}

.toolbar-group button:hover {
    background: var(--bg-tertiary, #252525);
    color: var(--text-primary, #ffffff);
}

.toolbar-group button:active {
    background: var(--accent-primary, #f46a54);
    color: white;
}

/* ===========================
   Editor Container
   =========================== */
.ai-editor-container {
    flex: 1;
    overflow-y: auto;
    padding: 40px 60px;
}

.ai-editor {
    min-height: 400px;
    outline: none;
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-primary, #ffffff);
}

.ai-editor:empty:before {
    content: attr(data-placeholder);
    color: var(--text-muted, #666);
    pointer-events: none;
}

.ai-editor h2 {
    font-size: 24px;
    font-weight: 600;
    margin: 24px 0 16px;
    color: var(--text-primary, #ffffff);
}

.ai-editor h3 {
    font-size: 20px;
    font-weight: 600;
    margin: 20px 0 12px;
    color: var(--text-primary, #ffffff);
}

.ai-editor p {
    margin-bottom: 16px;
}

.ai-editor blockquote {
    margin: 20px 0;
    padding: 16px 24px;
    border-left: 4px solid var(--accent-primary, #f46a54);
    background: var(--bg-secondary, #1a1a1a);
    border-radius: 0 8px 8px 0;
    font-style: italic;
}

.ai-editor ul,
.ai-editor ol {
    margin: 16px 0;
    padding-left: 24px;
}

.ai-editor li {
    margin-bottom: 8px;
}

.ai-editor a {
    color: var(--accent-secondary, #4285f4);
    text-decoration: underline;
}

/* ===========================
   Editor Footer
   =========================== */
.ai-editor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--bg-secondary, #1a1a1a);
    border-top: 1px solid var(--border-color, #2a2a2a);
}

.ai-word-count {
    font-size: 13px;
    color: var(--text-secondary, #a0a0a0);
}

.ai-word-count .divider {
    margin: 0 8px;
    opacity: 0.5;
}

.research-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-tertiary, #252525);
    border: 1px solid var(--border-color, #2a2a2a);
    border-radius: 6px;
    color: var(--text-secondary, #a0a0a0);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.research-btn:hover {
    background: var(--bg-primary, #0f0f0f);
    color: var(--text-primary, #ffffff);
}

/* ===========================
   Research Panel
   =========================== */
.ai-research-panel {
    padding: 20px;
    background: var(--bg-tertiary, #252525);
    border-top: 1px solid var(--border-color, #2a2a2a);
    max-height: 300px;
    overflow-y: auto;
}

.ai-research-panel.hidden {
    display: none;
}

.research-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.research-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.research-header button {
    padding: 6px 12px;
    background: var(--accent-primary, #f46a54);
    border: none;
    border-radius: 4px;
    color: white;
    font-size: 13px;
    cursor: pointer;
}

/* ===========================
   Intelligence Panel Sections
   =========================== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-header h3 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-header .icon {
    font-size: 18px;
}

.section-header .badge {
    background: var(--accent-primary, #f46a54);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.refresh-btn {
    padding: 6px;
    background: transparent;
    border: 1px solid var(--border-color, #2a2a2a);
    border-radius: 4px;
    color: var(--text-secondary, #a0a0a0);
    cursor: pointer;
    transition: all 0.2s;
}

.refresh-btn:hover {
    background: var(--bg-tertiary, #252525);
    color: var(--text-primary, #ffffff);
}

.refresh-btn .spinning {
    animation: spin 1s linear infinite;
}

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

/* ===========================
   Scoring Section
   =========================== */
.ai-scoring-section {
    background: var(--bg-tertiary, #252525);
    border-radius: 12px;
    padding: 20px;
}

/* Overall Score */
.ai-overall-score {
    margin-bottom: 20px;
}

.score-placeholder {
    text-align: center;
    padding: 20px;
}

.score-circle {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: conic-gradient(
        var(--score-color, #3B82F6) var(--score-percent, 0%),
        var(--bg-secondary, #1a1a1a) var(--score-percent, 0%)
    );
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.5s ease;
}

.score-circle::before {
    content: '';
    position: absolute;
    inset: 8px;
    background: var(--bg-tertiary, #252525);
    border-radius: 50%;
}

.score-circle .score-value {
    position: relative;
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary, #ffffff);
}

.score-circle .score-max {
    position: relative;
    font-size: 14px;
    color: var(--text-secondary, #a0a0a0);
}

.score-circle.empty {
    background: var(--border-color, #2a2a2a);
}

.score-circle.pulse {
    animation: pulse 0.5s ease;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.score-display {
    display: flex;
    align-items: center;
    gap: 20px;
}

.score-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.score-label {
    font-size: 18px;
    font-weight: 600;
}

.score-trend {
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Dimension Scores */
.ai-dimension-scores {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.no-scores {
    text-align: center;
    padding: 20px;
    color: var(--text-muted, #666);
    font-size: 14px;
}

.dimension-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-secondary, #1a1a1a);
    border-radius: 8px;
    transition: all 0.2s;
}

.dimension-row:hover {
    background: var(--bg-primary, #0f0f0f);
}

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

.dimension-icon {
    font-size: 16px;
}

.dimension-name {
    font-size: 14px;
    color: var(--text-primary, #ffffff);
}

.dimension-score {
    display: flex;
    align-items: center;
    gap: 8px;
}

.score-bar {
    width: 80px;
    height: 6px;
    background: var(--bg-primary, #0f0f0f);
    border-radius: 3px;
    overflow: hidden;
}

.score-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.score-number {
    font-size: 14px;
    font-weight: 600;
    min-width: 32px;
    text-align: right;
}

.expand-btn {
    width: 100%;
    padding: 10px;
    margin-top: 12px;
    background: transparent;
    border: 1px solid var(--border-color, #2a2a2a);
    border-radius: 6px;
    color: var(--text-secondary, #a0a0a0);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.expand-btn:hover {
    background: var(--bg-secondary, #1a1a1a);
    color: var(--text-primary, #ffffff);
}

/* ===========================
   Publication Match Section
   =========================== */
.ai-pub-match-section {
    background: var(--bg-tertiary, #252525);
    border-radius: 12px;
    padding: 20px;
}

.no-pub {
    text-align: center;
    padding: 20px;
    color: var(--text-muted, #666);
    font-size: 14px;
}

.pub-match-card {
    background: var(--bg-secondary, #1a1a1a);
    border-radius: 8px;
    padding: 16px;
    border: 1px solid var(--border-color, #2a2a2a);
}

.pub-match-card.selected {
    border-color: var(--accent-primary, #f46a54);
}

.pub-info {
    margin-bottom: 12px;
}

.pub-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary, #ffffff);
    display: block;
}

.pub-category {
    font-size: 12px;
    color: var(--text-secondary, #a0a0a0);
}

.pub-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
}

.pub-fit,
.pub-earnings {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.fit-score,
.earnings-range {
    font-size: 18px;
    font-weight: 600;
}

.fit-label,
.earnings-label {
    font-size: 12px;
    color: var(--text-secondary, #a0a0a0);
}

.pub-actions {
    display: flex;
    gap: 8px;
}

.pub-actions button {
    flex: 1;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-style {
    background: transparent;
    border: 1px solid var(--border-color, #2a2a2a);
    color: var(--text-primary, #ffffff);
}

.btn-style:hover {
    background: var(--bg-tertiary, #252525);
}

.btn-pitch {
    background: var(--accent-primary, #f46a54);
    border: none;
    color: white;
}

.btn-pitch:hover {
    background: #e55a44;
}

/* ===========================
   Suggestions Section
   =========================== */
.ai-suggestions-section {
    background: var(--bg-tertiary, #252525);
    border-radius: 12px;
    padding: 20px;
}

.ai-suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.no-suggestions {
    text-align: center;
    padding: 20px;
    color: var(--text-muted, #666);
    font-size: 14px;
}

.suggestion-card {
    background: var(--bg-secondary, #1a1a1a);
    border-radius: 8px;
    padding: 16px;
    border-left: 4px solid transparent;
}

.suggestion-card.critical {
    border-left-color: #EF4444;
}

.suggestion-card.recommended {
    border-left-color: #F59E0B;
}

.suggestion-card.optional {
    border-left-color: #6B7280;
}

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

.category-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
}

.suggestion-impact {
    font-size: 14px;
    font-weight: 600;
    color: #10B981;
}

.suggestion-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary, #ffffff);
}

.suggestion-meta {
    font-size: 12px;
    color: var(--text-secondary, #a0a0a0);
    margin-bottom: 12px;
}

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

.action-items {
    margin: 0 0 12px;
    padding-left: 20px;
    font-size: 13px;
    color: var(--text-secondary, #a0a0a0);
}

.action-items li {
    margin-bottom: 4px;
}

.suggestion-buttons {
    display: flex;
    gap: 8px;
}

.suggestion-buttons button {
    flex: 1;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-apply {
    background: var(--accent-primary, #f46a54);
    border: none;
    color: white;
}

.btn-apply:hover {
    background: #e55a44;
}

.btn-dismiss {
    background: transparent;
    border: 1px solid var(--border-color, #2a2a2a);
    color: var(--text-secondary, #a0a0a0);
}

.btn-dismiss:hover {
    background: var(--bg-tertiary, #252525);
    color: var(--text-primary, #ffffff);
}

/* ===========================
   Earnings Section
   =========================== */
.ai-earnings-section {
    background: var(--bg-tertiary, #252525);
    border-radius: 12px;
    padding: 20px;
}

.no-earnings {
    text-align: center;
    padding: 20px;
    color: var(--text-muted, #666);
    font-size: 14px;
}

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

.earnings-range {
    font-size: 24px;
    font-weight: 700;
    color: #10B981;
    margin-bottom: 8px;
}

.earnings-sep {
    margin: 0 8px;
    color: var(--text-muted, #666);
}

.earnings-avg {
    font-size: 14px;
    color: var(--text-secondary, #a0a0a0);
    margin-bottom: 8px;
}

.earnings-confidence {
    font-size: 12px;
    color: var(--text-muted, #666);
}

.confidence-high {
    color: #10B981;
}

.confidence-medium {
    color: #F59E0B;
}

.confidence-low {
    color: #EF4444;
}

/* ===========================
   Style Library Modal
   =========================== */
.ai-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 1000;
}

.ai-modal.active {
    opacity: 1;
    visibility: visible;
}

.ai-modal-content {
    background: var(--bg-secondary, #1a1a1a);
    border-radius: 16px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    transition: transform 0.3s;
}

.ai-modal.active .ai-modal-content {
    transform: translateY(0);
}

.ai-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color, #2a2a2a);
}

.ai-modal-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.close-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: var(--text-secondary, #a0a0a0);
    font-size: 24px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.close-btn:hover {
    background: var(--bg-tertiary, #252525);
    color: var(--text-primary, #ffffff);
}

.ai-modal-body {
    padding: 24px;
    overflow-y: auto;
}

/* Style Library Content */
.library-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 16px;
}

.library-search {
    flex: 1;
    padding: 10px 16px;
    background: var(--bg-tertiary, #252525);
    border: 1px solid var(--border-color, #2a2a2a);
    border-radius: 8px;
    color: var(--text-primary, #ffffff);
    font-size: 14px;
}

.library-search:focus {
    outline: none;
    border-color: var(--accent-primary, #f46a54);
}

.library-actions {
    display: flex;
    gap: 8px;
}

.library-actions button {
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-import-url {
    background: var(--accent-primary, #f46a54);
    border: none;
    color: white;
}

.btn-import-url:hover {
    background: #e55a44;
}

.btn-paste {
    background: transparent;
    border: 1px solid var(--border-color, #2a2a2a);
    color: var(--text-primary, #ffffff);
}

.btn-paste:hover {
    background: var(--bg-tertiary, #252525);
}

.library-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border-color, #2a2a2a);
    border-radius: 6px;
    color: var(--text-secondary, #a0a0a0);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--accent-primary, #f46a54);
    border-color: var(--accent-primary, #f46a54);
    color: white;
}

.tab-btn:hover:not(.active) {
    background: var(--bg-tertiary, #252525);
    color: var(--text-primary, #ffffff);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.example-placeholder,
.insights-placeholder {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted, #666);
}

.example-placeholder .icon,
.insights-placeholder .icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
}

.example-placeholder p,
.insights-placeholder p {
    margin-bottom: 8px;
}

.example-placeholder .hint {
    font-size: 13px;
    color: var(--text-muted, #666);
}

/* ===========================
   Responsive Design
   =========================== */
@media (max-width: 1200px) {
    .ai-main-content {
        flex-direction: column;
    }

    .ai-editor-panel,
    .ai-intelligence-panel {
        flex: 1;
        max-height: 50vh;
    }

    .ai-editor-panel {
        border-right: none;
        border-bottom: 1px solid var(--border-color, #2a2a2a);
    }
}

@media (max-width: 768px) {
    .ai-top-bar {
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }

    .ai-top-left,
    .ai-top-right {
        width: 100%;
    }

    .ai-top-right {
        flex-wrap: wrap;
    }

    .ai-pub-select {
        flex: 1;
        min-width: 120px;
    }

    .ai-editor-container {
        padding: 20px;
    }

    .library-controls {
        flex-direction: column;
    }

    .library-actions {
        width: 100%;
    }

    .library-actions button {
        flex: 1;
    }
}

/* ===========================
   Light Theme Overrides
   =========================== */
[data-theme="light"] .ai-editor-panel,
[data-theme="light"] .ai-editor {
    background: #ffffff;
}

[data-theme="light"] .ai-editor {
    color: #1a1a1a;
}

[data-theme="light"] .score-circle::before {
    background: #ffffff;
}

[data-theme="light"] .score-circle.empty {
    background: #e5e5e5;
}

[data-theme="light"] .ai-modal-content {
    background: #ffffff;
}
