/* ===== Global Styles & Variables ===== */
:root {
  --primary-gold: #c9a24d;
  --light-gold: #f2d27a;
  --dark-bg: #0b0b0b;
  --light-bg: #f2f2f2;
  --card-dark: #111;
  --card-light: #fff;
  --text-dark: #f2f2f2;
  --text-light: #111;
  --transition: all 0.3s ease;
  --border-radius: 18px;
  --box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  --nav-height: 70px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, sans-serif;
  margin: 0;
  background: var(--dark-bg);
  color: var(--text-dark);
  line-height: 1.8;
  scroll-behavior: smooth;
  transition: var(--transition);
}

/* ===== Improved Navbar ===== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 5%;
  height: var(--nav-height);
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(201, 162, 77, 0.4);
  transition: var(--transition);
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.nav-logo-box {
  background: rgba(201, 162, 77, 0.15);
  padding: 8px 12px;
  border-radius: 12px;
  box-shadow: 0 0 15px rgba(201, 162, 77, 0.3);
}

.nav-logo.uob {
  width: 50px;
  height: auto;
  display: block;
  transition: transform 0.3s;
}

.nav-logo.uob:hover {
  transform: scale(1.05);
}

/* ===== Mobile Menu Button ===== */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 21px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1001;
}

.menu-toggle span {
  display: block;
  height: 3px;
  width: 100%;
  background: var(--primary-gold);
  border-radius: 3px;
  transition: var(--transition);
}

/* ===== Navigation Links ===== */
.nav-links {
  display: flex;
  list-style: none;
  gap: clamp(15px, 2vw, 30px);
  margin: 0;
  padding: 0;
}

.nav-links li {
  position: relative;
}

.nav-links li a {
  color: var(--text-dark);
  text-decoration: none;
  font-size: clamp(0.9rem, 1.5vw, 1rem);
  font-weight: 500;
  letter-spacing: 0.5px;
  padding: 8px 4px;
  display: block;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.nav-links li a::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: -100%;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--primary-gold), var(--light-gold));
  transition: left 0.3s ease;
}

.nav-links li a:hover::before {
  left: 0;
}

.nav-links li a:hover {
  color: var(--light-gold);
  transform: translateY(-2px);
}

/* ===== Theme Toggle ===== */
.nav-theme-toggle {
  margin-left: 20px;
}

.toggle-label {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 30px;
  background: #555;
  border-radius: 34px;
  cursor: pointer;
  transition: var(--transition);
}

.toggle-label .sun,
.toggle-label .moon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  transition: var(--transition);
  z-index: 1;
}

.toggle-label .sun {
  left: 8px;
  color: #ffd700;
}

.toggle-label .moon {
  right: 8px;
  color: #f0f0f0;
}

#theme-switch {
  display: none;
}

.toggle-ball {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  background: var(--light-gold);
  border-radius: 50%;
  transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  z-index: 2;
}

#theme-switch:checked + .toggle-label {
  background: var(--primary-gold);
}

#theme-switch:checked + .toggle-label .toggle-ball {
  transform: translateX(30px);
}

/* ===== Header with Scroll Margin ===== */
.header {
  text-align: center;
  padding: calc(var(--nav-height) + 40px) 20px 80px;
  background: radial-gradient(circle at top, #1a1a1a, #000);
  border-bottom: 3px solid var(--primary-gold);
  position: relative;
  overflow: hidden;
}

.header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  background: linear-gradient(45deg, transparent 30%, rgba(201, 162, 77, 0.1) 100%);
  pointer-events: none;
}

.uob-logo {
  width: clamp(80px, 15vw, 120px);
  height: auto;
  margin: 0 auto;
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.project-logo {
  width: clamp(150px, 30vw, 200px);
  height: auto;
  margin: 30px auto;
  filter: drop-shadow(0 5px 15px rgba(0,0,0,0.5));
}

.uni-info h2 {
  margin: 15px 0 5px;
  font-size: clamp(1.2rem, 3vw, 1.8rem);
}

.uni-info p {
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  opacity: 0.9;
}

.tagline {
  color: var(--primary-gold);
  font-style: italic;
  font-size: clamp(1rem, 2vw, 1.2rem);
  max-width: 600px;
  margin: 20px auto;
  padding: 0 20px;
}

/* ===== Sections with Scroll Margin ===== */
section {
  max-width: min(1100px, 90%);
  margin: 60px auto;
  padding: clamp(25px, 4vw, 40px);
  background: var(--card-dark);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  transition: var(--transition);
  scroll-margin-top: calc(var(--nav-height) + 20px);
}

section:hover {
  transform: translateY(-8px);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85);
}

h2 {
  border-left: 6px solid var(--primary-gold);
  padding-left: 14px;
  margin-bottom: 25px;
  font-size: clamp(1.5rem, 3vw, 2rem);
  position: relative;
}

h2::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 14px;
  width: 50px;
  height: 2px;
  background: var(--primary-gold);
}

h3 {
  color: var(--primary-gold);
  margin-top: 30px;
  font-size: clamp(1.2rem, 2.5vw, 1.5rem);
}

/* ===== Lists ===== */
ul {
  padding-left: 20px;
}

li {
  margin-bottom: 10px;
  position: relative;
}

li::marker {
  color: var(--primary-gold);
}

/* ===== Images ===== */
.image {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
  transition: transform 0.3s;
}

.image:hover {
  transform: scale(1.02);
}

.architecture-image {
  max-width: min(400px, 100%);
  margin: 30px auto;
  border: 2px solid var(--primary-gold);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

/* ===== Screenshots Gallery ===== */
.screenshot-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.screenshot-container .image {
  width: 100%;
  height: 300px;
  object-fit: cover;
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
  transition: all 0.3s ease;
  cursor: pointer;
}

.screenshot-container .image:hover {
  transform: translateY(-10px) scale(1.03);
  box-shadow: 0 15px 35px rgba(201, 162, 77, 0.3);
}

/* ===== Buttons ===== */
.demo-button,
.pdf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  margin: 15px 10px 15px 0;
  background: linear-gradient(135deg, var(--primary-gold), var(--light-gold));
  color: #000;
  font-weight: 600;
  text-decoration: none;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  min-width: 180px;
}

.demo-button::before,
.pdf-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.demo-button:hover::before,
.pdf-btn:hover::before {
  left: 100%;
}

.demo-button:hover,
.pdf-btn:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 35px rgba(201, 162, 77, 0.4);
  background: linear-gradient(135deg, var(--light-gold), var(--primary-gold));
}

.pdf-buttons {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin: 30px 0;
}

/* ===== Videos ===== */
video {
  width: 100%;
  max-width: 800px;
  height: auto;
  display: block;
  margin: 20px auto;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  border: 2px solid transparent;
  transition: border-color 0.3s;
}

video:hover {
  border-color: var(--primary-gold);
}

/* ===== PDF Modal ===== */
.pdf-modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.9);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.pdf-modal-content {
  background-color: var(--card-dark);
  margin: 40px auto;
  padding: 25px;
  border: 2px solid var(--primary-gold);
  width: min(95%, 1000px);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
  position: relative;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { transform: translateY(-50px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.pdf-close {
  position: absolute;
  top: 15px;
  right: 25px;
  color: var(--primary-gold);
  font-size: 32px;
  font-weight: bold;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s;
  z-index: 10001;
}

.pdf-close:hover {
  color: #fff;
  background: var(--primary-gold);
  transform: rotate(90deg);
}

#pdf-frame {
  width: 100%;
  height: 600px;
  border-radius: 8px;
  border: none;
}

/* ===== Team Section ===== */
.team-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
  margin: 40px 0;
}

.team-card,
.supervisor-card {
  background: #1a1a1a;
  padding: 25px;
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  transition: all 0.4s ease;
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
}

.team-card::before,
.supervisor-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-gold), var(--light-gold));
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.team-card:hover::before,
.supervisor-card:hover::before {
  transform: scaleX(1);
}

.team-card:hover,
.supervisor-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 20px 40px rgba(201, 162, 77, 0.2);
  border-color: var(--primary-gold);
}

.team-card img,
.supervisor-card img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 50%;
  margin-bottom: 20px;
  border: 3px solid var(--primary-gold);
  transition: transform 0.3s;
}

.team-card:hover img,
.supervisor-card:hover img {
  transform: scale(1.1);
}

.team-card h4,
.supervisor-card h4 {
  margin: 15px 0 5px;
  color: var(--primary-gold);
  font-size: 1.2rem;
}

.team-card p,
.supervisor-card p {
  margin: 0 0 15px;
  opacity: 0.9;
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 15px;
}

.social-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(201, 162, 77, 0.1);
  color: var(--light-gold);
  border-radius: 50%;
  font-size: 1.2rem;
  transition: all 0.3s ease;
  text-decoration: none;
}

.social-links a:hover {
  background: var(--primary-gold);
  color: #000;
  transform: translateY(-3px);
}

.supervisor-container {
  max-width: 400px;
  margin: 40px auto;
}

.supervisor-card {
  background: #222;
}

/* ===== Light Mode Styles ===== */
body.light-mode {
  background: var(--light-bg);
  color: var(--text-light);
}

body.light-mode .navbar {
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid rgba(201, 162, 77, 0.3);
}

body.light-mode .nav-links li a {
  color: var(--text-light);
}

body.light-mode .nav-links li a:hover {
  color: var(--primary-gold);
}

body.light-mode .header {
  background: linear-gradient(135deg, #f5f5f5, #e0e0e0);
  border-bottom: 3px solid var(--primary-gold);
}

body.light-mode section {
  background: var(--card-light);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
}

body.light-mode .tagline {
  color: var(--primary-gold);
}

body.light-mode .team-card,
body.light-mode .supervisor-card {
  background: #f8f8f8;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

body.light-mode .pdf-modal-content {
  background: var(--card-light);
}

body.light-mode .social-links a {
  background: rgba(201, 162, 77, 0.15);
  color: var(--primary-gold);
}

body.light-mode .social-links a:hover {
  background: var(--primary-gold);
  color: #fff;
}

/* ===== Footer ===== */
footer {
  text-align: center;
  padding: 40px 20px;
  color: #aaa;
  border-top: 2px solid var(--primary-gold);
  background: rgba(0, 0, 0, 0.8);
  margin-top: 60px;
}

body.light-mode footer {
  background: #f5f5f5;
  color: #666;
}

/* ===== Responsive Design ===== */

/* Tablet */
@media screen and (max-width: 1024px) {
  .navbar {
    padding: 0 20px;
  }
  
  .nav-links {
    gap: 15px;
  }
  
  .screenshot-container {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  }
}

/* Mobile Large */
@media screen and (max-width: 768px) {
  .menu-toggle {
    display: flex;
  }
  
  .nav-links {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    flex-direction: column;
    align-items: center;
    padding: 30px 0;
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
    height: calc(100vh - var(--nav-height));
    overflow-y: auto;
    gap: 0;
  }
  
  body.light-mode .nav-links {
    background: rgba(255, 255, 255, 0.98);
  }
  
  .nav-links.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }
  
  .nav-links li {
    width: 100%;
    text-align: center;
  }
  
  .nav-links li a {
    padding: 20px;
    font-size: 1.1rem;
    border-bottom: 1px solid rgba(201, 162, 77, 0.1);
  }
  
  .nav-links li:last-child a {
    border-bottom: none;
  }
  
  .menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
  }
  
  .menu-toggle.active span:nth-child(2) {
    opacity: 0;
  }
  
  .menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
  }
  
  .header {
    padding: calc(var(--nav-height) + 20px) 15px 50px;
  }
  
  .team-container {
    grid-template-columns: 1fr;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
  }
  
  .pdf-buttons {
    flex-direction: column;
    align-items: center;
  }
  
  .demo-button,
  .pdf-btn {
    width: 100%;
    max-width: 300px;
  }
  
  #pdf-frame {
    height: 400px;
  }
}

/* Mobile Small */
@media screen and (max-width: 480px) {
  .navbar {
    padding: 0 15px;
  }
  
  .nav-logo-box {
    padding: 6px 8px;
  }
  
  .nav-logo.uob {
    width: 40px;
  }
  
  .toggle-label {
    width: 50px;
    height: 26px;
  }
  
  .toggle-ball {
    width: 20px;
    height: 20px;
  }
  
  #theme-switch:checked + .toggle-label .toggle-ball {
    transform: translateX(24px);
  }
  
  .header h1 {
    font-size: clamp(1.8rem, 5vw, 2.2rem);
  }
  
  section {
    margin: 30px auto;
    padding: 20px;
    border-radius: 12px;
  }
  
  .screenshot-container .image {
    height: 250px;
  }
  
  .team-card,
  .supervisor-card {
    padding: 20px;
  }
  
  footer {
    padding: 30px 15px;
    font-size: 0.9rem;
  }
}

/* Dark mode scrollbar */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
  background: var(--primary-gold);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--light-gold);
}

/* Light mode scrollbar */
body.light-mode ::-webkit-scrollbar-track {
  background: #f0f0f0;
}

body.light-mode ::-webkit-scrollbar-thumb {
  background: var(--primary-gold);
}

body.light-mode ::-webkit-scrollbar-thumb:hover {
  background: var(--light-gold);
}

/* Print styles */
@media print {
  .navbar,
  .menu-toggle,
  .nav-theme-toggle,
  .demo-button,
  .pdf-buttons,
  video,
  footer {
    display: none !important;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
  
  section {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
    break-inside: avoid;
  }
}