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

:root {
    --primary: #1a73e8;
    --secondary: #34a853;
    --danger: #ea4335;
    --warning: #fbbc04;
    --dark: #202124;
    --dark-light: #2d2e30;
    --text: #e8eaed;
    --text-secondary: #9aa0a6;
    --border: #3c4043;
    --bg: #131416;
    --bg-card: #1e1f21;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
header {
    background: var(--dark);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 {
    font-size: 1.8rem;
    margin-bottom: 0.3rem;
}

.tagline {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.header-stats {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.header-stats span {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.proxy-status {
    background: var(--dark-light);
    padding: 0.3rem 0.7rem;
    border-radius: 4px;
    font-size: 0.8rem;
    border: 1px solid var(--border);
}

.proxy-status.working {
    color: var(--secondary);
    border-color: var(--secondary);
}

.btn-refresh {
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.btn-refresh:hover {
    background: #1557b0;
}

/* Layout principal */
.main-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1rem;
    padding: 1rem;
    max-width: 1600px;
    margin: 0 auto;
}

/* Sidebar */
.sidebar {
    background: var(--dark);
    border-radius: 8px;
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 90px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: var(--dark-light);
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.filters-section h3 {
    font-size: 0.9rem;
    margin: 1.5rem 0 0.8rem 0;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.filters-section h3:first-child {
    margin-top: 0;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.3rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.filter-group label:hover {
    color: var(--text);
}

.filter-group input[type="checkbox"] {
    cursor: pointer;
}

#search-input {
    width: 100%;
    padding: 0.7rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text);
    font-size: 0.9rem;
}

#search-input:focus {
    outline: none;
    border-color: var(--primary);
}

.options-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn-secondary {
    width: 100%;
    padding: 0.7rem;
    background: var(--dark-light);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 5px;
    cursor: pointer;
    margin-top: 1rem;
}

.btn-secondary:hover {
    background: var(--border);
}

/* Custom RSS Section */
.custom-rss-section {
    margin-top: 1rem;
}

.custom-rss-section input[type="text"] {
    width: 100%;
    padding: 0.7rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.custom-rss-section input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
}

#add-custom-rss {
    width: 100%;
    padding: 0.7rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-bottom: 1rem;
}

#add-custom-rss:hover {
    background: #1557b0;
}

#custom-rss-list {
    margin-top: 1rem;
}

.custom-rss-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.custom-rss-item label {
    flex: 1;
}

.btn-remove {
    background: var(--danger);
    color: white;
    border: none;
    padding: 0.3rem 0.6rem;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-remove:hover {
    background: #c62828;
}

/* News Actions */
.news-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.btn-action {
    padding: 0.5rem 0.8rem;
    background: var(--dark-light);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
}

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

/* Modal Actions */
.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.modal-actions button {
    flex: 1;
}

.modal-btn-open, .modal-btn-extract {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s;
}

.modal-btn-open {
    background: var(--primary);
    color: white;
}

.modal-btn-open:hover {
    background: #1557b0;
}

.modal-btn-extract {
    background: var(--dark-light);
    color: var(--text);
    border: 1px solid var(--border);
}

.modal-btn-extract:hover {
    background: var(--secondary);
    border-color: var(--secondary);
}

/* Article Content in Modal */
.article-header {
    margin-bottom: 1.5rem;
}

.article-header h2 {
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.article-byline {
    color: var(--text-secondary);
    font-style: italic;
    margin: 0.5rem 0;
}

.article-excerpt {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.6;
    margin: 1rem 0;
    padding: 1rem;
    background: var(--dark-light);
    border-left: 3px solid var(--primary);
    border-radius: 4px;
}

.article-meta {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 1rem;
}

.article-meta a {
    color: var(--primary);
    text-decoration: none;
}

.article-meta a:hover {
    text-decoration: underline;
}

.article-content {
    line-height: 1.8;
    padding: 1rem 0;
    max-height: 60vh;
    overflow-y: auto;
    font-size: 1.05rem;
}

.article-content p {
    margin-bottom: 1rem;
}

.article-content img {
    max-width: 100%;
    height: auto;
    margin: 1.5rem 0;
    border-radius: 8px;
}

.article-content h1, 
.article-content h2, 
.article-content h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text);
}

.article-content ul, 
.article-content ol {
    margin: 1rem 0 1rem 2rem;
}

.article-content li {
    margin-bottom: 0.5rem;
}

.article-content blockquote {
    border-left: 3px solid var(--primary);
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: var(--text-secondary);
    font-style: italic;
}

.article-content::-webkit-scrollbar {
    width: 8px;
}

.article-content::-webkit-scrollbar-track {
    background: var(--dark-light);
}

.article-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.modal-btn-copy {
    background: var(--secondary);
    color: white;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s;
}

.modal-btn-copy:hover {
    background: #2a9d42;
}

.modal-btn-archive {
    background: var(--warning);
    color: var(--dark);
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s;
}

.modal-btn-archive:hover {
    background: #f5b800;
}

/* Contenido principal */
.content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Mapa */
.map-container {
    background: var(--dark);
    border-radius: 8px;
    overflow: hidden;
    height: 400px;
    border: 1px solid var(--border);
}

#map {
    height: 100%;
    width: 100%;
}

/* Controles de vista */
.news-view {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--dark);
    padding: 1rem;
    border-radius: 8px;
}

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

.view-btn {
    padding: 0.5rem 1rem;
    background: var(--dark-light);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
}

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

.sort-controls select {
    padding: 0.5rem 1rem;
    background: var(--dark-light);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 5px;
    cursor: pointer;
}

/* Lista de noticias */
.news-list {
    display: grid;
    gap: 1rem;
}

.news-list.cards-view {
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
}

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

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

/* Tarjeta de noticia */
.news-card {
    background: var(--dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s;
    cursor: pointer;
}

.news-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.3);
}

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

.news-card-content {
    padding: 1rem;
}

.news-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.news-source {
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
}

.news-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

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

.news-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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

.news-location {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: var(--secondary);
}

.news-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.news-tag {
    padding: 0.2rem 0.6rem;
    background: var(--dark-light);
    color: var(--text-secondary);
    border-radius: 12px;
    font-size: 0.75rem;
}

/* Vista lista */
.list-view .news-card {
    display: flex;
    flex-direction: row;
}

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

.list-view .news-card-content {
    flex: 1;
}

/* Vista compacta */
.compact-view .news-card {
    padding: 1rem;
}

.compact-view .news-card-image {
    display: none;
}

.compact-view .news-title {
    font-size: 1rem;
}

.compact-view .news-description {
    -webkit-line-clamp: 2;
}

/* Loading */
.loading {
    text-align: center;
    padding: 4rem;
    color: var(--text-secondary);
}

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

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Paginación */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding: 2rem 0;
}

.pagination button {
    padding: 0.7rem 1.5rem;
    background: var(--dark);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 5px;
    cursor: pointer;
}

.pagination button:hover:not(:disabled) {
    background: var(--primary);
    border-color: var(--primary);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#page-info {
    color: var(--text-secondary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    overflow-y: auto;
}

.modal-content {
    background: var(--dark);
    margin: 2% auto;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    position: relative;
    border: 1px solid var(--border);
}

.close {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-secondary);
    cursor: pointer;
}

.close:hover {
    color: var(--text);
}

/* Responsive */
@media (max-width: 1024px) {
    .main-container {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: static;
        max-height: none;
    }
    
    .news-list.cards-view {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

@media (max-width: 768px) {
    .news-list.cards-view {
        grid-template-columns: 1fr;
    }
    
    .list-view .news-card {
        flex-direction: column;
    }
    
    .list-view .news-card-image {
        width: 100%;
        height: 200px;
    }
    
    .map-container {
        height: 300px;
    }
    
    .header-stats {
        font-size: 0.8rem;
    }
}

/* Estilos para marcadores del mapa */
.leaflet-popup-content-wrapper {
    background: var(--dark);
    color: var(--text);
    border: 1px solid var(--border);
}

.leaflet-popup-tip {
    background: var(--dark);
    border: 1px solid var(--border);
}

.popup-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.popup-source {
    color: var(--primary);
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
}

.popup-date {
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
}

.popup-description {
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.popup-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.85rem;
}

.popup-link:hover {
    text-decoration: underline;
}
