/* GLOBAL */
body {
  font-family: 'Times New Roman', Times, serif;
  margin: 0;
  background-color: #F5F5DC;
  font-size: 16px; 
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  display: flex;
  /* min-height: auto; */
  flex: 1;
}

.sidebar {
  width: 220px;
  background: #003366;
  padding: 20px;
  color: white;
  box-sizing: border-box; 
}

.sidebar a {
  color: white;
  display: block;
  margin: 10px 0;
  text-decoration: none;
  font-size: 1rem; 
}

.content {
  flex: 1;
  padding: 40px;
  box-sizing: border-box;

  display: flex;
  flex-direction: column;
}

/* HEADINGS */
h1 {
  font-size: 5rem;
  text-align: center;
  color: #1f2f46;
  margin-top: 0;
}

.content h1 {
  margin-bottom: 5px;
  margin-top: 10px;
}

#name {
  font-size: 2.375rem; 
  margin: 0 0 50px 0;
  text-align: center;
  color: #1f2f46;
}

/* INFO SECTIONS */
.info-sections {
  display: flex;
  flex-direction: row;
  gap: 80px;
  align-items: stretch;
}

#about,
#updated-news {
  flex: 1;
  /* height: 220px; */
  padding: 20px;
  border-radius: 20px;
  min-height: 185px;  
  box-sizing: border-box;     
  display: flex;
  flex-direction: column;
}

#about {
  background-color: #1f2f46;
  color: white;
  width:auto;
}

#updated-news {
  background-color: #FEED95;
  color: #1f2f46;
  width: auto;
}

#about h2,
#updated-news h2 {
  margin-top: 5px;
  margin-bottom: 5px; 
}

#about h3 {
  margin: 6px 0;
}

#about a {
  color: white;
  text-decoration: none;
}

#about a:hover {
  text-decoration: underline;
}

.indent {
  margin-left: 80px;
}

/* NAVBAR */
nav {
  position: sticky;
  top: 0;
  z-index: 2000;
  background-color: #FEED95;
  box-shadow: 0 3px 10px rgba(0,0,0,0.15);
}

.menu {
  list-style: none;
  margin: 0;
  padding: 6px 20px;
  background-color: #FEED95;
  text-align: right;
}

.menu li {
  display: inline-block;
  position: relative;
}

.menu li a {
  display: block;
  color: #1f2f46;
  text-align: center;
  padding: 10px 20px;   
  font-size: 1.1875rem; 
  font-weight: bold;
  text-decoration: none;
  border-radius: 10px;
  position: relative;
  transition: background-color 0.25s ease, transform 0.2s ease;
}

.menu li a:hover {
  background-color: rgba(31,47,70,0.12);
  transform: translateY(-1px);
}

.menu li a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 0;
  height: 2px;
  background-color: #1f2f46;
  transition: all 0.3s ease;
}

.menu li a:hover::after {
  width: 70%;
  left: 15%;
}

.menu li a:active {
  border: 3px solid #1f2f46;
}

/* DROPDOWN MENU */
.dropdown-content {
  display: none;
  position: absolute;
  background-color: #FEED95;
  min-width: 180px;
  z-index: 1000;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
  padding: 6px 0;
  text-align: left;
}

.dropdown-content li {
  display: block;
  text-align: left;
}

.dropdown-content li a {
  padding: 8px 12px;
  font-size: 0.9rem;
  margin-left: 0;
}

.dropdown-content li a:hover {
  background-color: rgba(31,47,70,0.12);
}

.dropdown:hover .dropdown-content {
  display: block;
}

.arrow {
  display: inline-block;
  margin-left: 6px;
  font-size: 12px;
  color: #1f2f46;
  transition: transform 0.3s ease;
}

.dropdown:hover .arrow {
  transform: rotate(90deg);
}

/* ANNOUNCEMENTS */
.news-container {
  height: auto;
  overflow: hidden;
  position: relative;
}

#news-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 180px; 
  overflow-y: auto;    
  overflow-x: hidden;

  /* Firefox */
  scrollbar-width: thin;
  scrollbar-color: #d4b200 #FEED95; 
}

/* Chrome, Edge, Safari */
#news-list::-webkit-scrollbar {
  width: 8px;
}

#news-list::-webkit-scrollbar-track {
  background: #FEED95;  
  border-radius: 10px;
}

#news-list::-webkit-scrollbar-thumb {
  background-color: #d4b200; 
  border-radius: 10px;
  border: 2px solid #FEED95; 
}

#news-list::-webkit-scrollbar-thumb:hover {
  background-color: #b89a00; 
}

#news-list li {
  display: block;
  padding: 6px 20px 6px 6px;
  font-size: 1rem; /* Use rem */
  text-align: left;
}

.news-item {
  display: block;
  margin-bottom: 10px;
}

.news-header {
  display: flex;
  justify-content: space-between;
  font-weight: bold;
  margin-bottom: 2px;
  flex-wrap: wrap;
  color: #1f2f46;
}

.news-text {
  margin-top: 5px;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: normal;
}

.news-date {
  font-weight: bold;
}

.news-time {
  font-style: italic;
}

.new-badge img {
  width: 20px;
  height: 20px;
  margin-left: 5px;
  vertical-align: middle;
  cursor: pointer;
  animation: blink 1s infinite; 
}

.new-badge img {
  width: 25px;    
  height: auto;
  vertical-align: middle;
}


.news-text a img {
  width: 20px;
  height: 20px;
  margin-left: 5px;
  vertical-align: middle;
  cursor: pointer;
  animation: blink 1s infinite;
}

/* Clickable older text */
.news-text a {
  color: #1f2f46;
  text-decoration: none;
}

.news-text a:hover {
  text-decoration: underline;
}

@keyframes blink {
  0%, 50%, 100% { opacity: 1; }
  25%, 75% { opacity: 0; }
}

/* CONSTRUCTION BANNER */
.construction-banner {
  width: 100%;
  background-color: #1f2f46;
  overflow: hidden;
  white-space: nowrap;
  box-sizing: border-box;
  border-radius: 4px;
}

.construction-banner p {
  display: inline-block;
  color: #FFD700; 
  font-weight: bold;
  font-size: 10px;
  padding-left: 100%; 
  animation: scroll-text 15s linear infinite;
}

@keyframes scroll-text {
  0% { transform: translateX(0%); }
  100% { transform: translateX(-100%); }
}

/* COURSE / CALCULUS PAGE (same for all courses) */
#calc-heading {
  font-size: 2.625rem;
  text-align: center;
  color: #1f2f46;
  margin: 0 0 28px 0;
  position: relative;
}

#calc-heading::after {
  content: "";
  display: block;
  width: 160px;
  height: 3px;
  background-color: #1f2f46;
  margin: 12px auto 0;
  border-radius: 2px;
}

#calc-para,
#calc-para1 {
  font-size: 1.0625rem; 
  line-height: 1.8;
  color: #1f2f46;
  margin-bottom: 20px;
}

#calc-para a,
#calc-para1 a {
  font-weight: bold;
  color: #1f2f46;
  text-decoration: none;
  border-bottom: 2px solid #FEED95;
  padding-bottom: 2px;
  transition: border-color 0.2s ease;
}

#calc-para a:hover,
#calc-para1 a:hover {
  border-bottom-color: #1f2f46;
}

#calc-heading ~ h2 {
  margin-top: 36px;
  margin-bottom: 12px;
  font-size: 1.625rem; 
  color: #1f2f46;
  padding-left: 14px;
  position: relative;
}

#calc-heading ~ h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 4px;
  height: 65%;
  background-color: #1f2f46;
  border-radius: 2px;
}

#calc-heading ~ h2::after {
  content: "";
  display: block;
  width: 70px;
  height: 3px;
  background-color: #FEED95;
  margin-top: 6px;
}

#calc-heading ~ ul {
  padding-left: 22px;
}

.tutorial-list li {
  margin-bottom: 10px;
  font-size: 1.0625rem; 
}

.tutorial-list a {
  font-weight: bold;
  color: #1f2f46;
  text-decoration: none;
}

/* COURSE SUB-HEADINGS (h3) */
#calc-heading ~ h3 {
  position: relative;
  max-width: 900px;
  margin: 12px 0;
  padding-left: 20px;
  font-size: 1.25rem; 
  font-weight: bold;
  color: #1f2f46;
}

#calc-heading ~ h3::before {
  content: "";
  position: absolute;
  left: 0;
  top: 5px;
  width: 4px;
  height: 70%;
  background-color: #1f2f46;
  border-radius: 2px;
}

#calc-heading ~ h3::after {
  content: "";
  display: block;
  width: 120px;
  height: 3px;
  background-color: #FEED95;
  margin-top: 6px;
}

/* FOOTER */
footer {
  background-color: #1f2f46;
  color: white;
  text-align: center;
  padding: 22px 0;
  margin-top: 30px;
}

footer::before {
  content: "";
  display: block;
  width: 80%;
  height: 1px;
  background: rgba(255,255,255,0.15);
  margin: 0 auto 18px;
}

footer .footer-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 30px;
}

footer .footer-container a {
  color: white;
  font-size: 1.5rem; /* Use rem */
  text-decoration: none;
  position: relative;
  transition: transform 0.25s ease, color 0.25s ease;
}

footer .footer-container a:hover {
  color: #FEED95;
  transform: translateY(-4px);
}

footer .footer-container a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 0;
  height: 2px;
  background-color: #FEED95;
  transition: all 0.3s ease;
}

footer .footer-container a:hover::after {
  width: 70%;
  left: 15%;
}

/* RESPONSIVE */
@media (max-width: 1200px) {
  .sidebar {
    width: 200px;
  }
  .info-sections {
    gap: 40px;
    flex-direction: column;
    width: 100%;
    /* height: auto; */
  }
  #about {
    padding-bottom: 20px;
    margin: 4px 0; 
    text-align:start;
  }

  #updated-news h2 {
    margin-top: 0px;
  }

  #about, #updated-news {
    width: 100%;
    /* height: fit-content; */
  }
}

@media (max-width: 900px) {
  .container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    padding: 10px;
  }
  .content {
    padding: 20px;
  }
  .info-sections {
    gap: 30px;
  }

  #about h3 {
    margin: 4px 0;    
  }
  #about, #updated-news {
    flex: 1;
    width: 100%;
    max-width: 100% ;
    align-self: stretch;
    height: fit-content;
  }
}

@media (max-width: 768px) {
  h1 {
    font-size: 3rem;
  }
  #name {
    font-size: 2rem;
  }
  #calc-heading {
    font-size: 2rem;
  }
  #calc-heading ~ h2 {
    font-size: 1.375rem;
  }
  #calc-para, #calc-para1, .tutorial-list li {
    font-size: 1rem;
  }
  .news-container {
    height: 120px;
  }
  #news-list {
    max-height: 120px;
  }
}

@media (max-width: 600px) {
  .content {
    padding: 15px;
  }
  h1 {
    font-size: 2.5rem;
  }
  #name {
    font-size: 1.5rem;
  }
  #calc-heading {
    font-size: 1.75rem;
  }
  #calc-heading ~ h2 {
    font-size: 1.25rem;
  }
  #calc-para, #calc-para1, .tutorial-list li {
    font-size: 0.9375rem;
  }
  footer .footer-container {
    flex-direction: column;
    gap: 15px;
  }
  footer .footer-container a {
    font-size: 1.375rem;
  }
  .construction-banner p {
    font-size: 10px;
  }
}

@media (max-width: 480px) {
  .sidebar {
    padding: 5px;
  }
  .sidebar a {
    font-size: 0.875rem;
  }
  .menu li a {
    font-size: 1rem;
    padding: 10px;
  }
  .news-item {
    font-size: 0.875rem;
  }
  .new-badge {
    font-size: 0.875rem;
  }
  .new-badge::before {
    font-size: 18px;
  }
}

/* Touch-friendly adjustments for mobile */
@media (hover: none) and (pointer: coarse) {
  .menu li a, .sidebar a, .tutorial-list a {
    padding: 15px; /* Larger touch targets */
    min-height: 44px; /* iOS/Android guideline */
  }
  .dropdown:hover .dropdown-content {
    display: none; 
  }
  .dropdown:active .dropdown-content {
    display: block; 
  }
}

/* Cross-browser animation prefixes */
@keyframes blink {
  0%, 50%, 100% { opacity: 1; }
  25%, 75% { opacity: 0; }
}
@-webkit-keyframes blink {
  0%, 50%, 100% { opacity: 1; }
  25%, 75% { opacity: 0; }
}
.new-badge {
  -webkit-animation: blink 1s infinite;
  animation: blink 1s infinite;
}

@keyframes scroll-text {
  0% { transform: translateX(0%); }
  100% { transform: translateX(-100%); }
}
@-webkit-keyframes scroll-text {
  0% { -webkit-transform: translateX(0%); }
  100% { -webkit-transform: translateX(-100%); }
}
.construction-banner p {
  -webkit-animation: scroll-text 15s linear infinite;
  animation: scroll-text 15s linear infinite;
}

/* FORCE DESKTOP NAVBAR ON ALL SCREENS */

.menu {
  display: block !important;
  text-align: right !important;
}

.menu li {
  display: inline-block !important;
}

.dropdown-content {
  position: absolute !important;
}