:root {
  /* Light mode colour palette */
  --bg: #f7f9fc;
  --fg: #2a2a2a;
  --card-bg: #ffffff;
  --primary: #667eea;
  --primary-hover: #5568d3;
  --table-header-bg: #667eea;
  --table-row-alt: #f8f9ff;
  --btn-radius: 8px;
}

body.dark-mode {
  --bg: #1e1e2f;
  --fg: #e0e0e0;
  --card-bg: #2c2c3e;
  --primary: #667eea;
  --primary-hover: #764ba2;
  --table-header-bg: #667eea;
  --table-row-alt: #252538;
}

body {
  background-image: url('./omnitrackr_vortex.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-color: var(--bg);
  color: var(--fg);
  font-family: Arial, sans-serif;
  line-height: 1.6;
  margin: 0;
  padding: 20px;
  padding-bottom: 80px; /* Add padding at bottom to account for fixed footer */
  transition: background-color 0.3s, color 0.3s;
  min-height: 100vh;
}

/* Mobile: Remove fixed background attachment for better performance */
@media (max-width: 768px) {
  body {
    background-attachment: scroll;
    padding: 10px;
    padding-bottom: 70px;
  }
}

.container {
  max-width: 1400px;
  padding: 0 20px;
  box-sizing: border-box;
  /* Default: account for sidebar */
  margin-left: 250px;
  margin-right: auto;
  transition: margin-left 0.3s ease, max-width 0.3s ease;
}

/* When sidebar is hidden */
.container.sidebar-hidden {
  margin-left: 0;
  max-width: 1600px;
}

/* When viewport is wide enough (sidebar + container + some space), center the container */
@media (min-width: 1650px) {
  .container {
    /* Center 1400px container: sidebar (250px) + half of remaining space */
    margin-left: calc(250px + (100% - 250px - 1400px) / 2);
    max-width: 1400px;
  }
  
  .container.sidebar-hidden {
    margin-left: calc((100% - 1600px) / 2);
    max-width: 1600px;
  }
}

.header {
  height: 200px;
  margin-bottom: 20px;
  border-radius: 8px;
  background-image: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)), url('./film_background.jpg');
  background-size: cover;
  background-position: center;
  display: flex;
  justify-content: center;
  align-items: center;
}

.header h1 {
  font-size: 3.5rem;
  font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-weight: 800;
  margin: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
  position: relative;
  animation: gradient-shift 4s ease infinite;
  background-size: 200% 200%;
  filter: drop-shadow(0 4px 8px rgba(102, 126, 234, 0.4)) drop-shadow(0 0 20px rgba(118, 75, 162, 0.3));
  text-transform: uppercase;
}

/* Mobile: Reduce header size and simplify animations */
@media (max-width: 768px) {
  .header {
    height: 120px;
    margin-bottom: 15px;
  }
  
  .header h1 {
    font-size: 2rem;
    animation: none; /* Disable animation on mobile for performance */
    filter: drop-shadow(0 2px 4px rgba(102, 126, 234, 0.4));
  }
}

@keyframes gradient-shift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Fallback for browsers that don't support background-clip */
@supports not (-webkit-background-clip: text) {
  .header h1 {
    color: #667eea;
    text-shadow: 0 2px 8px rgba(102, 126, 234, 0.6), 0 0 25px rgba(118, 75, 162, 0.4);
  }
}

.tabs {
  display: flex;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--primary);
}

.tab {
  padding: 12px 24px;
  background-color: var(--card-bg);
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  color: var(--fg);
  transition: all 0.3s ease;
  min-height: 44px; /* Touch-friendly minimum tap target */
}

/* Mobile: Smaller tabs with better touch targets */
@media (max-width: 768px) {
  .tabs {
    margin-bottom: 15px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .tab {
    padding: 10px 16px;
    font-size: 14px;
    min-height: 48px; /* Larger touch target on mobile */
    white-space: nowrap;
  }
}

.tab.active {
  background-color: var(--primary);
  color: white;
  border-bottom-color: var(--primary);
}

.tab:hover:not(.active) {
  background-color: var(--table-row-alt);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.toggle-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 6px 12px;
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: var(--btn-radius);
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  z-index: 10001; /* Above auth modal */
}

.toggle-btn:hover {
  background-color: var(--primary-hover);
}

.card {
  background-color: var(--card-bg);
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  margin-bottom: 24px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* Mobile: Disable hover effects and reduce padding for better performance */
@media (max-width: 768px) {
  .card {
    padding: 16px;
    margin-bottom: 16px;
    transition: none; /* Disable transitions on mobile for better performance */
  }
  
  .card:hover {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transform: none; /* Disable transform on mobile */
  }
  
  button.action-btn:hover {
    transform: none; /* Disable hover transform on mobile */
  }
}

.card h2 {
  margin-top: 0;
  margin-bottom: 20px;
  color: var(--fg);
  font-weight: 700;
  font-size: 1.5rem;
}

.collapsible-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  padding: 8px 0;
  transition: opacity 0.2s ease;
  margin-bottom: 0;
}

.collapsible-header:hover {
  opacity: 0.8;
}

.collapsible-header h2 {
  margin: 0;
  margin-bottom: 0;
}

.collapsible-icon {
  font-size: 0.9rem;
  color: var(--primary);
  transition: transform 0.3s ease;
  display: inline-block;
  margin-left: 12px;
}

.collapsible-icon.rotated {
  transform: rotate(180deg);
}

.collapsible-content {
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
  max-height: 0;
  opacity: 0;
  padding-top: 0;
}

.collapsible-content.expanded {
  max-height: 1000px;
  opacity: 1;
  padding-top: 20px;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
select,
textarea {
  padding: 12px 16px;
  margin: 8px 0;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  width: calc(100% - 36px);
  background-color: var(--bg);
  color: var(--fg);
  font-size: 1rem;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Mobile: Larger touch targets and prevent zoom on iOS */
@media (max-width: 768px) {
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="password"],
  select,
  textarea {
    padding: 14px 16px;
    font-size: 16px; /* Prevents zoom on iOS when focusing */
    min-height: 48px; /* Larger touch target on mobile */
    -webkit-appearance: none; /* Remove iOS default styling */
    appearance: none;
  }
  
  /* Custom select arrow for mobile */
  select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667eea' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 45px;
  }
}

body.dark-mode input,
body.dark-mode select {
  border-color: rgba(255, 255, 255, 0.3);
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--fg);
}

body.dark-mode input:focus,
body.dark-mode select:focus {
  border-color: var(--primary);
  background-color: rgba(255, 255, 255, 0.15);
  color: var(--fg);
}

/* Ensure dropdown options are visible in dark mode */
body.dark-mode select option {
  background-color: #1a1a2e;
  color: var(--fg);
  padding: 8px;
}

label {
  display: inline-block;
  margin-right: 10px;
}

button.action-btn {
  min-height: 36px; /* Touch-friendly minimum */
  min-width: 44px; /* Touch-friendly minimum */
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  cursor: pointer;
  margin-right: 8px;
  margin-top: 8px;
  min-width: 100px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

button.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary) 100%);
}

button.action-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

/* Modern Table Container */
.table-container {
  overflow-x: auto;
  border-radius: 12px;
  background-color: var(--card-bg);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
  background-color: transparent;
}

th,
td {
  padding: 16px 12px;
  vertical-align: middle;
  text-align: left;
  border: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  transition: background-color 0.2s ease;
}

body.dark-mode th,
body.dark-mode td {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.watched-icon {
  display: inline-block;
  font-size: 1.5rem;
  font-weight: bold;
  width: 28px;
  height: 28px;
  line-height: 28px;
  text-align: center;
  border-radius: 50%;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  margin: 0 auto;
}

/* Center the watched column */
/* Center watched column for movies */
#movieTable th:nth-child(6),
#movieTable td:nth-child(6) {
  text-align: center;
}

/* Center all columns for TV shows except title (column 2) */
#tvShowTable th:nth-child(1),
#tvShowTable td:nth-child(1),
#tvShowTable th:nth-child(3),
#tvShowTable td:nth-child(3),
#tvShowTable th:nth-child(4),
#tvShowTable td:nth-child(4),
#tvShowTable th:nth-child(5),
#tvShowTable td:nth-child(5),
#tvShowTable th:nth-child(6),
#tvShowTable td:nth-child(6),
#tvShowTable th:nth-child(7),
#tvShowTable td:nth-child(7),
#tvShowTable th:nth-child(8),
#tvShowTable td:nth-child(8),
#tvShowTable th:nth-child(9),
#tvShowTable td:nth-child(9),
#tvShowTable th:nth-child(10),
#tvShowTable td:nth-child(10) {
  text-align: center;
}

/* Center all columns for anime except title (column 2) */
#animeTable th:nth-child(1),
#animeTable td:nth-child(1),
#animeTable th:nth-child(3),
#animeTable td:nth-child(3),
#animeTable th:nth-child(4),
#animeTable td:nth-child(4),
#animeTable th:nth-child(5),
#animeTable td:nth-child(5),
#animeTable th:nth-child(6),
#animeTable td:nth-child(6),
#animeTable th:nth-child(7),
#animeTable td:nth-child(7),
#animeTable th:nth-child(8),
#animeTable td:nth-child(8),
#animeTable th:nth-child(9),
#animeTable td:nth-child(9),
#animeTable th:nth-child(10),
#animeTable td:nth-child(10) {
  text-align: center;
}

/* Make review column wider and wrap nicely for all tables */
#movieTable th:nth-child(7),
#movieTable td:nth-child(7),
#tvShowTable th:nth-child(8),
#tvShowTable td:nth-child(8),
#animeTable th:nth-child(8),
#animeTable td:nth-child(8) {
  width: 28%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.watched-icon.watched {
  color: #4caf50;
  background-color: rgba(76, 175, 80, 0.1);
}

.watched-icon.unwatched {
  color: #f44336;
  background-color: rgba(244, 67, 54, 0.1);
}

.watched-icon:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

body.dark-mode .watched-icon.watched {
  background-color: rgba(76, 175, 80, 0.2);
}

body.dark-mode .watched-icon.unwatched {
  background-color: rgba(244, 67, 54, 0.2);
}

/* Make review column wider and wrap nicely */
#movieTable th:nth-child(7),
#movieTable td:nth-child(7) {
  width: 28%;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Set practical widths for other columns */
#movieTable th:nth-child(1),
#movieTable td:nth-child(1) {
  width: 80px;
}

#movieTable th:nth-child(2),
#movieTable td:nth-child(2) {
  width: 18%;
}

#movieTable th:nth-child(3),
#movieTable td:nth-child(3) {
  width: 14%;
}

#movieTable th:nth-child(4),
#movieTable td:nth-child(4) {
  width: 8%;
}

#movieTable th:nth-child(5),
#movieTable td:nth-child(5) {
  width: 8%;
}

#movieTable th:nth-child(6),
#movieTable td:nth-child(6) {
  width: 8%;
}

#movieTable th:nth-child(8),
#movieTable td:nth-child(8) {
  width: 8%;
}

#movieTable th:nth-child(9),
#movieTable td:nth-child(9) {
  width: 8%;
}

th {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  text-align: center;
}

th:first-child {
  border-top-left-radius: 12px;
}

th:last-child {
  border-top-right-radius: 12px;
}

tbody tr {
  transition: all 0.2s ease;
  background-color: var(--card-bg);
}

tbody tr:nth-child(even) {
  background-color: var(--table-row-alt);
}

tbody tr:hover {
  background-color: rgba(102, 126, 234, 0.05);
  transform: scale(1.01);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body.dark-mode tbody tr:hover {
  background-color: rgba(102, 126, 234, 0.1);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* Review textarea - auto-expanding */
.review-textarea {
  width: 100%;
  min-width: 200px;
  min-height: 60px;
  max-width: 100%;
  padding: 8px 12px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.5;
  border: 2px solid rgba(102, 126, 234, 0.3);
  border-radius: 8px;
  background-color: var(--bg);
  color: var(--fg);
  resize: vertical;
  overflow-y: auto;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.review-textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

body.dark-mode .review-textarea {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: rgba(102, 126, 234, 0.4);
}

body.dark-mode .review-textarea:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

table input[type="text"],
table input[type="number"] {
  margin: 0;
  padding: 8px 12px;
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  background-color: var(--bg);
  transition: all 0.2s ease;
}

table input[type="text"]:focus,
table input[type="number"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

body.dark-mode table input[type="text"],
body.dark-mode table input[type="number"] {
  border-color: rgba(255, 255, 255, 0.2);
  background-color: rgba(255, 255, 255, 0.05);
}

table input[type="checkbox"] {
  margin: 0 auto;
  display: block;
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--primary);
}

/* Modern link styling in tables */
table a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
  padding: 4px 8px;
  border-radius: 4px;
}

table a:hover {
  background-color: rgba(102, 126, 234, 0.1);
  text-decoration: underline;
}

body.dark-mode table a:hover {
  background-color: rgba(102, 126, 234, 0.2);
}

/* Poster image styling */
table img {
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

table img:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

button.action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Enhanced search and filter section */
.card > div:first-of-type {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid rgba(0, 0, 0, 0.05);
}

body.dark-mode .card > div:first-of-type {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.card > div:first-of-type h2 {
  margin: 0;
  color: var(--fg);
  font-weight: 700;
  font-size: 1.75rem;
}

.card > div:first-of-type span {
  font-weight: 600;
  color: var(--primary);
  font-size: 1.1rem;
  padding: 6px 12px;
  background-color: rgba(102, 126, 234, 0.1);
  border-radius: 8px;
}

body.dark-mode .card > div:first-of-type span {
  background-color: rgba(102, 126, 234, 0.2);
}

/* Search and filter controls */
.card > div:nth-of-type(2) {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px;
  background-color: rgba(0, 0, 0, 0.02);
  border-radius: 8px;
}

body.dark-mode .card > div:nth-of-type(2) {
  background-color: rgba(255, 255, 255, 0.03);
}

@media (max-width: 600px) {

  table,
  thead,
  tbody,
  th,
  td,
  tr {
    display: block;
  }

  thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  tr {
    margin-bottom: 10px;
  }

  td {
    border: none;
    position: relative;
    padding-left: 50%;
  }

  td:before {
    position: absolute;
    top: 12px;
    left: 6px;
    width: 45%;
    white-space: nowrap;
  }

  td:nth-of-type(1):before {
    content: "Poster";
  }

  td:nth-of-type(2):before {
    content: "Title";
  }

  td:nth-of-type(3):before {
    content: "Director";
  }

  td:nth-of-type(4):before {
    content: "Year";
  }

  td:nth-of-type(5):before {
    content: "Rating";
  }

  td:nth-of-type(6):before {
    content: "Watched";
  }

  td:nth-of-type(7):before {
    content: "Review";
  }

  td:nth-of-type(8):before {
    content: "IMDb";
  }

  td:nth-of-type(9):before {
    content: "Actions";
  }
  
  /* TV Shows and Anime table mobile styles (10 columns) */
  #tvShowTable td:nth-of-type(1):before,
  #animeTable td:nth-of-type(1):before {
    content: "Poster";
  }
  
  #tvShowTable td:nth-of-type(2):before,
  #animeTable td:nth-of-type(2):before {
    content: "Title";
  }
  
  #tvShowTable td:nth-of-type(3):before,
  #animeTable td:nth-of-type(3):before {
    content: "Year";
  }
  
  #tvShowTable td:nth-of-type(4):before,
  #animeTable td:nth-of-type(4):before {
    content: "Seasons";
  }
  
  #tvShowTable td:nth-of-type(5):before,
  #animeTable td:nth-of-type(5):before {
    content: "Episodes";
  }
  
  #tvShowTable td:nth-of-type(6):before,
  #animeTable td:nth-of-type(6):before {
    content: "Rating";
  }
  
  #tvShowTable td:nth-of-type(7):before,
  #animeTable td:nth-of-type(7):before {
    content: "Watched";
  }
  
  #tvShowTable td:nth-of-type(8):before,
  #animeTable td:nth-of-type(8):before {
    content: "Review";
  }
  
  #tvShowTable td:nth-of-type(9):before,
  #animeTable td:nth-of-type(9):before {
    content: "IMDb";
  }
  
  #tvShowTable td:nth-of-type(10):before,
  #animeTable td:nth-of-type(10):before {
    content: "Actions";
  }
}

/* Statistics Dashboard Styles */
.stats-section {
  margin-bottom: 40px;
  padding: 32px;
  background: linear-gradient(135deg, var(--card-bg) 0%, rgba(102, 126, 234, 0.03) 100%);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(102, 126, 234, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stats-section:hover {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

/* Mobile: Optimize statistics for smaller screens */
@media (max-width: 768px) {
  .stats-section {
    margin-bottom: 24px;
    padding: 20px;
  }
  
  .stats-section:hover {
    transform: none; /* Disable hover transform on mobile */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  }
  
  .stats-section h3 {
    font-size: 1.4rem;
  }
  
  .stats-section h4 {
    font-size: 1.1rem;
  }
  
  /* Reduce animation complexity on mobile for better performance */
  .progress-bar,
  .bar-chart {
    transition: none;
  }
  
  /* Simplify gradients on mobile */
  .stats-section {
    background: var(--card-bg);
  }
  
  .director-stats {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 16px;
  }
  
  .director-column {
    padding: 16px;
  }
  
  .director-column h4 {
    font-size: 1.1rem;
    margin-bottom: 12px;
  }
}

.stats-section h3 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--fg);
  margin: 0 0 24px 0;
  padding-bottom: 16px;
  border-bottom: 2px solid rgba(102, 126, 234, 0.2);
  display: flex;
  align-items: center;
  gap: 12px;
}

.stats-section h4 {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--primary);
  margin: 24px 0 16px 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin: 24px 0;
}

.stat-card {
  text-align: center;
  padding: 24px 20px;
  background: linear-gradient(135deg, var(--card-bg) 0%, rgba(102, 126, 234, 0.05) 100%);
  border-radius: 12px;
  border: 2px solid rgba(102, 126, 234, 0.2);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.2);
  border-color: var(--primary);
}

.stat-card:hover::before {
  transform: scaleX(1);
}

.stat-number {
  font-size: 3rem;
  font-weight: 800;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
  line-height: 1;
  animation: fadeInUp 0.5s ease;
}

.stat-label {
  font-size: 1rem;
  color: var(--fg);
  opacity: 0.85;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.progress-bar {
  width: 100%;
  height: 28px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
  border-radius: 14px;
  overflow: hidden;
  margin: 24px 0;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #4caf50 100%);
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 14px;
  position: relative;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.rating-distribution,
.decade-stats {
  margin: 28px 0;
  padding: 20px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.03) 0%, rgba(118, 75, 162, 0.03) 100%);
  border-radius: 12px;
  border: 1px solid rgba(102, 126, 234, 0.1);
}

.rating-bar,
.decade-bar {
  display: flex;
  align-items: center;
  margin: 12px 0;
  gap: 12px;
  padding: 8px 0;
  transition: transform 0.2s ease;
}

.rating-bar:hover,
.decade-bar:hover {
  transform: translateX(4px);
}

.rating-bar-label,
.decade-bar-label {
  width: 50px;
  font-weight: 700;
  flex-shrink: 0;
  font-size: 1.1rem;
  color: var(--primary);
  text-align: center;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
  padding: 6px 8px;
  border-radius: 8px;
}

.rating-bar-fill,
.decade-bar-fill {
  height: 28px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  border-radius: 14px;
  position: relative;
  min-width: 4px;
  width: 0%;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
}

.rating-bar:hover .rating-bar-fill,
.decade-bar:hover .decade-bar-fill {
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.rating-bar-count,
.decade-bar-count {
  font-weight: 700;
  min-width: 50px;
  text-align: right;
  flex-shrink: 0;
  font-size: 1.1rem;
  color: var(--fg);
  padding: 6px 12px;
  background: rgba(102, 126, 234, 0.1);
  border-radius: 8px;
}

.top-rated,
.director-stats {
  margin: 28px 0;
}

.rated-item,
.director-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  margin: 8px 0;
  background: linear-gradient(135deg, var(--card-bg) 0%, rgba(102, 126, 234, 0.05) 100%);
  border-radius: 10px;
  border-left: 4px solid var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
  cursor: default;
}

.rated-item:hover,
.director-item:hover {
  transform: translateX(6px);
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
  border-left-width: 6px;
  background: linear-gradient(135deg, var(--card-bg) 0%, rgba(102, 126, 234, 0.1) 100%);
}

.rated-item-title,
.director-name {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--fg);
  flex: 1;
}

.rated-item-rating,
.director-rating {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 6px 14px;
  background-color: rgba(102, 126, 234, 0.1);
  border-radius: 8px;
  -webkit-text-fill-color: var(--primary);
}

.director-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 24px;
}

.director-column {
  padding: 20px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.03) 0%, rgba(118, 75, 162, 0.03) 100%);
  border-radius: 12px;
  border: 1px solid rgba(102, 126, 234, 0.1);
}

.director-column h4 {
  margin: 0 0 20px 0;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--primary);
  padding-bottom: 12px;
  border-bottom: 2px solid rgba(102, 126, 234, 0.2);
}

/* Loading spinner for statistics */
#statsLoading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

#statsLoading p {
  margin-top: 16px;
  color: var(--fg);
  font-size: 1.1rem;
  opacity: 0.8;
}

/* Empty state styling */
.stats-section p {
  text-align: center;
  color: var(--fg);
  opacity: 0.6;
  padding: 20px;
  font-style: italic;
}

/* Enhanced section headers with icons */
.stats-section h3::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 2px;
  margin-right: 12px;
  vertical-align: middle;
}

@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .director-stats {
    grid-template-columns: 1fr;
  }
  
  .stats-section {
    padding: 24px 20px;
  }
  
  .stat-card {
    padding: 20px 16px;
  }
  
  .stat-number {
    font-size: 2.5rem;
  }
  
  /* FAQ Mobile Styles */
  .landing-faq {
    padding: 40px 15px;
  }
  
  .faq-title {
    font-size: 2rem;
    margin-bottom: 30px;
  }
  
  .faq-question {
    padding: 16px 20px;
    font-size: 1rem;
  }
  
  .faq-answer {
    padding: 0 20px;
  }
  
  .faq-question[aria-expanded="true"] + .faq-answer {
    padding: 0 20px 16px 20px;
  }
  
  .faq-answer p {
    font-size: 0.9rem;
  }
}

/* Landing Page Styles */
#landingPage {
  display: none;
  min-height: 100vh;
  background-color: var(--bg);
  padding: 0;
  margin: 0;
}

.landing-hero {
  text-align: center;
  padding: 80px 20px 60px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.landing-title {
  font-size: 4rem;
  font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-weight: 800;
  margin: 0 0 20px 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
  animation: gradient-shift 4s ease infinite;
  background-size: 200% 200%;
  filter: drop-shadow(0 4px 8px rgba(102, 126, 234, 0.4)) drop-shadow(0 0 20px rgba(118, 75, 162, 0.3));
  text-transform: uppercase;
}

.landing-subtitle {
  font-size: 1.5rem;
  color: var(--fg);
  margin: 0;
  font-weight: 400;
  opacity: 0.8;
}

.landing-features {
  padding: 60px 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.features-title {
  text-align: center;
  font-size: 2.5rem;
  color: var(--fg);
  margin-bottom: 40px;
  font-weight: 700;
}

/* FAQ Section Styles */
.landing-faq {
  padding: 60px 20px;
  max-width: 900px;
  margin: 0 auto;
}

.faq-title {
  text-align: center;
  font-size: 2.5rem;
  color: var(--fg);
  margin-bottom: 40px;
  font-weight: 700;
}

.faq-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.faq-item {
  background-color: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: box-shadow 0.3s ease;
}

.faq-item:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.faq-question {
  width: 100%;
  padding: 20px 24px;
  background-color: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--fg);
  font-size: 1.1rem;
  font-weight: 600;
  transition: background-color 0.2s ease;
}

.faq-question:hover {
  background-color: rgba(102, 126, 234, 0.05);
}

.faq-question:focus {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.faq-icon {
  font-size: 1.5rem;
  font-weight: 300;
  color: var(--primary);
  transition: transform 0.3s ease;
  flex-shrink: 0;
  margin-left: 16px;
}

.faq-question[aria-expanded="true"] .faq-icon {
  transform: rotate(45deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 24px;
}

.faq-question[aria-expanded="true"] + .faq-answer {
  max-height: 500px;
  padding: 0 24px 20px 24px;
}

.faq-answer p {
  color: var(--fg);
  opacity: 0.85;
  line-height: 1.7;
  margin: 0;
  font-size: 0.95rem;
}

.faq-answer a {
  color: var(--primary);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.faq-answer a:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
  margin-bottom: 40px;
}

.feature-card {
  background-color: var(--card-bg);
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.feature-icon {
  font-size: 3rem;
  margin-bottom: 15px;
}

.feature-card h3 {
  font-size: 1.5rem;
  color: var(--fg);
  margin: 0 0 10px 0;
  font-weight: 600;
}

.feature-card p {
  color: var(--fg);
  opacity: 0.8;
  line-height: 1.6;
  margin: 0;
  font-size: 0.95rem;
}

.landing-auth {
  padding: 60px 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 400px;
}

/* Authentication Modal Styles (now used within landing page) */
#authModal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.auth-container {
  background-color: var(--card-bg);
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  max-width: 400px;
  width: 90%;
}

.landing-auth .auth-container {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.auth-container h2 {
  margin-top: 0;
  color: var(--primary);
  text-align: center;
}

.auth-form input {
  width: 100%;
  padding: 12px;
  margin: 10px 0;
  border: 1px solid #ccc;
  border-radius: var(--btn-radius);
  box-sizing: border-box;
  background-color: var(--bg);
  color: var(--fg);
}

.auth-form button {
  width: 100%;
  padding: 12px;
  margin-top: 10px;
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: var(--btn-radius);
  cursor: pointer;
  font-size: 1rem;
}

.auth-form button:hover {
  background-color: var(--primary-hover);
}

.auth-toggle {
  text-align: center;
  margin-top: 20px;
  color: var(--fg);
}

.auth-toggle a {
  color: var(--primary);
  text-decoration: none;
  cursor: pointer;
}

.auth-toggle a:hover {
  text-decoration: underline;
}

#authError {
  color: #f44336;
  text-align: center;
  margin: 10px 0;
  min-height: 20px;
}

#authSuccess {
  color: #4caf50;
  text-align: center;
  margin: 10px 0;
  padding: 10px;
  background-color: rgba(76, 175, 80, 0.1);
  border-radius: 4px;
  font-weight: bold;
}

#userDisplay,
.user-display-btn {
  position: fixed;
  top: 60px;
  right: 20px;
  background-color: var(--card-bg);
  padding: 8px 16px;
  border-radius: var(--btn-radius);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  z-index: 100;
  display: none; /* Hidden by default, shown when user is logged in */
  border: 1px solid rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.95rem;
  color: var(--fg);
  align-items: center;
  gap: 10px;
}

body.dark-mode #userDisplay,
body.dark-mode .user-display-btn {
  border-color: rgba(255, 255, 255, 0.1);
}

#userDisplay:hover,
.user-display-btn:hover {
  background-color: var(--primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#userDisplay:not(:empty),
.user-display-btn:not(:empty) {
  display: inline-flex; /* Show only when it has content */
}

.user-profile-picture {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
}

#logoutBtn {
  position: fixed;
  top: 120px;
  right: 20px;
  display: none; /* Hidden by default, shown when user is logged in */ 
  z-index: 10001; /* Above auth modal */
  padding: 8px 16px;
  background-color: #f44336;
  color: white;
  border: none;
  border-radius: var(--btn-radius);
  cursor: pointer;
  z-index: 100;
}

#logoutBtn:hover {
  background-color: #d32f2f;
}

/* Landing Page Footer */
.landing-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--card-bg);
  padding: 15px 20px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  text-align: center;
  z-index: 50;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

/* When logged in, footer should start after the sidebar */
#mainContainer .landing-footer {
  left: 250px; /* Account for friends sidebar width */
  transition: left 0.3s ease;
}

#mainContainer .landing-footer.sidebar-hidden {
  left: 0;
}

@media (max-width: 768px) {
  #mainContainer .landing-footer {
    left: 200px; /* Account for smaller sidebar on mobile */
  }
  
  #mainContainer .landing-footer.sidebar-hidden {
    left: 0;
  }
}

body.dark-mode .landing-footer {
  border-top-color: rgba(255, 255, 255, 0.1);
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.footer-text {
  color: var(--fg);
  opacity: 0.7;
  margin: 0;
  font-size: 1rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 30px;
  flex-wrap: wrap;
}

.footer-link {
  color: var(--primary);
  text-decoration: none;
  font-size: 1rem;
  transition: opacity 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.footer-link:hover {
  opacity: 0.7;
  text-decoration: underline;
}

/* Responsive adjustments for landing page */
@media (max-width: 768px) {
  .landing-title {
    font-size: 2.5rem;
  }
  
  .landing-subtitle {
    font-size: 1.2rem;
  }
  
  .features-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .features-title {
    font-size: 2rem;
  }
  
  .footer-links {
    flex-direction: column;
    gap: 8px;
  }
  
  /* Make footer thinner on mobile */
  .landing-footer {
    padding: 8px 15px;
  }
  
  .footer-content {
    gap: 5px;
  }
  
  .footer-text {
    font-size: 0.85rem;
  }
  
  .footer-link {
    font-size: 0.85rem;
    gap: 5px;
  }
}

/* Account Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease;
}

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

.account-modal {
  background-color: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px 12px 0 0;
}

body.dark-mode .modal-header {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
  margin: 0;
  color: white;
  font-size: 1.5rem;
}

.friend-profile-header-content {
  display: flex;
  align-items: center;
  gap: 16px;
}

.friend-profile-picture-large {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
}

.modal-close {
  background: none;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background-color: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.modal-body {
  padding: 24px;
}

.account-section {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

body.dark-mode .account-section {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.account-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.account-section h3 {
  margin: 0 0 16px 0;
  color: var(--primary);
  font-size: 1.2rem;
}

.account-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background-color: var(--bg);
  border-radius: 8px;
}

body.dark-mode .info-item {
  background-color: rgba(255, 255, 255, 0.05);
}

.info-label {
  font-weight: 600;
  color: var(--fg);
  opacity: 0.8;
}

.info-value {
  font-weight: 500;
  color: var(--fg);
}

.profile-picture-preview {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.profile-picture-preview-img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.account-section form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.account-section form input {
  padding: 12px 16px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  background-color: var(--bg);
  color: var(--fg);
  font-size: 1rem;
  transition: all 0.2s ease;
}

body.dark-mode .account-section form input {
  border-color: rgba(255, 255, 255, 0.2);
  background-color: rgba(255, 255, 255, 0.05);
}

.account-section form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.account-section form .action-btn {
  padding: 12px 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.3s ease;
  margin-top: 8px;
}

.account-section form .action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.account-section form .action-btn:active {
  transform: translateY(0);
}

.danger-section {
  background-color: rgba(244, 67, 54, 0.05);
  padding: 20px;
  border-radius: 8px;
  border: 1px solid rgba(244, 67, 54, 0.2);
}

body.dark-mode .danger-section {
  background-color: rgba(244, 67, 54, 0.1);
  border-color: rgba(244, 67, 54, 0.3);
}

.danger-section h3 {
  color: #f44336;
}

.warning-text {
  color: var(--fg);
  opacity: 0.9;
  margin-bottom: 16px;
  line-height: 1.6;
}

.danger-btn {
  background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%) !important;
}

.danger-btn:hover {
  box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4) !important;
}

.error-message,
.success-message {
  padding: 12px;
  border-radius: 8px;
  margin-top: 8px;
  display: none;
  font-size: 0.9rem;
}

.error-message {
  background-color: rgba(244, 67, 54, 0.1);
  color: #f44336;
  border: 1px solid rgba(244, 67, 54, 0.3);
}

.success-message {
  background-color: rgba(76, 175, 80, 0.1);
  color: #4caf50;
  border: 1px solid rgba(76, 175, 80, 0.3);
}

body.dark-mode .error-message {
  background-color: rgba(244, 67, 54, 0.2);
}

body.dark-mode .success-message {
  background-color: rgba(76, 175, 80, 0.2);
}

/* Responsive modal */
@media (max-width: 768px) {
  .modal-overlay {
    padding: 10px;
    align-items: flex-start;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .account-modal {
    width: 95%;
    max-height: 95vh;
  }

  .modal-header {
    padding: 16px 20px;
  }

  .modal-header h2 {
    font-size: 1.3rem;
  }

  .modal-body {
    padding: 20px;
  }

  .account-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
  }
}

/* Privacy Settings */
.privacy-toggle-item {
  margin-bottom: 16px;
}

.toggle-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 12px;
  background-color: var(--bg);
  border-radius: 8px;
  transition: all 0.2s ease;
}

body.dark-mode .toggle-label {
  background-color: rgba(255, 255, 255, 0.05);
}

.toggle-label:hover {
  background-color: rgba(102, 126, 234, 0.1);
}

.toggle-label span:first-child {
  font-weight: 500;
  color: var(--fg);
}

.toggle-container {
  position: relative;
  width: 50px;
  height: 26px;
}

.toggle-switch {
  position: absolute;
  width: 50px;
  height: 26px;
  appearance: none;
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 26px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 0;
  z-index: 1;
}

body.dark-mode .toggle-switch {
  background-color: rgba(255, 255, 255, 0.2);
}

.toggle-switch:checked {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.toggle-slider {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background-color: white;
  border-radius: 50%;
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 2;
}

.toggle-switch:checked + .toggle-slider {
  transform: translateX(24px);
}

.info-text {
  color: var(--fg);
  opacity: 0.8;
  margin-bottom: 16px;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Friend Profile Modal */
.friend-profile-modal {
  background-color: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  max-width: 800px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

/* Accordion Sections */
.accordion-section {
  margin-bottom: 16px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  overflow: hidden;
  background-color: var(--bg);
}

body.dark-mode .accordion-section {
  border-color: rgba(255, 255, 255, 0.1);
}

.accordion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  cursor: pointer;
  background-color: var(--card-bg);
  transition: all 0.2s ease;
  user-select: none;
}

.accordion-header:hover {
  background-color: rgba(102, 126, 234, 0.1);
}

.accordion-header h3 {
  margin: 0;
  color: var(--primary);
  font-size: 1.1rem;
}

.accordion-icon {
  color: var(--primary);
  font-size: 0.9rem;
  transition: transform 0.3s ease;
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.accordion-content.active {
  max-height: 2000px;
}

.accordion-summary {
  padding: 16px 20px;
  color: var(--fg);
}

.summary-text {
  margin: 0;
  font-size: 1rem;
  color: var(--fg);
  opacity: 0.9;
}

.privacy-message {
  margin: 0;
  padding: 12px;
  background-color: rgba(244, 67, 54, 0.1);
  color: #f44336;
  border-radius: 6px;
  font-size: 0.9rem;
}

body.dark-mode .privacy-message {
  background-color: rgba(244, 67, 54, 0.2);
}

.accordion-full-content {
  padding: 16px 20px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

body.dark-mode .accordion-full-content {
  border-top-color: rgba(255, 255, 255, 0.1);
}

/* Friend Search Container */
.friend-search-container {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

body.dark-mode .friend-search-container {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.friend-search-input {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  background-color: var(--bg);
  color: var(--fg);
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

body.dark-mode .friend-search-input {
  border-color: rgba(255, 255, 255, 0.2);
  background-color: rgba(255, 255, 255, 0.05);
}

.friend-search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.friend-search-input::placeholder {
  color: var(--fg);
  opacity: 0.5;
}

/* Friend Item Cards */
.friend-item-card {
  background-color: var(--card-bg);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

body.dark-mode .friend-item-card {
  border-color: rgba(255, 255, 255, 0.1);
}

.friend-item-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.friend-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.friend-item-header h4 {
  margin: 0;
  color: var(--fg);
  font-size: 1.1rem;
}

.rating-badge {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
}

.friend-item-details {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--fg);
  opacity: 0.8;
}

.watched-badge {
  background-color: rgba(76, 175, 80, 0.2);
  color: #4caf50;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
}

.unwatched-badge {
  background-color: rgba(244, 67, 54, 0.2);
  color: #f44336;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
}

.friend-review {
  margin: 12px 0 0 0;
  padding: 12px;
  background-color: var(--bg);
  border-radius: 6px;
  color: var(--fg);
  font-size: 0.9rem;
  line-height: 1.5;
  opacity: 0.9;
}

body.dark-mode .friend-review {
  background-color: rgba(255, 255, 255, 0.05);
}

.empty-message {
  text-align: center;
  color: var(--fg);
  opacity: 0.6;
  padding: 20px;
  margin: 0;
}

/* Compact Statistics */
.friend-stats-compact {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.stat-card {
  background-color: var(--card-bg);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 16px;
}

body.dark-mode .stat-card {
  border-color: rgba(255, 255, 255, 0.1);
}

.stat-card h4 {
  margin: 0 0 12px 0;
  color: var(--primary);
  font-size: 1rem;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

body.dark-mode .stat-item {
  border-bottom-color: rgba(255, 255, 255, 0.05);
}

.stat-item:last-child {
  border-bottom: none;
}

.stat-item span:first-child {
  color: var(--fg);
  opacity: 0.8;
  font-size: 0.9rem;
}

.stat-item span:last-child {
  color: var(--fg);
  font-weight: 600;
}

/* Clickable friend username */
.friend-username.clickable {
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 4px 8px;
  border-radius: 4px;
}

.friend-username.clickable:hover {
  background-color: rgba(102, 126, 234, 0.1);
  color: var(--primary);
}

/* ============================================================================
   Friends Sidebar
   ============================================================================ */

.friends-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 250px;
  height: 100vh;
  background: var(--bg);
  border-right: 2px solid rgba(102, 126, 234, 0.2);
  padding: 20px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, width 0.3s ease;
}

.friends-sidebar.hidden {
  transform: translateX(-100%);
  width: 0;
  padding: 0;
  border-right: none;
}

.friends-sidebar.hidden .friends-sidebar-header,
.friends-sidebar.hidden #friendsList {
  display: none;
}

.friends-sidebar-header {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid rgba(102, 126, 234, 0.2);
}

.friends-sidebar-header h2 {
  margin: 0 0 15px 0;
  color: var(--primary);
  font-size: 1.5rem;
}

.friends-sidebar-header .action-btn {
  width: 100%;
  padding: 10px;
  font-size: 0.9rem;
}

.sidebar-toggle-btn {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  padding: 0;
  flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
  background: var(--primary-hover);
  transform: scale(1.1);
}

/* Floating toggle button is controlled by JavaScript, not CSS sibling selector */

.sidebar-toggle-floating {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 0 8px 8px 0;
  width: 40px;
  height: 60px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  z-index: 99;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.sidebar-toggle-floating:hover {
  background: var(--primary-hover);
  width: 45px;
}

.friends-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.friend-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: rgba(102, 126, 234, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(102, 126, 234, 0.2);
  transition: all 0.3s ease;
}

.friend-item:hover {
  background: rgba(102, 126, 234, 0.15);
  transform: translateX(4px);
}

.friend-item-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.friend-profile-picture {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(102, 126, 234, 0.3);
  flex-shrink: 0;
}

.friend-username {
  font-weight: 600;
  color: var(--fg);
  cursor: pointer;
}

.friend-username:hover {
  color: var(--primary);
}

.unfriend-btn {
  background: rgba(244, 67, 54, 0.1);
  color: #f44336;
  border: 1px solid rgba(244, 67, 54, 0.3);
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.unfriend-btn:hover {
  background: rgba(244, 67, 54, 0.2);
  transform: scale(1.1);
}

.no-friends {
  text-align: center;
  color: var(--fg);
  opacity: 0.6;
  padding: 20px;
  font-style: italic;
}

/* Container margin is already set above to account for sidebar */

/* ============================================================================
   Notification Bell & Dropdown
   ============================================================================ */

.notification-bell {
  position: fixed;
  top: 20px;
  left: 270px;
  background: var(--bg);
  border: 2px solid rgba(102, 126, 234, 0.3);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.5rem;
  z-index: 200;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.notification-bell:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
  transform: scale(1.05);
}

.notification-dot {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #f44336;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: bold;
  border: 2px solid var(--bg);
}

.notification-dropdown {
  position: fixed;
  top: 80px;
  left: 270px;
  width: 350px;
  max-height: 500px;
  background: var(--bg);
  border: 2px solid rgba(102, 126, 234, 0.3);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 199;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: left 0.3s ease;
}

.notification-dropdown.sidebar-hidden {
  left: 20px;
}

.notification-header {
  padding: 15px 20px;
  border-bottom: 2px solid rgba(102, 126, 234, 0.2);
  background: rgba(102, 126, 234, 0.05);
}

.notification-header h3 {
  margin: 0;
  color: var(--primary);
  font-size: 1.2rem;
}

.notification-list {
  overflow-y: auto;
  max-height: 450px;
}

.notification-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 15px 20px;
  border-bottom: 1px solid rgba(102, 126, 234, 0.1);
  transition: background 0.2s ease;
}

.notification-item:hover {
  background: rgba(102, 126, 234, 0.05);
}

.notification-item.unread {
  background: rgba(102, 126, 234, 0.08);
}

.notification-item.read {
  opacity: 0.7;
}

.notification-content {
  flex: 1;
  margin-right: 10px;
}

.notification-message {
  margin: 0 0 5px 0;
  color: var(--fg);
  font-size: 0.95rem;
  line-height: 1.4;
}

.notification-time {
  font-size: 0.8rem;
  color: var(--fg);
  opacity: 0.6;
}

.notification-action-btn {
  margin-top: 8px;
  margin-right: 5px;
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.notification-action-btn.accept-btn {
  background: #4caf50;
  color: white;
}

.notification-action-btn.accept-btn:hover {
  background: #45a049;
  transform: scale(1.05);
}

.notification-action-btn.deny-btn {
  background: rgba(244, 67, 54, 0.1);
  color: #f44336;
  border: 1px solid rgba(244, 67, 54, 0.3);
}

.notification-action-btn.deny-btn:hover {
  background: rgba(244, 67, 54, 0.2);
  transform: scale(1.05);
}

.notification-dismiss {
  background: transparent;
  border: none;
  color: var(--fg);
  opacity: 0.5;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 5px;
  border-radius: 4px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.notification-dismiss:hover {
  opacity: 1;
  background: rgba(244, 67, 54, 0.1);
  color: #f44336;
}

.no-notifications {
  text-align: center;
  color: var(--fg);
  opacity: 0.6;
  padding: 30px 20px;
  font-style: italic;
}

/* Friend Request Modal */
.friend-request-modal-content {
  background-color: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  max-width: 400px;
  width: 90%;
  padding: 24px;
  position: relative;
  animation: slideUp 0.3s ease;
  border: 2px solid rgba(102, 126, 234, 0.3);
}

body.dark-mode .friend-request-modal-content {
  background-color: rgba(30, 30, 47, 0.95);
  border-color: rgba(102, 126, 234, 0.5);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.friend-request-modal-content h2 {
  margin: 0 0 20px 0;
  color: var(--primary);
  font-size: 1.5rem;
  text-align: center;
}

.friend-request-modal-content form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.friend-request-modal-content form input {
  width: 100%;
  padding: 12px;
  border: 2px solid rgba(102, 126, 234, 0.3);
  border-radius: 8px;
  background-color: var(--bg);
  color: var(--fg);
  font-size: 1rem;
  box-sizing: border-box;
}

.friend-request-modal-content form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

body.dark-mode .friend-request-modal-content form input {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: rgba(102, 126, 234, 0.4);
}

.friend-request-modal-content .close-button {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: var(--fg);
  font-size: 2rem;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  opacity: 0.7;
}

.friend-request-modal-content .close-button:hover {
  opacity: 1;
  background-color: rgba(244, 67, 54, 0.1);
  color: #f44336;
  transform: rotate(90deg);
}

/* User display and logout buttons stay on the right side */
/* They don't need adjustment - notification bell is on the left */

/* Mobile: Make sidebar overlay/drawer style */
@media (max-width: 768px) {
  .friends-sidebar {
    width: 280px;
    transform: translateX(-100%);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
  }
  
  .friends-sidebar:not(.hidden) {
    transform: translateX(0);
  }
  
  /* Overlay when sidebar is open */
  .friends-sidebar:not(.hidden)::before {
    content: '';
    position: fixed;
    top: 0;
    left: 280px;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
  }
  
  .container {
    margin-left: 0;
    max-width: 100%;
    padding: 0 10px;
  }
  
  .container.sidebar-hidden {
    margin-left: 0;
  }
  
  /* Notification bell positioning */
  .notification-bell {
    left: 10px;
    top: 10px;
  }
  
  .notification-dropdown {
    left: 10px;
    top: 60px;
    width: calc(100vw - 20px);
    max-width: 400px;
  }
  
  /* User display and logout buttons */
  .user-display-btn {
    right: 10px;
    top: 60px;
    left: auto;
    font-size: 0.85rem;
    padding: 6px 12px;
  }
  
  #logoutBtn {
    right: 10px;
    top: 120px;
    left: auto;
    padding: 6px 12px;
    font-size: 0.85rem;
  }
  
  /* Toggle button for sidebar */
  .sidebar-toggle {
    position: fixed;
    left: 10px;
    top: 10px;
    z-index: 1001;
    padding: 10px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Theme toggle button */
  .toggle-btn {
    top: 10px;
    right: 10px;
    padding: 8px 12px;
    font-size: 0.85rem;
  }
}

/* Very small screens (phones in portrait) */
@media (max-width: 480px) {
  body {
    padding: 8px;
    padding-bottom: 60px;
  }
  
  .header {
    height: 100px;
    margin-bottom: 10px;
  }
  
  .header h1 {
    font-size: 1.75rem;
  }
  
  .friends-sidebar {
    width: 85vw;
    max-width: 280px;
  }
  
  .container {
    padding: 0 8px;
  }
  
  .card {
    padding: 12px;
    margin-bottom: 15px;
  }
  
  .card > div:first-of-type h2 {
    font-size: 1.5rem;
  }
  
  /* Smaller buttons on very small screens */
  .action-btn {
    padding: 8px 12px;
    font-size: 0.85rem;
    min-height: 44px; /* Touch-friendly */
  }
  
  /* Better spacing for search/filter controls */
  .card > div:nth-of-type(2) {
    padding: 12px;
    gap: 8px;
  }
  
  input[type="text"],
  input[type="number"],
  select {
    padding: 10px;
    font-size: 14px;
    min-height: 44px; /* Touch-friendly */
  }
}

