/* Base dark gradient background */
body {
    background: linear-gradient(135deg, var(--bg-main) 0%, var(--accent2) 100%);
    color: var(--text-main);
    font-family: 'Segoe UI', 'Roboto', Arial, sans-serif;
    margin: 0;
}

/* Header styles */
header {
    background: var(--bg-card);
    color: var(--accent2);
    padding: 24px 0 16px 0;
    text-align: center;
    box-shadow: 0 2px 16px 0 #b86bff33;
}

h1 {
    margin: 0 0 10px 0;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent2);
    letter-spacing: 2px;
}

.header-flex {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    padding: 0 2vw;
}

.header-logo {
    flex: 0 0 auto;
    margin-right: 32px;
}

.header-logo h1 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent2);
    letter-spacing: 2px;
    text-align: left;
}

.header-controls {
    flex: 1 1 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.header-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 8px;
}

.header-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(90deg, #6e4cff 0%, #b86bff 100%);
    color: #fff;
    padding: 10px 28px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 1.15rem;
    text-decoration: none;
    box-shadow: 0 2px 12px #b86bff44;
    border: none;
    transition: background 0.2s, color 0.2s, transform 0.15s;
    position: relative;
    overflow: hidden;
}
.header-link::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    box-shadow: 0 0 0 0 #fff0;
    transition: box-shadow 0.2s;
    pointer-events: none;
}
.header-link:hover, .header-link:focus {
    background: linear-gradient(90deg, #b86bff 0%, #6e4cff 100%);
    color: #fff;
    transform: translateY(-2px) scale(1.03);
}
.header-link:active {
    transform: scale(0.98);
}

/* Inputs and buttons */
input[type="text"], select {
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    margin: 0 8px 8px 0;
    background: #23244a;
    color: #e0e0ff;
    font-size: 1rem;
    outline: none;
    box-shadow: 0 2px 8px #b86bff22;
}

button {
    padding: 10px 24px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(90deg, #b86bff 0%, #6e4cff 100%);
    color: #fff;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    margin: 0 8px 8px 0;
    box-shadow: 0 4px 16px #b86bff55;
    transition: background 0.2s, box-shadow 0.2s;
}
button:hover, button:focus {
    background: linear-gradient(90deg, #6e4cff 0%, #b86bff 100%);
    box-shadow: 0 6px 24px #b86bff88;
}

/* Dark mode toggle */
#dark-mode-toggle {
    font-size: 1.3rem;
    background: transparent;
    color: #b86bff;
    box-shadow: none;
    border: 2px solid #b86bff;
    padding: 8px 16px;
    margin-left: 16px;
}

/* Main content */
main {
    display: block;
}

/* Article cards */
.article {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 28px;
    width: 100%;
    box-sizing: border-box;
    padding: 32px 28px;
    background: var(--bg-card);
    border-radius: 18px;
    box-shadow: 0 0 32px #b86bff44, 0 2px 8px #000a;
    transition: box-shadow 0.2s;
    min-height: 240px;
}
.article:hover {
    box-shadow: 0 0 48px #b86bff99, 0 4px 16px #000c;
}
.article h2 {
    margin: 0 0 10px;
    color: var(--accent2);
    font-size: 1.5rem;
}
.article p {
    line-height: 1.7;
    color: var(--text-main);
}

/* Flexbox layout for articles */
.article-flex {
    display: flex;
    align-items: flex-start;
    gap: 32px;
}

.article-img-wrap {
    flex: 0 0 180px;
    max-width: 180px;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.article-img {
    width: 100%;
    height: 100%;
    border-radius: 16px;
    object-fit: cover;
    box-shadow: 0 2px 12px #0004;
    background: #222;
}

.article-content {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-width: 0;
}

.article-content h2 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 1.3rem;
    color: var(--accent2);
    font-weight: 700;
    line-height: 1.2;
}

.article-content p {
    margin: 0 0 18px 0;
    color: var(--text-main);
    font-size: 1.05rem;
    line-height: 1.5;
}

.read-more-btn {
    align-self: flex-start;
    margin-top: auto;
}

/* Loading and error */
#loading {
    color: var(--accent2);
    font-size: 1.2rem;
    text-align: center;
    margin: 32px 0;
}
#error-message {
    display: none;
    color: #ff4c4c; /* Use a variable if you want, or keep red for errors */
    text-align: center;
    margin: 32px auto 0 auto;
    font-size: 1.3rem;
    max-width: 700px;
}

/* Pagination button */
#load-more-btn {
    display: block;
    margin: 32px auto;
}

#pagination-controls {
    text-align: center;
    margin: 32px 0;
    width: 100%;
}

#pagination-controls button {
    display: inline-block;
    margin: 0 12px;
    padding: 12px 32px;
    font-size: 1.1rem;
    border-radius: 10px;
    border: none;
    background: var(--accent2);
    color: var(--text-main);
    font-weight: bold;
    box-shadow: 0 2px 12px var(--accent2)44;
    cursor: pointer;
    transition: background 0.2s;
    vertical-align: middle;
}

/* Footer */
footer {
    text-align: center;
    padding: 18px 0;
    background: var(--bg-card);
    color: var(--accent2);
    font-size: 1rem;
    letter-spacing: 1px;
    box-shadow: 0 -2px 16px 0 var(--accent2)33;
    position: relative;
    bottom: 0;
    width: 100%;
}

/* Modal styles */
.modal {
    position: fixed;
    z-index: 10000;
    left: 0; top: 0; right: 0; bottom: 0;
    background: rgba(24, 25, 43, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-content {
    background: #23244a;
    border-radius: 18px;
    padding: 32px;
    max-width: 500px;
    width: 90vw;
    box-shadow: 0 8px 32px #b86bff55;
    position: relative;
    color: #e0e0ff;
}
.close {
    position: absolute;
    top: 18px;
    right: 24px;
    font-size: 2rem;
    color: #b86bff;
    cursor: pointer;
}

/* News grid: two columns on desktop, one on mobile */
#news-articles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 32px;
    padding: 32px 5vw;
}

.article-card {
    background: var(--bg-card);
    color: var(--text-main);
    padding: 24px;
    transition: transform 0.15s, box-shadow 0.15s;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}
.article-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 8px 32px #b86bff33;
}
.article-card img {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 18px;
}
.article-card h2 {
    color: var(--accent2);
    font-size: 1.3rem;
    margin: 0 0 10px 0;
    transition: color 0.3s;
}
.article-card h3,
.article-card h4 {
    color: var(--accent2);
    transition: color 0.3s;
}
.article-card p {
    color: var(--text-main);
    margin-bottom: 12px;
}
.article-card .card-actions {
    margin-top: auto;
    display: flex;
    gap: 12px;
}

/* Newsletter section */
#newsletter {
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: 0 2px 16px #b86bff22;
    padding: 32px 0;
    margin-top: 48px;
}
#newsletter-form input[type="email"] {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    margin-right: 12px;
    font-size: 1rem;
    background: var(--bg-main);
    color: var(--accent2);
    box-shadow: 0 1px 4px var(--accent2)22;
}
#newsletter-form input[type="email"]:focus {
    outline: 2px solid var(--accent2);
}
#newsletter-message {
    margin-top: 12px;
    color: var(--accent1);
    font-weight: bold;
}

/* Responsive: stack on mobile */
@media (max-width: 900px) {
    #news-articles {
        grid-template-columns: 1fr;
    }
    .article {
        flex-direction: column;
        gap: 18px;
        padding: 18px 10px;
    }
    .article-img-wrap {
        max-width: 100%;
        height: 180px;
        margin-bottom: 12px;
    }
}

.article-full-img {
    width: 100%;
    height: 400px; /* or 100vh for full viewport height */
    background-size: cover;
    background-position: center;
    border-radius: 24px;
    margin-bottom: 32px;
}

#article-container {
    background: rgba(36, 20, 60, 0.97);
    color: #e0e0ff;
    max-width: 900px;
    margin: 40px auto;
    padding: 48px 32px;
    border-radius: 18px;
    min-height: 70vh;
    box-shadow: 0 0 32px #b86bff44, 0 2px 8px #000a;
    position: relative;
}

/* Make sure all text inside the article is light */
#article-container,
#article-container h1,
#article-container h2,
#article-container h3,
#article-container h4,
#article-container h5,
#article-container h6,
#article-container p,
#article-container li,
#article-container a {
    color: #e0e0ff;
}

/* Make links stand out */
#article-container a,
#article-container a:visited {
    color: #b86bff;
    text-decoration: underline;
    font-weight: 600;
    transition: color 0.2s;
}

#article-container a:hover,
#article-container a:focus {
    color: #fff;
    background: #b86bff33;
    border-radius: 4px;
    text-decoration: underline;
}

/* Modo oscuro (por defecto) */
body:not(.light-mode):not([data-theme]) {
    --accent1: #a084ee;
    --accent2: #b86bff;
    --bg-main: #24143c;
    --bg-card: #23244a;
    --text-main: #e0e0ff;
}

/* Modo claro */
body.light-mode {
    --accent1: #ffb300;
    --accent2: #ffd54f;
    --bg-main: #fffbe7;
    --bg-card: #fff;
    --text-main: #23244a;
}

/* Tema Default */
body[data-theme="default"] {
    --accent1: #a084ee;
    --accent2: #b86bff;
    --bg-main: #24143c;
    --bg-card: #23244a;
    --text-main: #e0e0ff;
}

/* Tema Blue */
body[data-theme="blue"] {
    --accent1: #4c6eff;
    --accent2: #6ecbff;
    --bg-main: #18192b;
    --bg-card: #23244a;
    --text-main: #e0e0ff;
}

/* Tema Green */
body[data-theme="green"] {
    --accent1: #1ecb8c;
    --accent2: #5fffa1;
    --bg-main: #14291e;
    --bg-card: #1a3a2a;
    --text-main: #e0ffe0;
}

/* Use CSS variables throughout */
body, html {
    background: linear-gradient(135deg, var(--bg-main) 0%, var(--accent2) 100%);
    color: var(--text-main);
}
.header-link,
button,
.header-btn {
    background: linear-gradient(90deg, var(--accent2) 0%, var(--accent1) 100%);
    color: var(--text-main);
}
.header-link:hover, .header-link:focus,
button:hover, button:focus,
.header-btn:hover, .header-btn:focus {
    background: linear-gradient(90deg, var(--accent1) 0%, var(--accent2) 100%);
}
.article-card {
    background: var(--bg-card);
    color: var(--text-main);
}
.article-card h2,
.article-card h3,
.article-card h4 {
    color: var(--accent2);
}