/**
 * MARKET INTELLIGENCE AI - STYLING
 */

.intelligence-view {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-color);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.intelligence-view.hidden {
    display: none;
}

.intelligence-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Stats Overview */
.intelligence-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-color);
    line-height: 1;
    margin-bottom: 0.5rem;
}

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

/* Info Section */
.intelligence-info {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-left: 4px solid var(--primary-color);
}

.intelligence-info p {
    margin: 0.5rem 0;
    color: var(--text-color);
}

.intelligence-info strong {
    color: var(--primary-color);
}

/* Tabs */
.intelligence-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.intelligence-tab {
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.intelligence-tab:hover {
    color: var(--primary-color);
    background: rgba(121, 176, 97, 0.05);
}

.intelligence-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.intelligence-tab i {
    font-size: 1.1rem;
}

/* Tab Content */
.intelligence-content {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    min-height: 500px;
}

.intelligence-tab-content {
    display: none;
}

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

.intelligence-tab-content h2 {
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.tab-description {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

/* Patterns List */
.patterns-list {
    display: grid;
    gap: 1rem;
}

.pattern-item {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    transition: all 0.2s ease;
}

.pattern-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
    transform: translateX(5px);
}

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

.pattern-topic {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    text-transform: capitalize;
}

.pattern-count {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
}

.pattern-mode {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

.pattern-mode.offer {
    background: #17a2b8;
    color: white;
}

.pattern-mode.clarity {
    background: var(--primary-color);
    color: white;
}

.pattern-mode.mindset {
    background: var(--primary-color);
    color: white;
}

.pattern-examples {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.pattern-example {
    font-size: 0.9rem;
    color: var(--text-muted);
    padding-left: 1rem;
    border-left: 2px solid var(--border-color);
    font-style: italic;
}

/* Struggles List */
.struggles-list {
    display: grid;
    gap: 1rem;
}

.struggle-item {
    background: linear-gradient(135deg, #fff5f5 0%, #ffffff 100%);
    border: 1px solid #ffcccc;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    transition: all 0.2s ease;
}

.struggle-item:hover {
    border-color: #ff4444;
    box-shadow: var(--shadow-sm);
    transform: translateX(5px);
}

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

.struggle-count {
    background: #ff4444;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
}

.struggle-text {
    font-size: 1rem;
    color: var(--text-color);
    line-height: 1.6;
}

.struggle-mode {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.struggle-mode.offer {
    background: #17a2b8;
    color: white;
}

.struggle-mode.clarity,
.struggle-mode.mindset {
    background: var(--primary-color);
    color: white;
}

/* Breakthroughs List */
.breakthroughs-list {
    display: grid;
    gap: 1rem;
}

.breakthrough-item {
    background: linear-gradient(135deg, #f5fff5 0%, #ffffff 100%);
    border: 1px solid #ccffcc;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    transition: all 0.2s ease;
}

.breakthrough-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
    transform: translateX(5px);
}

.breakthrough-text {
    font-size: 1rem;
    color: var(--text-color);
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.breakthrough-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.breakthrough-mode {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.breakthrough-mode.offer {
    background: #17a2b8;
    color: white;
}

.breakthrough-mode.clarity,
.breakthrough-mode.mindset {
    background: var(--primary-color);
    color: white;
}

.breakthrough-date {
    color: var(--text-muted);
}

/* Language List */
.language-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 0.75rem;
}

.language-item {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
}

.language-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.language-phrase {
    font-size: 0.95rem;
    color: var(--text-color);
    font-weight: 500;
    flex: 1;
}

.language-count {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 35px;
    text-align: center;
}

/* Generate Content Form */
.generate-form {
    max-width: 600px;
    margin-bottom: 2rem;
}

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

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

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

.generated-content {
    margin-top: 2rem;
    border-top: 2px solid var(--border-color);
    padding-top: 2rem;
}

.generated-content.hidden {
    display: none;
}

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

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

.generated-text {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    white-space: pre-wrap;
    line-height: 1.8;
    color: var(--text-color);
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

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

/* Responsive */
@media (max-width: 768px) {
    .intelligence-container {
        padding: 1rem;
    }

    .intelligence-stats {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .intelligence-content {
        padding: 1rem;
    }

    .intelligence-tabs {
        gap: 0.25rem;
    }

    .intelligence-tab {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }

    .language-list {
        grid-template-columns: 1fr;
    }
}

/* Loading State */
.intelligence-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-muted);
}

.intelligence-loading i {
    font-size: 3rem;
    margin-bottom: 1rem;
    animation: spin 2s linear infinite;
}

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

.intelligence-loading p {
    font-size: 1.1rem;
}

/* AI Insights Styling */
.ai-insights-header {
    margin-bottom: 2rem;
}

.insights-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #e7f3ff 0%, #f0f7ff 100%);
    border-radius: var(--radius-md);
    border-left: 4px solid #667eea;
}

.insights-timestamp {
    color: #666;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.icon-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.icon-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.icon-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.primary-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.875rem 1.75rem;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.primary-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.primary-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.insights-section {
    margin: 2.5rem 0;
}

.insights-section:first-of-type {
    margin-top: 0;
}

.insights-section h3 {
    font-size: 1.25rem;
    color: #667eea;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
}

.insights-section h3 i {
    font-size: 1.1rem;
}

.insight-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-left: 4px solid #667eea;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.insight-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateX(5px);
}

.insight-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.25rem;
    gap: 1rem;
}

.insight-header h4 {
    font-size: 1.125rem;
    color: #333;
    margin: 0;
    font-weight: 700;
    line-height: 1.4;
    flex: 1;
}

.insight-content p {
    margin: 0.875rem 0;
    line-height: 1.7;
    color: var(--text-color);
}

.insight-content p:first-child {
    margin-top: 0;
}

.insight-content p:last-child {
    margin-bottom: 0;
}

.insight-content strong {
    color: #667eea;
    font-weight: 700;
}

.badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.375rem 0.875rem;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.recommendation-card {
    border-left-color: #28a745;
}

.recommendation-card:hover {
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.15);
}

.rec-type-badge {
    display: inline-block;
    padding: 0.375rem 0.875rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
    letter-spacing: 0.5px;
}

.rec-type-badge.product {
    background: #667eea;
    color: white;
}

.rec-type-badge.content {
    background: #ffc107;
    color: #333;
}

.rec-type-badge.feature {
    background: #28a745;
    color: white;
}

.no-data {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 2rem;
}

/* AI Insights Responsive */
@media (max-width: 768px) {
    .insights-meta {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .icon-button {
        width: 100%;
        justify-content: center;
    }

    .primary-button {
        width: 100%;
        justify-content: center;
    }

    .insight-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .badge {
        align-self: flex-start;
    }

    .insights-section h3 {
        font-size: 1.1rem;
    }
}

/* ============================================ */
/* JARVIS - AI CHIEF OF STAFF                  */
/* ============================================ */

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

.jarvis-title h2 {
    margin: 0;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.jarvis-title h2 i {
    color: #667eea;
}

.jarvis-subtitle {
    margin: 0.25rem 0 0 0;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.jarvis-chat-container {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    height: 500px;
    overflow-y: auto;
    margin-bottom: 1rem;
    scroll-behavior: smooth;
}

.jarvis-message {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.jarvis-message.jarvis {
    align-items: flex-start;
}

.jarvis-message.user {
    align-items: flex-end;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.jarvis .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.user .message-avatar {
    background: linear-gradient(135deg, #79b061 0%, #5a8a47 100%);
    color: white;
}

.message-sender {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--text-color);
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.message-content {
    background: white;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    max-width: 85%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    line-height: 1.6;
}

.jarvis .message-content {
    border-left: 3px solid #667eea;
}

.user .message-content {
    border-left: 3px solid #79b061;
}

.message-content p {
    margin: 0.5rem 0;
}

.message-content p:first-child {
    margin-top: 0;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content ul,
.message-content ol {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.message-content li {
    margin: 0.25rem 0;
}

.jarvis-input-area {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 0.75rem;
    transition: border-color 0.2s ease;
}

.jarvis-input-area:focus-within {
    border-color: #667eea;
}

.attach-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    font-size: 1.25rem;
    transition: color 0.2s ease;
}

.attach-btn:hover {
    color: #667eea;
}

#jarvisInput {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    font-size: 1rem;
    font-family: inherit;
    padding: 0.5rem;
    min-height: 40px;
    max-height: 150px;
}

.send-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.jarvis-typing {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    color: var(--text-muted);
    font-style: italic;
}

.typing-dots {
    display: flex;
    gap: 0.25rem;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: typingDot 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDot {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-8px);
    }
}

.jarvis-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
}

.jarvis-empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: #667eea;
    opacity: 0.5;
}

.jarvis-empty-state h3 {
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.jarvis-empty-state p {
    max-width: 400px;
    line-height: 1.6;
}

/* Jarvis Responsive */
@media (max-width: 768px) {
    .jarvis-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .jarvis-chat-container {
        height: 400px;
    }

    .message-content {
        max-width: 90%;
    }

    #jarvisInput {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}
