/* BUUELTS - English Language Teaching Society Website
   Base stylesheet with soft academic tones and responsive design */

/* CSS Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Color Palette - Soft academic tones */
  --primary: #4b6584;      /* Deep blue */
  --secondary: #778ca3;    /* Muted blue-gray */
  --accent: #f7b731;       /* Warm yellow accent */
  --light: #f5f6fa;        /* Off-white background */
  --text: #2f3542;         /* Dark gray text */
  --text-light: #57606f;   /* Light gray text */
  --success: #20bf6b;      /* Green */
  --card-bg: #ffffff;      /* Card background */
  --shadow: rgba(0, 0, 0, 0.1);  /* Subtle shadow */
  
  /* Typography */
  --heading-font: 'Georgia', serif;
  --body-font: 'Open Sans', 'Segoe UI', sans-serif;
}

body {
  font-family: var(--body-font);
  background-color: var(--light);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--heading-font);
  color: var(--primary);
  margin-bottom: 1rem;
  line-height: 1.3;
}

h1 {
  font-size: 2.5rem;
}

h2 {
  font-size: 2rem;
  color: var(--secondary);
}

h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

p {
  margin-bottom: 1rem;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: all 0.3s ease;
}

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

/* Layout Structure */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header */
header {
  background-color: var(--card-bg);
  box-shadow: 0 2px 5px var(--shadow);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
}

.logo img {
  height: 60px;
  margin-right: 1rem;
}

.logo h1 {
  font-size: 1.5rem;
  margin-bottom: 0;
  max-width: 300px; /* Limit width to allow text to wrap */
  line-height: 1.3; /* Ensure proper spacing between lines */
}

@media (max-width: 600px) {
  .logo h1 {
    font-size: 1.2rem;
    /* Force two lines for mobile view */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Navigation */
nav ul {
  display: flex;
  list-style: none;
}

nav li {
  margin-left: 2rem;
}

nav a {
  font-weight: 600;
  padding: 0.5rem;
  border-bottom: 2px solid transparent;
}

nav a:hover {
  text-decoration: none;
  border-bottom: 2px solid var(--accent);
}

nav a.active {
  border-bottom: 2px solid var(--accent);
}

/* Mobile Navigation Toggle */
.nav-toggle {
  display: none;
  font-size: 1.5rem;
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
}

/* Members Table Styles */
.members-section {
  text-align: center;
  margin-bottom: 3rem;
}

/* Medal Showcase Container Override */
.medal-showcase-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  overflow-x: hidden;
}

.medal-showcase-container .membership-info {
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.member-list-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.members-table-container {
  overflow: visible;
  margin: 2rem 0;
  box-shadow: 0 3px 10px var(--shadow);
  border-radius: 5px;
  width: 100%;
}

.members-table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--card-bg);
  table-layout: fixed;
  margin: 0 auto;
}

.members-table th,
.members-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  vertical-align: middle;
}

.members-table th {
  background-color: var(--primary);
  color: white;
  font-weight: 600;
}

.members-table tr:hover {
  background-color: rgba(0, 0, 0, 0.03);
}

.members-table tr:last-child td {
  border-bottom: none;
}

.country-flag {
  width: 35px;
  height: 23px;
  border-radius: 4px;
  object-fit: cover;
  transition: transform 0.3s ease;
  vertical-align: middle;
}

.country-flag:hover {
  transform: scale(1.1);
}

/* Members Grid Table Styles - Replacement for traditional table */
.members-grid-container {
  width: 100%;
  max-width: 1200px;
  margin: 2rem auto;
  background-color: var(--card-bg);
  border-radius: 5px;
  box-shadow: 0 3px 10px var(--shadow);
  overflow: visible; /* Changed from hidden to allow tooltips to display properly */
  position: relative; /* Ensure proper positioning context */
}

.members-grid-header {
  display: grid;
  grid-template-columns: 60px 1fr 1fr 1.5fr;
  background-color: var(--primary);
  color: white;
  font-weight: 600;
}

.members-grid-row {
  display: grid;
  grid-template-columns: 60px 1fr 1fr 1.5fr;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  transition: background-color 0.2s ease;
}

.members-grid-row:hover {
  background-color: rgba(0, 0, 0, 0.03);
}

.members-grid-row:last-child {
  border-bottom: none;
}

.members-grid-cell {
  padding: 1rem;
  display: flex;
  align-items: center;
}

.header-flag, .header-name, .header-id, .header-medals {
  padding: 1rem;
  font-weight: 600;
}

.flag-cell {
  display: flex;
  justify-content: center;
  align-items: center;
}

.name-cell, .id-cell {
  display: flex;
  align-items: center;
}

.medals-container {
  padding: 0.75rem 1rem;
}

.medals-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.medal-icon {
  width: 24px;
  height: 30px;
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.medal-icon:hover {
  transform: scale(1.25);
}

/* Tooltip styles */
.tooltip-trigger {
  position: relative;
  display: inline-block;
  margin-left: 5px;
  font-size: 0.8rem;
  width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  background-color: var(--accent);
  color: white;
  border-radius: 50%;
  cursor: help;
}

.tooltip {
  visibility: hidden;
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background-color: #354963; /* Darker shade of primary color */
  color: white;
  text-align: center;
  padding: 0.5rem 0.75rem;
  border-radius: 5px;
  font-size: 0.75rem;
  width: max-content;
  max-width: 200px;
  box-shadow: 0 3px 10px var(--shadow);
  opacity: 0;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 1000; /* Increased z-index to ensure visibility */
  pointer-events: none; /* Prevents tooltip from interfering with clicks */
}

.tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #354963 transparent transparent transparent; /* Match with tooltip background */
}

.tooltip-trigger:hover .tooltip {
  visibility: visible;
  opacity: 1;
}

/* Alphabetical dividers */
.alphabet-divider {
  background-color: var(--secondary);
  color: white;
  text-align: left;
  padding: 0.3rem 1rem; /* Reduced vertical padding */
  font-weight: 600;
  font-size: 1rem; /* Slightly smaller font */
  line-height: 1.2; /* Tighter line height */
}

.flag-cell {
  width: 55px;
  text-align: center;
  vertical-align: middle;
}

.membership-info {
  max-width: 800px;
  margin: 2rem auto;
  text-align: left;
  background-color: var(--card-bg);
  padding: 2rem;
  border-radius: 5px;
  box-shadow: 0 3px 10px var(--shadow);
}

.membership-info h3 {
  color: var(--primary);
  margin-bottom: 1rem;
}

.membership-info h4 {
  color: var(--secondary);
  margin: 1.5rem 0 0.5rem;
}

/* Main Content */
main {
  padding: 2rem 0;
  min-height: calc(100vh - 200px);
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 3rem 1rem;
  background-color: var(--primary);
  color: white;
  margin-bottom: 2rem;
  border-radius: 5px;
}

.hero h2 {
  color: white;
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.hero p {
  font-size: 1.2rem;
  max-width: 800px;
  margin: 0 auto 1.5rem;
}

/* Announcements Section */
.announcements {
  text-align: center;
  margin-bottom: 3rem;
}

.announcements-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.announcement-card {
  background-color: var(--card-bg);
  border-radius: 5px;
  box-shadow: 0 3px 10px var(--shadow);
  padding: 1.5rem;
  transition: transform 0.3s ease;
  text-align: left;
}

.announcement-card:hover {
  transform: translateY(-5px);
}

.announcement-card img {
  width: 100%;
  height: auto;
  max-height: 200px;
  object-fit: contain;
  border-radius: 5px;
  margin-bottom: 1rem;
}

.announcement-card h3 {
  color: var(--primary);
}

.announcement-card .date {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

/* About Us Page */
.about-section {
  text-align: center;
  margin-bottom: 3rem;
}

.about-content {
  max-width: 800px;
  margin: 0 auto 2rem;
  text-align: left;
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  margin: 2rem auto 0;
  max-width: 1200px;
}

.team-member {
  background-color: var(--card-bg);
  border-radius: 5px;
  box-shadow: 0 3px 10px var(--shadow);
  padding: 1.5rem;
  text-align: center;
  transition: transform 0.3s ease;
}

.team-member:hover {
  transform: translateY(-5px);
}

.team-member img {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 50%;
  margin-bottom: 1rem;
}

.team-member h3 {
  margin-bottom: 0.5rem;
}

.team-member .role {
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 1rem;
}

/* Language Selector */
.lang-selector {
  position: relative;
  display: flex;
  align-items: center;
  margin-left: 1rem;
  z-index: 101;
}

.lang-selected {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.lang-selected:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.lang-flag {
  width: 24px;
  height: 16px;
  border-radius: 2px;
  object-fit: cover;
}

.lang-name {
  font-size: 0.9rem;
  font-weight: 600;
}

.lang-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background-color: var(--card-bg);
  border-radius: 5px;
  box-shadow: 0 3px 10px var(--shadow);
  min-width: 150px;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
}

.lang-selector.active .lang-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.lang-option:hover {
  background-color: rgba(0, 0, 0, 0.05);
  text-decoration: none;
}

.lang-option .lang-flag {
  width: 24px;
  height: 16px;
}

/* Side Elements */
.side-element {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background-color: var(--card-bg);
  padding: 1rem;
  border-radius: 5px;
  box-shadow: 0 3px 10px var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 90;
}

.side-element.left {
  left: 1rem;
}

.side-element.right {
  right: 1rem;
}

.side-element i {
  font-size: 1.5rem;
  color: var(--primary);
  cursor: pointer;
  transition: color 0.3s ease;
}

.side-element i:hover {
  color: var(--accent);
}

/* Footer */
footer {
  background-color: var(--primary);
  color: white;
  padding: 2rem 0;
  text-align: center;
}

.footer-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  text-align: left;
}

.footer-column h3 {
  color: white;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.footer-column ul {
  list-style: none;
}

.footer-column li {
  margin-bottom: 0.5rem;
}

.footer-column a {
  color: white;
}

.footer-column a:hover {
  color: var(--accent);
}

.social-links {
  display: flex;
  gap: 1rem;
}

.social-links a {
  color: white;
  font-size: 1.5rem;
  transition: color 0.3s ease;
}

.social-links a:hover {
  color: var(--accent);
}

.copyright {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

/* Responsive Design */
/* Large screens - slightly reduce logo text size only */
@media (min-width: 1049px) {
  .logo h1 {
    font-size: 1.3rem;
  }
}

/* Medium screens - reduce text size in header */
@media (min-width: 768px) and (max-width: 1048px) {
  .logo h1 {
    font-size: 1.3rem;
  }
  
  nav a {
    font-size: 0.9rem;
    text-align: center;
    line-height: 1.3;
    padding: 0.5rem 0.8rem;
    display: inline-block;
    border-bottom: none;
    border-radius: 4px;
  }
  
  nav a:hover, 
  nav a.active {
    text-decoration: none;
    border-bottom: none;
    background-color: rgba(75, 101, 132, 0.1);
  }
  
  nav a.active {
    position: relative;
  }
  
  nav a.active::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 2px;
    background-color: var(--accent);
  }
}

/* Specific fix for 768px breakpoint to match text size with 767px */
@media (width: 768px) {
  .logo h1 {
    font-size: 1.5rem;
  }
}

@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    text-align: center;
  }
  
  .logo {
    margin-bottom: 1rem;
    justify-content: center;
  }
  
  nav ul {
    flex-direction: column;
    gap: 1rem;
    align-items: center;
  }
  
  nav li {
    margin-left: 0;
  }
  
  .side-element {
    display: none;
  }
  
  .nav-toggle {
    display: block;
    position: absolute;
    top: 1rem;
    right: 1rem;
  }
  
  .nav-menu {
    display: none;
    width: 100%;
    text-align: center;
  }
  
  .nav-menu.active {
    display: flex;
    flex-direction: column;
  }
  
  .lang-selector {
    margin: 1rem auto 0;
  }
}

/* Mobile adjustments for members grid */
@media (max-width: 768px) {
  .members-grid-header, .members-grid-row {
    grid-template-columns: 50px 1fr 0.8fr 1.2fr;
  }
  
  .members-grid-cell {
    padding: 0.75rem;
  }
  
  .medals-wrapper {
    gap: 6px;
  }
}

/* Mobile-specific styles for max-width: 600px */
@media (max-width: 600px) {
  .header-container {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    position: relative;
    padding: 0.5rem 1rem;
  }
  
  .logo {
    margin-bottom: 0;
    justify-content: flex-start;
    max-width: 70%;
  }
  
  .logo img {
    height: 40px;
  }
  
  .logo h1 {
    font-size: 1rem;
    line-height: 1.2;
  }
  
  /* Container for language selector and hamburger menu */
  .header-container > div:last-of-type,
  .header-container > button:last-of-type {
    display: flex;
    align-items: center;
  }
  
  .lang-selector {
    position: relative;
    margin: 0 0.5rem 0 0;
    top: auto;
    right: auto;
  }
  
  .lang-name {
    display: none;
  }
  
  .nav-toggle {
    position: static;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    font-size: 1.3rem;
    margin-left: 0;
  }
  
  .nav-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--card-bg);
    box-shadow: 0 2px 5px var(--shadow);
    z-index: 99;
  }
  
  .members-grid-container {
    margin: 1rem 0;
  }
  
  .members-grid-header, .members-grid-row {
    grid-template-columns: 40px 1fr 0.7fr 1fr;
  }
  
  .members-grid-cell, .header-flag, .header-name, .header-id, .header-medals {
    padding: 0.75rem 0.5rem;
    font-size: 0.9rem;
  }
  
  .medals-container {
    padding: 0.5rem;
  }
  
  .medals-wrapper {
    gap: 5px;
  }
  
  .medal-icon {
    width: 20px;
    height: 25px;
  }
  
  .nav-menu.active {
    padding: 1rem 0;
  }
  
  nav ul {
    width: 100%;
  }
  
  nav li {
    width: 100%;
    text-align: center;
    padding: 0.5rem 0;
  }
  
  nav a {
    display: block;
    width: 100%;
    padding: 0.5rem 0;
    border-bottom: none;
  }
  
  nav a.active, nav a:hover {
    background-color: rgba(0, 0, 0, 0.05);
    border-bottom: none;
  }
}

/* Added medium screen styles for team grid */
@media (min-width: 577px) and (max-width: 992px) {
  .team-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
  }
  
  .team-member {
    padding: 1.25rem;
  }
  
  .team-member img {
    width: 120px;
    height: 120px;
  }
}

@media (max-width: 576px) {
  h1 {
    font-size: 2rem;
  }
  
  h2 {
    font-size: 1.75rem;
  }
  
  .hero h2 {
    font-size: 2rem;
  }
  
  .team-grid,
  .announcements-list {
    grid-template-columns: 1fr;
  }

  .members-table th,
  .members-table td {
    padding: 0.75rem 0.5rem;
  }
  
  .medal-icon {
    width: 20px;
    height: 25px;
  }
}

/* Popup Styles */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(47, 53, 66, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-in-out;
}

.popup-container {
    position: relative;
    background-color: #ffffff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    max-width: 90%;
    max-height: 90%;
    /* Remove overflow hidden to prevent button clipping */
    overflow: visible;
    transform: scale(0.9);
    animation: scaleIn 0.3s ease-in-out forwards;
}

.popup-button-container {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    width: 100%;
}

.popup-button-close {
    background-color: var(--primary, #4b6584);
    color: white;
    border: none;
    border-radius: 5px;
    padding: 10px 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    font-family: var(--body-font, 'Open Sans', sans-serif);
}

.popup-button-close:hover {
    background-color: var(--accent, #f7b731);
    transform: scale(1.05);
}

.popup-image-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
}

.popup-image {
    display: block;
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    transition: transform 0.2s ease-in-out;
    cursor: pointer;
	border-radius: 10px;
}

.popup-image:hover {
    transform: scale(1.02);
	border-radius: 10px;
}

.fade-out {
    animation: fadeOut 0.3s ease-in-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes scaleIn {
    from { transform: scale(0.9); }
    to { transform: scale(1); }
}