:root {
  --bg-color: #ffffff;
  --text-color: #333333;
  --card-bg: #f9f9f9;
  --card-shadow: rgba(0, 0, 0, 0.1);
  --nav-bg: #333;
  --nav-text: #ffffff;
  --button-bg: #4a4a4a;
  --button-text: #ffffff;
  --accent-color: #007BFF;
  --hover-color: #0056b3;
  --date-text-color: #808080;
}

.dark-mode {
  --bg-color: #121212;
  --text-color: #e0e0e0;
  --card-bg: #1e1e1e;
  --card-shadow: rgba(255, 255, 255, 0.1);
  --nav-bg: #2c2c2c;
  --nav-text: #e0e0e0;
  --button-bg: #333;
  --button-text: #e0e0e0;
}

body {
  font-family: 'Roboto', Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: background-color 0.3s, color 0.3s;
  visibility: hidden;
  position: relative;
}


#loading-animation {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
}

header {
  background-color: var(--nav-bg);
  color: var(--nav-text);
  padding: 0;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

#top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 20px;
  white-space: nowrap;
}

#top-bar h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  position: relative;
}

.year-and-theme {
  display: inline-flex;
  align-items: center;
}

.year-display-header {
  font-size: 10px;
  color: var(--button-text);
  transform: rotate(270deg); 
  position: absolute;
  top: 19px; 
  left: 5px; 
  white-space: nowrap;
  margin: 0;
}

#theme-toggle {
  background: var(--button-bg);
  color: var(--button-text);
  border: none;
  border-radius: 5px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s, color 0.3s;
  display: flex;
  align-items: center;
}

#theme-toggle:hover {
  background-color: var(--hover-color);
}

#theme-toggle .icon {
  margin-right: 5px;
}

#date-nav {
  display: flex;
  justify-content: space-around;
  background-color: var(--nav-bg);
  padding: 5px 10px;
}

#date-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: none;
  border: none;
  color: var(--nav-text);
  font-size: 1em;
  cursor: pointer;
  padding: 5px 10px;
  margin: 0 2px;
  transition: color 0.3s;
}

#date-nav .day-name {
  font-size: 16px;
}

#date-nav .date-text {
  font-size: 10px;
  color: var(--date-text-color);
  opacity: 1;
}

#date-nav button:hover {
  text-decoration: underline;
  color: var(--accent-color);
}

#date-nav button.current-day {
  font-weight: bold;
  color: var(--accent-color);
}

nav {
  overflow-x: auto;
  white-space: nowrap;
  padding: 5px 0;
  position: relative;
}

nav button {
  background: none;
  border: none;
  color: var(--nav-text);
  font-size: 1em;
  cursor: pointer;
  padding: 5px 10px;
  margin: 0 2px;
  transition: color 0.3s;
}

nav button:hover {
  text-decoration: underline;
  color: var(--accent-color);
}

nav button.current-category {
  font-weight: bold;
  color: var(--accent-color);
}

nav::-webkit-scrollbar {
  display: none;
}

.nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #ccc;
  font-size: 20px;
  cursor: pointer;
  display: none;
  z-index: 1;
}

.nav-arrow.left {
  left: 0;
}

.nav-arrow.right {
  right: 0;
}

nav:hover .nav-arrow {
  display: block;
}

nav:hover .nav-arrow.left:disabled,
nav:hover .nav-arrow.right:disabled {
  display: none;
}

.dark-mode .nav-arrow {
  color: #666;
}

#news-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start; 
  padding: 20px;
  flex-grow: 1;
  gap: 20px;
}

.article-card {
  flex: 1 0 250px;
  min-width: 250px;
  max-width: 500px;
  background: var(--card-bg);
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 4px 8px var(--card-shadow);
  transition: transform 0.3s;
}

.article-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 12px var(--card-shadow);
}

.article-card h2 {
  color: var(--text-color);
  font-size: 1.2em;
  margin-bottom: 10px;
  font-weight: 600;
}

.article-card p {
  font-size: 0.9em;
  color: rgba(var(--text-color), 0.8);
}

.article-card a {
  color: var(--accent-color);
  text-decoration: none;
  display: block;
  margin-top: 10px;
  transition: color 0.3s;
}

.article-card a:hover {
  text-decoration: underline;
  color: var(--hover-color);
}

.modal {
  display: none;
  position: fixed;
  z-index: 1;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.4);
  transition: opacity 0.3s;
}

.modal-content {
  background-color: var(--card-bg);
  margin: 15% auto;
  padding: 20px;
  border-radius: 10px;
  width: 80%;
  max-width: 800px;
  box-shadow: 0 4px 8px var(--card-shadow);
  transition: transform 0.3s, opacity 0.3s;
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.3s;
}

.close:hover,
.close:focus {
  color: black;
  text-decoration: none;
  cursor: pointer;
}

#modal-title {
  font-size: 1.5em;
  margin-bottom: 15px;
  font-weight: 600;
}

#modal-key-takeaways {
  list-style-type: none;
  padding-left: 0;
}

#modal-key-takeaways li {
  margin-bottom: 10px;
  color: var(--text-color);
}

#modal-article {
  margin-top: 20px;
  font-size: 1em;
  line-height: 1.8;
  text-align: justify;
}

.cookie-consent-modal {
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  visibility: visible;
}

.consent-content {
  background-color: var(--card-bg);
  color: var(--text-color);
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  max-width: 600px;
  box-shadow: 0 4px 8px var(--card-shadow);
}

.consent-content h2 {
  margin-bottom: 15px;
  font-size: 1.5em;
}

.consent-content p {
  font-size: 1em;
  line-height: 1.5;
  margin-bottom: 15px;
}

.consent-content button {
  background-color: var(--button-bg);
  color: var(--button-text);
  border: none;
  padding: 10px 20px;
  margin: 5px;
  cursor: pointer;
  font-size: 1em;
  transition: background-color 0.3s;
}

.consent-content button:hover {
  background-color: var(--hover-color);
}

.loader {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  animation: spin 1s linear infinite;
  margin: 50px auto;
}

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

@media  {
  #top-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start; /* Changed from center to align items from the top */
    padding: 5px 10px; /* Reduce padding for smaller screens */
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  #top-bar h1 {
    font-size: 24px;
    margin-right: 20px; /* Add some space for the year display */
    flex-shrink: 0;
  }

  #theme-toggle {
    font-size: 14px;
    padding: 3px 6px;
    white-space: nowrap;
  }

  .year-display-header {
    transform: rotate(270deg);
    position: absolute;
    top: 10px; /* Adjust top position to avoid overlap */
    right: 5px; /* Move closer to the right edge */
    left: auto;
    font-size: 10px;
    color: var(--button-text);
    white-space: nowrap;
    margin: 0;
    z-index: 1;
  }

  .year-and-theme {
    position: relative;
    display: flex; /* Ensure this is a flex container */
    align-items: flex-start; /* Align items from the top */
  }
}
