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

:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --accent-color: #f59e0b;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --bg-color: #f9fafb;
    --white: #ffffff;
    --border-color: #e5e7eb;
    --success-color: #10b981;
    --error-color: #ef4444;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header & Navigation */
header {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    padding: 1rem 0;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
    font-weight: 700;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.nav-link {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.3s;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
}

.search-box {
    flex: 1;
    max-width: 300px;
}

.search-box input {
    width: 100%;
    padding: 0.6rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Hero Section */
.hero-section {
    text-align: center;
    padding: 3rem 0 2rem;
}

.hero-section h2 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.update-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--white);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    box-shadow: var(--shadow);
}

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

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

/* Filter Section */
.filter-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 0;
    flex-wrap: wrap;
    gap: 1rem;
}

.filter-controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.6rem 1.2rem;
    border: 1px solid var(--border-color);
    background: var(--white);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}

.filter-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

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

.view-toggle {
    display: flex;
    gap: 0.5rem;
}

.view-btn {
    padding: 0.6rem;
    border: 1px solid var(--border-color);
    background: var(--white);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.view-btn:hover,
.view-btn.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

/* News Grid */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    padding-bottom: 3rem;
}

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

.news-card {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    animation: fadeIn 0.5s;
}

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

.news-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.news-card.list-view {
    display: flex;
    flex-direction: row;
}

.news-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--border-color);
}

.news-card.list-view .news-image {
    width: 300px;
    height: auto;
}

.news-content {
    padding: 1.5rem;
}

.news-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.8rem;
    flex-wrap: wrap;
}

.news-category {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background: var(--primary-color);
    color: var(--white);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.news-date {
    color: var(--text-light);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
}

.news-title {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-weight: 600;
    line-height: 1.4;
}

.news-description {
    color: var(--text-light);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.news-source {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.source-name {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.9rem;
}

.read-more {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: gap 0.3s;
}

.read-more:hover {
    gap: 0.6rem;
}

.read-more-hint {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9rem;
    opacity: 0.8;
    transition: all 0.3s;
}

.news-card:hover .read-more-hint {
    opacity: 1;
    transform: translateX(5px);
}

/* Loading State */
.loading {
    text-align: center;
    padding: 4rem 0;
    grid-column: 1 / -1;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: spin 1s linear infinite;
}

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

/* Error Message */
.error-message {
    text-align: center;
    padding: 2rem;
    background: #fee;
    border: 1px solid var(--error-color);
    border-radius: 8px;
    color: var(--error-color);
    margin: 2rem 0;
}

/* Footer */
footer {
    background: var(--text-color);
    color: var(--white);
    padding: 3rem 0 1rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3,
.footer-section h4 {
    margin-bottom: 1rem;
    color: var(--accent-color);
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: #d1d5db;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-section a:hover {
    color: var(--accent-color);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #374151;
    color: #9ca3af;
}

/* Newsletter Styles */
.newsletter-box {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(37, 99, 235, 0.1);
    border-radius: 12px;
    border: 1px solid var(--primary-color);
}

.newsletter-box h4 {
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

.newsletter-box p {
    color: #d1d5db;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.newsletter-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.newsletter-form input {
    flex: 1;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
    color: #1f2937;
}

.newsletter-form button {
    padding: 0.8rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.newsletter-form button:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
}

.newsletter-message {
    font-size: 0.85rem;
    margin-top: 0.5rem;
    min-height: 20px;
}

.newsletter-message.success {
    color: var(--success-color);
}

.newsletter-message.error {
    color: var(--error-color);
}

/* Chatbot Styles */
.chatbot-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
}

.chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    background: var(--secondary-color);
}

.chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 400px;
    max-width: calc(100vw - 4rem);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.chatbot-window.active {
    display: flex;
    animation: slideUp 0.3s ease;
}

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

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

.chatbot-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.chatbot-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: var(--bg-color);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chatbot-message {
    display: flex;
    gap: 0.8rem;
    animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

.message-content {
    background: white;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    max-width: 80%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

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

.message-content ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.message-content li {
    margin-bottom: 0.3rem;
}

.user-message {
    flex-direction: row-reverse;
}

.user-message .message-avatar {
    background: var(--primary-color);
    color: white;
}

.user-message .message-content {
    background: var(--primary-color);
    color: white;
}

.bot-message .message-avatar {
    background: #f3f4f6;
}

.typing-indicator {
    display: flex;
    gap: 0.3rem;
    padding: 0.8rem;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--text-light);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

.chatbot-quick-questions {
    padding: 0.5rem 1rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    background: var(--bg-color);
    border-top: 1px solid var(--border-color);
}

.quick-question {
    padding: 0.4rem 0.8rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s;
}

.quick-question:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.chatbot-input {
    display: flex;
    padding: 1rem;
    background: var(--white);
    border-top: 1px solid var(--border-color);
    gap: 0.5rem;
}

.chatbot-input input {
    flex: 1;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
}

.chatbot-input input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.chatbot-input button {
    padding: 0.8rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-input button:hover {
    background: var(--secondary-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-section h2 {
        font-size: 1.8rem;
    }

    .navbar .container {
        flex-direction: column;
        align-items: stretch;
    }

    .nav-links {
        justify-content: center;
    }

    .header-actions {
        flex-direction: column;
        width: 100%;
    }

    .search-box {
        max-width: 100%;
    }

    .news-grid {
        grid-template-columns: 1fr;
    }

    .news-card.list-view {
        flex-direction: column;
    }

    .news-card.list-view .news-image {
        width: 100%;
        height: 200px;
    }

    .filter-section {
        flex-direction: column;
        align-items: stretch;
    }

    .view-toggle {
        justify-content: center;
    }

    .chatbot-window {
        width: calc(100vw - 2rem);
        right: -1rem;
    }

    .chatbot-container {
        right: 1rem;
        bottom: 1rem;
    }

    .newsletter-form {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .hero-section h2 {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .news-title {
        font-size: 1.1rem;
    }

    .chatbot-toggle {
        width: 50px;
        height: 50px;
    }

    .chatbot-window {
        height: calc(100vh - 100px);
    }
}

/* Modal de Leitura de Notícias */
.news-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    overflow-y: auto;
}

.news-modal.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.news-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.news-modal-content {
    position: relative;
    max-width: 900px;
    margin: 2rem auto;
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    animation: slideUpModal 0.4s ease;
    overflow: hidden;
}

@keyframes slideUpModal {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.news-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.news-modal-close:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: rotate(90deg);
}

.news-modal-header {
    position: relative;
    width: 100%;
    height: 400px;
    overflow: hidden;
}

.news-modal-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.news-modal-category-badge {
    position: absolute;
    bottom: 1.5rem;
    left: 1.5rem;
    padding: 0.5rem 1.2rem;
    background: var(--primary-color);
    color: white;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.news-modal-body {
    padding: 2rem 2.5rem;
}

.news-modal-title {
    font-size: 2.5rem;
    line-height: 1.3;
    margin-bottom: 1rem;
    color: var(--text-color);
    font-weight: 700;
}

.news-modal-meta {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
    flex-wrap: wrap;
}

.news-modal-source {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1rem;
}

.news-modal-date {
    color: var(--text-light);
    font-size: 0.95rem;
}

.news-modal-text {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-color);
    margin-bottom: 2rem;
}

.news-modal-text p {
    margin-bottom: 1.5rem;
}

.news-modal-text p:last-child {
    margin-bottom: 0;
}

.news-modal-footer {
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
}

.news-modal-credits {
    color: var(--text-light);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.news-modal-credits strong {
    color: var(--text-color);
}

/* Prevenir scroll do body quando modal aberto */
body.modal-open {
    overflow: hidden;
}

/* Modo Escuro para o Modal */
[data-theme="dark"] .news-modal-content {
    background: var(--card-bg);
}

[data-theme="dark"] .news-modal-title {
    color: var(--text-color);
}

[data-theme="dark"] .news-modal-text {
    color: var(--text-color);
}

[data-theme="dark"] .news-modal-meta {
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .news-modal-footer {
    border-top-color: var(--border-color);
}

/* Responsivo Modal */
@media (max-width: 768px) {
    .news-modal-content {
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
    }

    .news-modal-header {
        height: 300px;
    }

    .news-modal-body {
        padding: 1.5rem;
    }

    .news-modal-title {
        font-size: 1.8rem;
    }

    .news-modal-text {
        font-size: 1rem;
    }

    .news-modal-close {
        top: 0.5rem;
        right: 0.5rem;
        width: 35px;
        height: 35px;
    }

    .news-modal-category-badge {
        bottom: 1rem;
        left: 1rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .news-modal-header {
        height: 250px;
    }

    .news-modal-title {
        font-size: 1.5rem;
    }

    .news-modal-text {
        font-size: 0.95rem;
        line-height: 1.7;
    }
}
