/* 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;
  font-size: 1rem;
  font-weight: normal;
}

#about a {
  color: white;
  text-decoration: none;
}

#about a:hover {
  text-decoration: underline;
}

.indent {
  margin-left: 80px;
}

/* FORCE DESKTOP NAVBAR ON ALL SCREENS */

nav {
  position: sticky;
  top: 0;
  z-index: 2000;
  background-color: #FEED95;
  box-shadow: 0 3px 10px rgba(0,0,0,0.15);
  overflow: visible;
  flex-wrap: nowrap; 
}

/* MENU */
.menu {
  list-style: none;
  margin: 0;
  padding: 6px 20px;
  background-color: #FEED95;

  display: flex;
  justify-content: flex-end;
  flex-wrap: nowrap;
  align-items: center;
  overflow: visible;
}


.menu li {
  position: relative;
  flex: 0 0 auto;
}

/* LINKS */
.menu li a {
  display: block;
  color: #1f2f46;
  text-align: center;
  padding: 8px 10px;
  font-size: 14px;
  font-weight: bold;
  text-decoration: none;
  border-radius: 10px;
  white-space: nowrap;
  transition: background-color 0.25s ease, transform 0.2s ease;
  position: relative;
}

.menu li a:hover {
  background-color: rgba(31,47,70,0.12);
  transform: translateY(-1px);
}

/* underline animation */
.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%;
}

/* COURSES DROPDOWN */
.dropdown.courses-dropdown {
  position: relative;
  text-align: left; 
}

.dropdown.courses-dropdown .dropdown-content {
  display: none;
  position: absolute;
  top: 110%;
  left: 0;                  
  transform: none;
  background-color: #FEED95;
  min-width: 260px;          
  max-width: 90vw;
  z-index: 3000;
  border-radius: 20px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
  padding: 0;            
  margin: 0;
  list-style: none;         
}

/* Dropdown items */
.dropdown.courses-dropdown .dropdown-content li {
  margin: 0;
  padding: 0;              
}

.dropdown.courses-dropdown .dropdown-content li a {
  display: block;
  padding: 8px 16px;        
  font-size: 0.9rem;
  text-align: left;         
  box-sizing: border-box;   
  white-space: nowrap;      
}

/* Show dropdown on hover or open (mobile) */
.dropdown.courses-dropdown:hover .dropdown-content,
.dropdown.courses-dropdown.open .dropdown-content {
  display: block;
}

/* NOTES & IDEAS DROPDOWN */
.dropdown.notes-dropdown {
  position: relative;
  text-align: left; 
}

.dropdown.notes-dropdown .dropdown-content {
  display: none;
  position: absolute;
  top: 110%;
  right: 0;
  left: auto;
  transform: none;

  background-color: #FEED95;
  width: max-content;
  max-width: 90vw;

  z-index: 3000;
  border-radius: 12px;
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
  padding: 4px 0;
  text-align: center;

  list-style: none;      
  margin: 0;
}

/* Dropdown items */
.dropdown.notes-dropdown .dropdown-content li a {
  display: block;
  padding: 6px 12px;
  font-size: 0.85rem;
  white-space: nowrap;
}

/* Show dropdown on hover or open */
.dropdown.notes-dropdown:hover .dropdown-content,
.dropdown.notes-dropdown.open .dropdown-content {
  display: block;
}

/* Arrow styling */
.dropdown.notes-dropdown .arrow {
  margin-left: 5px;
  font-size: 12px;
  transition: transform 0.3s ease;
}

/* Rotate arrow on hover or when open */
.dropdown.notes-dropdown:hover .arrow,
.dropdown.notes-dropdown.open .arrow {
  transform: rotate(90deg);
}


/* Default arrow (pointing right) */
.dropdown.notes-dropdown .arrow {
  margin-left: 5px;
  font-size: 12px;
  transition: transform 0.3s ease;
  display: inline-block; 
  transform: rotate(0deg); 
}

/* Arrow points down when open */
.dropdown.notes-dropdown.open .arrow,
.dropdown.notes-dropdown:hover .arrow {
  transform: rotate(90deg); 
}

/* Default arrow (pointing right) */
.dropdown.courses-dropdown .arrow {
  margin-left: 5px;
  font-size: 12px;
  display: inline-block;   
  transition: transform 0.3s ease;
  transform: rotate(0deg); 
}

/* Rotate arrow when dropdown is open */
.dropdown.courses-dropdown.open .arrow,
.dropdown.courses-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; 
  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;
  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 LAYOUT */

@media (max-width: 1200px) {
  .sidebar { width: 200px; }

  .info-sections {
    flex-direction: column;
    gap: 40px;
    width: 100%;
  }

  #about {
    margin: 4px 0;
    padding-bottom: 20px;
    text-align: start;
  }

  #updated-news h2 { margin-top: 0; }

  #about, #updated-news { width: 100%; }
}

@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,
  #news-list { max-height: 120px; }
}

@media (max-width: 600px) {
  .content { padding: 10px; }

  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: row;
    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,
  .new-badge { font-size: 0.875rem; }

  .new-badge::before { font-size: 18px; }
}

/* TOUCH DEVICES */

@media (hover: none) and (pointer: coarse) {
  .menu li a,
  .sidebar a,
  .tutorial-list a {
    padding: 15px;
    min-height: 44px;
  }

  .dropdown:hover .dropdown-content { display: none; }
}

/* ANIMATIONS */

@keyframes blink {
  0%, 50%, 100% { opacity: 1; }
  25%, 75% { opacity: 0; }
}

.new-badge {
  animation: blink 1s infinite;
}

@keyframes scroll-text {
  from { transform: translateX(0); }
  to   { transform: translateX(-100%); }
}

.construction-banner p {
  animation: scroll-text 15s linear infinite;
}

/* MOBILE NAVBAR */

@media (max-width: 768px) {

  html, body {
    margin: 0;
    padding: 0;
  }

  nav {
    height: 48px;
    padding: 0;
    box-sizing: border-box;
  }

  .menu {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0px;
    height: 100%;
    padding: 0 10px;
    overflow: visible;
  }

  .menu li {
    position: relative;
    margin: 0;
  }

  .menu li a {
    display: inline-flex;
    align-items: center;
    height: 100%;
    padding: 0 8px;
    font-size: 13px;
    font-weight: bold;
    white-space: nowrap;
    border-radius: 10px;
    color: #1f2f46;
    text-decoration: none;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.25s ease;
  }

  .menu li a:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  }

  .menu li a::after {
    content: "";
    position: absolute;
    bottom: 4px;
    left: 50%;
    width: 0;
    height: 2px;
    background: #1f2f46;
    transition: all 0.3s ease;
  }

  .menu li a:hover::after {
    width: 70%;
    left: 15%;
  }

  /* DROPDOWNS (shared) */

  .dropdown .arrow {
    margin-left: 5px;
    font-size: 12px;
    transition: transform 0.3s ease;
  }

  .dropdown.open .arrow,
  .dropdown:hover .arrow {
    transform: rotate(90deg);
  }

  .dropdown .dropdown-content {
    display: none;
    position: absolute;
    max-width: 90vw;
    background: #FEED95;
    border-radius: 12px;
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
    z-index: 3000;
    list-style: none;
    padding: 0;
  }

  .dropdown.open .dropdown-content,
  .dropdown:hover .dropdown-content {
    display: block;
  }

  /* COURSES */

  .dropdown.courses-dropdown > a { padding-right: 20px; }

  .dropdown.courses-dropdown .dropdown-content {
    left: 0;
    min-width: 200px;
  }

  .dropdown.courses-dropdown .dropdown-content li a {
    padding: 8px 12px;
    font-size: 0.9rem;
  }

  /* NOTES */

  .dropdown.notes-dropdown .dropdown-content {
    right: 0;
    left: auto;
    padding: 4px 0;
    text-align: center;
  }

  .dropdown.notes-dropdown .dropdown-content li a {
    padding: 5px 10px;
    font-size: 0.85rem;
  }

  .dropdown .dropdown-content li a:hover {
    background: rgba(31,47,70,0.12);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  }
}
