:root {
    --primary-color: #3f72af;
    --secondary-color: #dbe2ef;
    --accent-color: #f9f7f7;
    --text-color: #112d4e;
    --light-bg-color: #e5eaf5;
}

body.dark-mode {
    --primary-color: #6a8cff;
    --secondary-color: #2c3e50;
    --accent-color: #212121;
    --text-color: #ecf0f1;
    --light-bg-color: #34495e;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--light-bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.5s ease, color 0.5s ease;
}

/* Header */
.main-header {
    background-color: var(--primary-color);
    color: var(--accent-color);
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: relative;
    transition: background-color 0.5s ease;
}

.header-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
}

.main-header h1 {
    margin: 0 0 10px 0;
    font-size: 2.5rem;
}

.top-nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* Main Layout */
.container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px;
    max-width: 1200px;
    margin: auto;
}

@media (min-width: 768px) {
    .container {
        grid-template-columns: 250px 1fr;
    }
}

/* Sidebar */
.sidebar {
    background-color: var(--secondary-color);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: background-color 0.5s ease;
}

.sidebar .btn {
    width: 100%;
}

/* Main Content */
.main-content {
    background-color: var(--accent-color);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: background-color 0.5s ease;
}

.main-content h2 {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
    transition: color 0.5s ease;
}

.news-card {
    background-color: #f0f4f9;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: background-color 0.5s ease;
}

body.dark-mode .news-card {
    background-color: #3b506b;
}

/* Buttons */
.btn {
    background-color: var(--primary-color);
    color: var(--accent-color);
    border: none;
    padding: 12px 20px;
    font-size: 1rem;
    border-radius: 50px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease, color 0.5s ease;
    text-transform: uppercase;
    font-weight: bold;
}

.btn:hover {
    background-color: #2b567d;
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

/* Dropdown Language Button */
.dropdown-lang {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--accent-color);
    min-width: 150px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: 8px;
    overflow: hidden;
    left: 50%;
    transform: translateX(-50%);
    top: 100%;
    margin-top: 10px;
}

.dropdown-content a {
    color: var(--text-color);
    padding: 12px 16px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background-color 0.3s ease;
}

.dropdown-content a:hover {
    background-color: var(--secondary-color);
}

.dropdown-lang:hover .dropdown-content {
    display: block;
}

/* Flags */
.flag {
    width: 20px;
    height: 15px;
    background-size: cover;
    background-repeat: no-repeat;
    border: 1px solid #ccc;
}

.flag-ca { background-image: url('https://upload.wikimedia.org/wikipedia/commons/thumb/c/ce/Flag_of_Catalonia.svg/200px-Flag_of_Catalonia.svg.png'); }
.flag-es { background-image: url('https://upload.wikimedia.org/wikipedia/commons/thumb/9/9a/Flag_of_Spain.svg/200px-Flag_of_Spain.svg.png'); }
.flag-en { background-image: url('https://upload.wikimedia.org/wikipedia/commons/thumb/a/a5/Flag_of_the_United_Kingdom.svg/200px-Flag_of_the_United_Kingdom.svg.png'); }

/* Footer */
.main-footer {
    background-color: var(--primary-color);
    color: var(--accent-color);
    padding: 30px 20px;
    text-align: center;
    margin-top: 20px;
    transition: background-color 0.5s ease;
}

.footer-social {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.footer-social a {
    color: var(--accent-color);
    font-size: 1.5rem;
    transition: color 0.3s ease, transform 0.2s ease;
}

.footer-social a:hover {
    color: var(--secondary-color);
    transform: scale(1.1);
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.footer-links a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: bold;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

.main-footer p {
    margin: 0;
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Responsive adjustments for small screens */
@media (max-width: 767px) {
    .header-controls {
        position: static;
        justify-content: center;
        margin-bottom: 10px;
    }

    .main-header h1 {
        font-size: 2rem;
    }

    .top-nav {
        flex-direction: column;
        align-items: center;
    }
    
    .sidebar {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
}