:root {
    --bg-primary: #0a0f0d;
    --bg-secondary: #111916;
    --bg-card: #151d19;
    --accent-green: #34d399;
    --accent-green-dim: #10b981;
    --accent-red: #f87171;
    --accent-amber: #fbbf24;
    --text-primary: #f0fdf4;
    --text-secondary: #a7c4b5;
    --text-muted: #5e7a6a;
    --border-color: #1f2e27;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated background */
.bg-pattern {
    position: fixed;
    inset: 0;
    background: 
radial-gradient(ellipse at 20% 0%, rgba(52, 211, 153, 0.08) 0%, transparent 50%),
radial-gradient(ellipse at 80% 100%, rgba(16, 185, 129, 0.05) 0%, transparent 50%),
linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    z-index: -1;
}

.grid-overlay {
    position: fixed;
    inset: 0;
    background-image: 
linear-gradient(rgba(52, 211, 153, 0.03) 1px, transparent 1px),
linear-gradient(90deg, rgba(52, 211, 153, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    z-index: -1;
}

/* Header */
header {
    padding: 2rem 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--accent-green) 0%, var(--accent-green-dim) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.logo-text {
    font-family: 'Instrument Serif', serif;
    font-size: 1.6rem;
    letter-spacing: -0.02em;
}

.logo-text span {
    color: var(--accent-green);
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 100px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Header Responsive Styles */
@media (max-width: 768px) {
    header {
padding: 1rem 1.25rem;
flex-wrap: wrap;
gap: 0.75rem;
    }

    .logo-icon {
width: 36px;
height: 36px;
font-size: 1.2rem;
    }

    .logo-text {
font-size: 1.3rem;
    }

    .status-badge {
padding: 0.4rem 0.75rem;
font-size: 0.75rem;
    }

    .status-badge span {
white-space: nowrap;
    }
}

@media (max-width: 480px) {
    header {
padding: 0.875rem 1rem;
    }

    .logo {
gap: 0.5rem;
    }

    .logo-icon {
width: 32px;
height: 32px;
font-size: 1rem;
    }

    .logo-text {
font-size: 1.15rem;
    }

    .status-badge {
padding: 0.35rem 0.65rem;
font-size: 0.7rem;
    }

    .status-badge span {
font-size: 0.7rem;
    }
}

/* Main content */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 2rem;
}

.hero {
    text-align: center;
    margin-bottom: 4rem;
}

.hero h1 {
    font-family: 'Instrument Serif', serif;
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 400;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    letter-spacing: -0.03em;
}

.hero h1 em {
    font-style: italic;
    color: var(--accent-green);
}

.hero p {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 3rem;
    line-height: 1.7;
}

/* Analyze button */
.analyze-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.1rem 2.5rem;
    background: linear-gradient(135deg, var(--accent-green) 0%, var(--accent-green-dim) 100%);
    color: var(--bg-primary);
    font-family: 'DM Sans', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
}

.analyze-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px rgba(52, 211, 153, 0.3);
}

.analyze-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.analyze-btn .icon {
    font-size: 1.3rem;
    transition: transform 0.3s ease;
}

.analyze-btn:hover:not(:disabled) .icon {
    transform: translateX(3px);
}

/* Loading state */
.loading-container {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    padding: 4rem 2rem;
}

.loading-container.active {
    display: flex;
}

.loader {
    width: 60px;
    height: 60px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.loading-steps {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-muted);
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.step.active {
    color: var(--accent-green);
}

.step.completed {
    color: var(--text-secondary);
}

.step-icon {
    width: 24px;
    height: 24px;
    border: 2px solid currentColor;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

.step.active .step-icon {
    border-color: var(--accent-green);
    animation: pulse 1.5s infinite;
}

.step.completed .step-icon {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: var(--bg-primary);
}

/* Results section */
.results-container {
    display: none;
}

.results-container.active {
    display: block;
    animation: fadeIn 0.6s ease;
}

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

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

.results-title {
    font-family: 'Instrument Serif', serif;
    font-size: 2rem;
    font-weight: 400;
}

.results-meta {
    display: flex;
    gap: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Stats cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    border-color: var(--accent-green);
    transform: translateY(-2px);
}

.stat-value {
    font-family: 'Instrument Serif', serif;
    font-size: 2.5rem;
    font-weight: 400;
    margin-bottom: 0.25rem;
}

.stat-card.positive .stat-value { color: var(--accent-green); }
.stat-card.negative .stat-value { color: var(--accent-red); }
.stat-card.neutral .stat-value { color: var(--accent-amber); }
.stat-card.total .stat-value { color: var(--text-primary); }

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Main content grid */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 2rem;
    margin-bottom: 3rem;
}

@media (max-width: 900px) {
    .content-grid {
grid-template-columns: 1fr;
    }
}

/* Summary card */
.summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2rem;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.card-header-icon {
    width: 36px;
    height: 36px;
    background: rgba(52, 211, 153, 0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.card-header h3 {
    font-family: 'Instrument Serif', serif;
    font-size: 1.3rem;
    font-weight: 400;
}

.summary-text {
    line-height: 1.8;
    color: var(--text-secondary);
    font-size: 1rem;
}

.summary-text strong {
    color: var(--text-primary);
    font-weight: 500;
}

/* Chart card */
.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2rem;
}

.chart-container {
    text-align: center;
}

.chart-container img {
    max-width: 100%;
    border-radius: 12px;
}

/* Articles section */
.articles-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .articles-section {
grid-template-columns: 1fr;
    }
}

.articles-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.5rem;
}

.articles-card.positive .card-header-icon {
    background: rgba(52, 211, 153, 0.15);
}

.articles-card.negative .card-header-icon {
    background: rgba(248, 113, 113, 0.15);
}

.article-list {
    list-style: none;
}

.article-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.article-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.article-title {
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.article-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.article-title a:hover {
    color: var(--accent-green);
}

.article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
}

.article-source {
    color: var(--text-muted);
}

.article-score {
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.75rem;
}

.article-score.positive {
    background: rgba(52, 211, 153, 0.15);
    color: var(--accent-green);
}

.article-score.negative {
    background: rgba(248, 113, 113, 0.15);
    color: var(--accent-red);
}

/* New analysis button */
.new-analysis-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: transparent;
    color: var(--accent-green);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    border: 1px solid var(--accent-green);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.new-analysis-btn:hover {
    background: var(--accent-green);
    color: var(--bg-primary);
}

/* Error state */
.error-container {
    display: none;
    text-align: center;
    padding: 4rem 2rem;
}

.error-container.active {
    display: block;
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
}

.error-title {
    font-family: 'Instrument Serif', serif;
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.error-message {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-color);
    margin-top: 4rem;
}

/* History section */
.history-container {
    max-width: 1200px;
    margin: 2rem auto 0;
    padding: 0 2rem 2rem;
}

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

.history-title {
    font-family: 'Instrument Serif', serif;
    font-size: 1.4rem;
    font-weight: 400;
}

.history-list {
    margin-top: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1rem 1.25rem;
    max-height: 260px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(31, 46, 39, 0.6);
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item:hover {
    background: rgba(15, 23, 20, 0.7);
    transform: translateY(-1px);
}

.history-item-main {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.history-date {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.history-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.history-empty {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-align: center;
    padding: 0.75rem 0;
}

.history-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .history-container {
padding: 0 1.25rem 1.5rem;
    }

    .history-item {
align-items: flex-start;
flex-direction: column;
gap: 0.35rem;
    }
}

/* Delete confirmation modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.modal-backdrop.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    padding: 1.75rem 1.75rem 1.5rem;
    max-width: 360px;
    width: 100%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.modal-title {
    font-family: 'Instrument Serif', serif;
    font-size: 1.35rem;
    margin-bottom: 0.75rem;
}

.modal-body {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.btn-secondary {
    padding: 0.55rem 1.1rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
}

.btn-danger {
    padding: 0.55rem 1.1rem;
    border-radius: 999px;
    border: 1px solid var(--accent-red);
    background: rgba(248, 113, 113, 0.1);
    color: var(--accent-red);
    font-size: 0.9rem;
    cursor: pointer;
}

/* Chatbot widget */
.chat-widget-toggle {
    position: fixed;
    right: 1.75rem;
    bottom: 1.75rem;
    width: 52px;
    height: 52px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, var(--accent-green) 0%, var(--accent-green-dim) 100%);
    color: var(--bg-primary);
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
    z-index: 40;
}

.chat-widget {
    position: fixed;
    right: 1.5rem;
    bottom: 5.5rem;
    width: 340px;
    max-width: calc(100% - 2.5rem);
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 45;
}

.chat-widget.open {
    display: flex;
}

.chat-widget-header {
    padding: 0.9rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.chat-widget-title {
    font-family: 'Instrument Serif', serif;
    font-size: 1.1rem;
}

.chat-widget-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.4rem;
}

.chat-suggestion {
    border-radius: 999px;
    border: 1px solid var(--border-color);
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    background: rgba(15, 23, 20, 0.9);
}

.chat-widget-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
}

.chat-messages {
    padding: 0.9rem 1rem;
    max-height: 260px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    font-size: 0.9rem;
}

.chat-message {
    display: inline-block;
    padding: 0.5rem 0.7rem;
    border-radius: 10px;
    max-width: 90%;
    line-height: 1.5;
}

.chat-message.user {
    align-self: flex-end;
    background: rgba(52, 211, 153, 0.12);
}

.chat-message.assistant {
    align-self: flex-start;
    background: #0f1713;
    border: 1px solid var(--border-color);
}

.chat-widget-input {
    padding: 0.65rem 0.7rem 0.7rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: flex-end;
    gap: 0.55rem;
}

.chat-input {
    flex: 1;
    background: #0f1713;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.45rem 0.7rem;
    resize: none;
    min-height: 34px;
    max-height: 80px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
}

.chat-send-btn {
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, var(--accent-green) 0%, var(--accent-green-dim) 100%);
    color: var(--bg-primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
}

.chat-send-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}
