/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: #ffffff;
    min-height: 100vh;
    padding: 0;
    margin: 0;
}

.container {
    width: 100%;
    height: 100%;
    margin: 0;
}

.main-content {
    display: grid;
    grid-template-columns: 60% 40%;
    gap: 0;
    height: 100vh;
    width: 100%;
}

.chat-section,
.summary-section {
    background: #ffffff;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: none;
}

.summary-section {
    background: #f8fafc;
}

.chat-header {
    padding: 24px;
    border-bottom: 1px solid #e2e8f0;
    background: #464F81;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.summary-header {
    display: none;
}

.chat-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.summary-header h2 {
    font-size: 18px;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.progress-container {
    display: none;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: #1e2838;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #444D81;
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

#progressText {
    font-size: 13px;
    font-weight: 600;
    min-width: 35px;
    color: #64748b;
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
}

.message {
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    display: flex;
    justify-content: flex-end;
}

.message.assistant {
    display: flex;
    justify-content: flex-start;
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
}

.message.user .message-content {
    background: #444D81;
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
    background: #f3f4f6;
    color: #1f2937;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.chat-input-container {
    padding: 24px;
    border-top: 1px solid #e2e8f0;
    background: white;
}

.input-wrapper {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

#userInput {
    flex: 1;
    padding: 14px 20px;
    border: 1px solid #d1d5db;
    border-radius: 24px;
    outline: none;
    font-size: 0.875rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: white;
    font-family: inherit;
}

#userInput:focus {
    border-color: #464F81;
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

#userInput:disabled {
    background: #f8fafc;
    cursor: not-allowed;
    color: #94a3b8;
}

#userInput::placeholder {
    color: #9ca3af;
}

#sendBtn {
    width: 48px;
    height: 48px;
    border: none;
    background: #464F81;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(30, 64, 175, 0.2);
}

#sendBtn:hover:not(:disabled) {
    background: #464F81;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(30, 64, 175, 0.3);
}

#sendBtn:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.progress-bar {
    width: 100%;
    height: 3px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #464F81;
    border-radius: 2px;
    transition: width 0.5s ease;
    width: 0%;
}

.summary-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.empty-state {
    color: #9ca3af;
    text-align: center;
    margin-top: 50px;
}

.summary-section-item {
    margin: 16px 16px 0 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
    transition: all 0.2s ease;
}

.summary-section-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(68, 77, 129, 0.15);
    border-color: #444D81;
}

.summary-section-item h3 {
    color: #444D81;
    font-size: 13px;
    margin: 0 0 10px 0;
    padding: 0;
    border: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.summary-section-item p {
    font-size: 14px;
    color: #6b7280;
    margin: 6px 0;
}

.summary-section-item strong {
    color: #1f2937;
    font-weight: 600;
}

.summary-subsection {
    margin: 12px 0 0 0;
    padding-top: 12px;
    border-top: 1px solid #3d4a5c;
}

.summary-list {
    list-style: none;
    margin: 0;
    padding: 0;
    color: #e8eaed;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.summary-list li {
    padding: 8px 0;
    border: none;
    color: #374151;
    list-style: none;
    font-size: 13px;
    display: flex;
    align-items: center;
}

.summary-list li::before {
    content: "•";
    color: #444D81;
    font-weight: bold;
    display: inline-block;
    width: 1.2em;
    margin-right: 8px;
}

.summary-list li * {
    color: #374151 !important;
}

.download-btn {
    margin: 0;
    margin-top: 16px;
    padding: 12px 20px;
    background: #10b981;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.download-btn:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.download-btn svg {
    stroke: currentColor;
    fill: none;
}

.charts-btn {
    margin: 0 16px 16px 16px;
    margin-top: 8px;
    padding: 10px 16px;
    background: #464F81;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    width: calc(100% - 32px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 4px rgba(30, 64, 175, 0.2);
}

.charts-btn:hover {
    background: #464F81;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(30, 64, 175, 0.3);
}

.charts-btn svg {
    stroke: currentColor;
    fill: none;
}

/* Preview Charts Section */
.preview-charts-section {
    margin-bottom: 0;
    padding: 16px;
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.preview-charts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.preview-charts-header h3 {
    color: #444D81;
    font-size: 14px;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.view-all-link {
    color: #444D81;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-all-link:hover {
    color: #3a4169;
    text-decoration: underline;
}

.preview-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.preview-stat-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
}

.preview-stat-card:hover {
    border-color: #444D81;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(68, 77, 129, 0.15);
}

.preview-stat-icon {
    font-size: 24px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: #444D81;
}

.preview-stat-icon svg {
    display: block;
    stroke: currentColor;
    fill: none;
}

.preview-stat-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.preview-stat-label {
    font-size: 10px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.preview-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    letter-spacing: -0.5px;
}

.preview-charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.preview-chart-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preview-chart-card:hover {
    border-color: #444D81;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(68, 77, 129, 0.2);
}

.preview-chart-card h4 {
    color: #6b7280;
    font-size: 11px;
    margin: 0 0 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    text-align: center;
}

.preview-chart-content {
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.preview-chart-content canvas {
    max-height: 130px;
    max-width: 100%;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    overflow: auto;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: #ffffff;
    margin: 2% auto;
    border-radius: 12px;
    width: 95%;
    max-width: 1400px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid #e2e8f0;
}

.modal-header {
    background: #444D81;
    color: #ffffff;
    padding: 20px 30px;
    border-bottom: 1px solid #444D81;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
}

.modal-close {
    font-size: 32px;
    font-weight: bold;
    color: #ffffff;
    cursor: pointer;
    transition: color 0.3s ease;
    line-height: 1;
}

.modal-close:hover {
    color: #e0e7ff;
}

.modal-body {
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.modal-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.modal-summary-cards .summary-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 18px;
    transition: all 0.3s ease;
}

.modal-summary-cards .summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(68, 77, 129, 0.15);
    border-color: #444D81;
}

.modal-visualizations {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}

.modal-visualizations .chart-container {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s ease;
}

.modal-visualizations .chart-container:hover {
    border-color: #444D81;
    box-shadow: 0 4px 12px rgba(68, 77, 129, 0.1);
}

.modal-visualizations .chart-container.full-width {
    grid-column: 1 / -1;
}

/* Summary Cards Grid */
.summary-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.summary-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(68, 77, 129, 0.15);
    border-color: #444D81;
    background: #eff6ff;
}

.card-icon {
    font-size: 28px;
    line-height: 1;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #dbeafe;
    border-radius: 10px;
    color: #444D81;
}

.card-icon svg {
    display: inline-block;
    vertical-align: middle;
    stroke-width: 1.5;
    stroke: currentColor;
    fill: none;
}

.card-content h3 {
    font-size: 11px;
    color: #6b7280;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.card-value {
    font-size: 22px;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
    letter-spacing: -0.5px;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 20px;
}

.chart-container {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s ease;
}

.chart-container:hover {
    border-color: #444D81;
    box-shadow: 0 4px 12px rgba(68, 77, 129, 0.1);
}

.chart-container.full-width {
    grid-column: 1 / -1;
}

.chart-container h3 {
    color: #444D81;
    font-size: 15px;
    margin: 0 0 16px 0;
    padding: 0;
    border: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.chart-content {
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border-radius: 8px;
    padding: 12px;
}

.chart-content canvas {
    max-height: 320px;
}

.loading-message {
    color: #6b7280;
    text-align: center;
    padding: 40px;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: #f3f4f6;
    border-radius: 20px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    width: fit-content;
    margin-bottom: 16px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #464F81;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.status-dot.online {
    background: #16a34a;
}

.status-dot.offline {
    background: #dc2626;
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 400px;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-container.full-width {
        grid-column: 1;
    }
    
    .preview-charts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .preview-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .main-content {
        height: calc(100vh - 20px);
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .modal-content {
        width: 100%;
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .summary-cards-grid {
        grid-template-columns: 1fr;
    }
    
    .preview-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .preview-charts-grid {
        grid-template-columns: 1fr;
    }
    
    .preview-chart-content {
        height: 180px;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f8fafc;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* SVG Icon Styling */
.header-icon {
    margin-right: 8px;
    display: inline-block;
    vertical-align: text-bottom;
    stroke: currentColor;
    fill: none;
}
