/* Apple Color Palette & Global Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background-color: #FFFFFF;
    color: #1d1d1f;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color 0.5s, color 0.5s;
}

body.dark-mode {
    background-color: #000000;
    color: #e8e8ed;
}


/* General Content Styling */
h1, h2, h3, h4 {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-weight: 600;
    color: #1d1d1f;
}

body.dark-mode h1, body.dark-mode h2, body.dark-mode h3, body.dark-mode h4 {
    color: #e8e8ed;
}

h1 {
    font-size: 2.8rem;
    text-align: center;
    margin-top: 0.5rem;
}

p {
    font-size: 1.1rem;
    line-height: 1.65;
    color: #333333;
    text-align: center;
    max-width: 800px;
    margin: 1rem auto 3rem auto;
}

.news-list {
    list-style: none;
    padding: 0;
    max-width: 800px;
    margin: 2rem auto;
}

.news-list li {
    background-color: #f5f5f7;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.news-item {
    background-color: #f5f5f7;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    max-width: 800px;
    margin: 2rem auto;
}

body.dark-mode .news-list li, body.dark-mode .news-item {
    background-color: #1c1c1e;
    border-color: #333333;
}

body.dark-mode p {
    color: #cccccc;
}

/* Footer */
.footer {
    background-color: #f5f5f7;
    color: #6e6e73;
    padding: 20px;
    margin-top: auto;
    display: flex;
    flex-direction: column; /* Stack items vertically */
    align-items: center; /* Center horizontally */
    text-align: center;
}

.footer p {
    font-size: 0.9rem;
    margin: 0;
    line-height: 1.5;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    color: #6e6e73;
}

body.dark-mode .footer p {
    color: #86868b;
}

body.dark-mode .footer {
    background-color: #121212;
    color: #86868b;
}

/* Responsive Design */
@media (max-width: 768px) {
    h1 { font-size: 2.5rem; }
    p { padding: 0 1rem; }
}

.dark-mode-switch {
  width: 60px;
  height: 30px;
  position: relative;
  display: inline-block;
  margin-top: 5px; /* Adjusted for vertical alignment */
}

.dark-mode-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  -webkit-transition: .4s;
  transition: .4s;
  border-radius: 30px;
}

.ball {
  position: absolute;
  height: 22px;
  width: 22px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  -webkit-transition: .4s;
  transition: .4s;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ball .fa-sun {
  display: none;
  color: white;
}

.ball .fa-moon {
  display: block;
  color: black;
}

input:checked + .slider {
  background-color: #2997FF;
}

input:checked + .slider .ball {
  background-color: black;
  -webkit-transform: translateX(30px);
  -ms-transform: translateX(30px);
  transform: translateX(30px);
}

input:checked + .slider .ball .fa-sun {
  display: block;
}

input:checked + .slider .ball .fa-moon {
  display: none;
}

/* Sidebar Styles */
.sidebar {
    position: sticky;
    top: 250px; /* Adjust based on navbar height */
    left: 20px;
    width: 200px;
    float: left;
    margin-right: 20px;
    z-index: 1000;
}

.sidebar .nav-link {
    color: #6e6e73;
    padding: 10px 15px;
    border-radius: 8px;
    transition: background-color 0.3s, color 0.3s;
}

.sidebar .nav-link:hover {
    background-color: #f5f5f7;
    color: #1d1d1f;
}

.sidebar .nav-link.active {
    background-color: #007aff;
    color: #fff;
    font-weight: 500;
}

body.dark-mode .sidebar .nav-link {
    color: #86868b;
}

body.dark-mode .sidebar .nav-link:hover {
    background-color: #1c1c1e;
    color: #e8e8ed;
}

body.dark-mode .sidebar .nav-link.active {
    background-color: #8ab4f8;
    color: #000;
}

/* Adjust main content to accommodate sidebar */
.news-container {
    position: relative;
}

.news-container > h1,
.news-container > .year-separator,
.news-container > .row {
    margin-left: 240px; /* sidebar width + some margin */
}

/* News Box Styling */
.news-container {
    padding-top: 20px;
    padding-bottom: 20px;
    padding-left: 1.5rem; /* Added left padding */
    padding-right: 1.5rem; /* Added right padding */
}

.news-container h1 {
    margin-bottom: 2.5rem; /* Increased spacing */
}

.year-separator {
    text-align: center;
    margin: 3rem 0 2rem 0; /* Top, Right/Left, Bottom */
    position: relative;
    font-size: 1.8rem;
    font-weight: 600;
    color: #1d1d1f;
    scroll-margin-top: 120px;
}

.year-separator::before,
.year-separator::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 30%; /* Adjust width of the line */
    height: 1px;
    background-color: #e0e0e0;
}

.year-separator::before {
    left: 0;
}

.year-separator::after {
    right: 0;
}

body.dark-mode .year-separator {
    color: #e8e8ed;
}

body.dark-mode .year-separator::before,
body.dark-mode .year-separator::after {
    background-color: #333333;
}

/* Responsive Adjustments for year-separator */
@media (max-width: 768px) {
    .year-separator {
        font-size: 1.5rem;
        margin: 2.5rem 0 1.5rem 0;
    }
    .year-separator::before,
    .year-separator::after {
        width: 25%;
    }
}

@media (max-width: 576px) {
    .year-separator {
        font-size: 1.2rem;
        margin: 2rem 0 1rem 0;
    }
    .year-separator::before,
    .year-separator::after {
        width: 20%;
    }
}

.news-box {
    background-color: #f5f5f7;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%; /* Ensure boxes in a row have equal height */
    display: flex;
    flex-direction: column;
}

.news-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.news-image-frame {
    width: 100%;
    height: 250px; /* Fixed height for the image frame */
    overflow: hidden; /* Hide anything that overflows */
    display: flex; /* Use flexbox to center the image */
    justify-content: center; /* Center horizontally */
    align-items: center; /* Center vertically */
    border-bottom: 1px solid #e0e0e0;
}

body.dark-mode .news-image-frame {
    border-color: #333333;
}

.news-box img {
    width: 100%;
    height: 100%; /* Image takes 100% height of its frame */
    object-fit: contain; /* Ensure entire image is visible, shrinking if needed */
    /* Removed border-bottom as it's now on the frame */
}

.news-content {
    padding: 1.5rem;
    flex-grow: 1; /* Allows content to expand and push footer down */
    display: flex;
    flex-direction: column;
}

.news-date {
    font-size: 0.9rem;
    color: #8e8e93;
    margin-bottom: 0.5rem;
    display: block;
}

.news-caption {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 1rem;
    flex-grow: 1; /* Allows caption to take available space */
}

.news-box .read-more {
    display: inline-block;
    margin-top: auto; /* Pushes the read more link to the bottom */
    color: #007aff;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.news-box .read-more:hover {
    color: #005bb5;
}

/* Dark Mode Adjustments for News Boxes */
body.dark-mode .news-box {
    background-color: #1c1c1e;
    border-color: #333333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

body.dark-mode .news-box img {
    /* border-color is now on news-image-frame */
}

body.dark-mode .news-date {
    color: #a2a2a7;
}

body.dark-mode .news-caption {
    color: #e8e8ed;
}

body.dark-mode .news-box .read-more {
    color: #8ab4f8; /* Lighter blue for dark mode */
}

body.dark-mode .news-box .read-more:hover {
    color: #6a9ee8;
}

/* Responsive Adjustments */
@media (max-width: 1199.98px) {
    .sidebar {
        position: static;
        width: 100%;
        float: none;
        margin: 0 0 1.5rem 0;
        top: auto;
        left: auto;
        z-index: auto;
    }

    .sidebar .nav {
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
    }

    .sidebar .nav-item {
        margin: 0 5px;
    }

    .news-container > h1,
    .news-container > .year-separator,
    .news-container > .row {
        margin-left: 0;
    }

    .news-image-frame {
        height: 200px; /* Adjusted height for medium screens */
    }
    .news-caption {
        font-size: 1.1rem;
    }
}

@media (max-width: 576px) {
    .news-image-frame {
        height: 170px; /* Adjusted height for small screens */
    }
    .news-caption {
        font-size: 1rem;
    }
    .news-content {
        padding: 1rem;
    }
    .news-date {
        font-size: 0.85rem;
    }
    .news-box .read-more {
        font-size: 0.9rem;
    }
}
