/* Global Styles */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #1a1a2e;
    color: white;
}

h1, h2, p {
    color: white;
    margin: 0;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #16213e;
    padding: 1rem 1.5rem;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1502;
    height: 2rem; /* Relative height for adaptability */
}

/* Hamburger Menu Toggle (hidden on desktop) */
.menu-toggle {
    display: none; /* hidden by default */
}
.header-toggle {
    display: none; /* hidden by default */
}

.header {
    display: flex; /* Aligns items in a row */
    align-items: center; /* Centers them vertically */
    gap: 10px; /* Adds space between the image and text */
}

.logo {
    width: 3vw; /* Adjust size as needed */
    height: 3vw;
}

.title {
    margin: 0; /* Removes default margins for better alignment */
    font-size: 24px; /* Adjust font size as needed */
}

nav {
    display: flex;
    flex-direction: row;
    position: absolute;
    align-items: center;
    right: 0;
    background: #16213e;
    padding: 0rem 1rem;
    margin: 1vw 2vw;
}

/* Profile Button Styling */
#profileButton {
    display: flex;
    align-items: center;
    max-width: 120px; /* Adjust as needed */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Username inside Profile Button */
#profileButton span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 80px; /* Adjust as needed */
}

/* Avatar Styling */
#profileButton img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    margin-left: 8px;
    flex-shrink: 0; /* Prevents the avatar from shrinking */
}

#profileHeaderWrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 1vw;
}
#profileHeaderMeta {
  display:flex;
  gap:12px;
  align-items:center;
  font-size: 14px;
  color: #444;
}
.avatar-small img {
  width:50px;
  height:50px;
  border-radius:50%;
}

.follow-btn {
  padding: 6px 10px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  background: #007bff;
  color: white;
}
.follow-btn.unfollow {
  background: #e6e6e6;
  color: #111;
}
.follow-btn:disabled { opacity: 0.6; cursor: not-allowed; }

nav a {
    color: white;
    text-decoration: none;
    margin: 0 10px;
    transition: color 0.3s;
}

nav a:hover {
    color: #ffcc00;
}

.discord-link {
    color: #ffcc00;
    font-weight: bold;
}

/* Sidebar */
.sidebar {
    width: 10vw; /* Responsive width based on viewport width */
    background: #0f3460;
    padding: 1rem;
    position: fixed;
    left: 0;
    min-width: 10rem;
    top: 4rem; /* Matches header height */
    height: calc(100vh - 4rem); /* Sidebar takes full height below header */
    overflow-y: auto;
}

.sidebar ul {
    list-style: none;
    padding: 0;
}

/* Style the label to take available space and add ellipsis for long names */
.tag-label {
  flex: 1; /* Takes up remaining space between the checkboxes */
  margin: 0 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 10px 0;
}

/* Tooltips */
/* unique, conflict-resistant tooltip styles */
.cg-tooltip-wrapper { position: relative; display: inline-block; margin-left: 6px; vertical-align: middle; }
.cg-tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-size: 12px;
  line-height: 1;
  border-radius: 50%;
  user-select: none;
  cursor: help;
  color: #555;
}

/* tooltip bubble - hidden by default */
.cg-tooltip-box {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
  background: rgba(0,0,0,0.85);
  color: #fff;
  z-index: 1200;

  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease, visibility 0.12s;
}

/* small arrow */
.cg-tooltip-box::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: rgba(0,0,0,0.85) transparent transparent transparent;
}

/* visible state uses a unique class, avoiding 'show' conflicts */
.cg-tooltip-wrapper.cg-tooltip-visible > .cg-tooltip-box {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

/* accessibility: if the tooltip needs to flip because of viewport, you can add a .cg-tooltip-bottom variant */

/* Settings */
/* Basic styles for modal */
.modal {
  display: none; /* Hidden by default */
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.4);
}
.modal-content {
  background-color: #16213e;
  margin: 3% auto;
  padding: 20px;
  width: 80%;
  max-width: 500px;
  border-radius: 8px;
}
.close {
  float: right;
  font-size: 28px;
  cursor: pointer;
}
.danger {
  background-color: #e74c3c;
  color: #fff;
  border: none;
  padding: 10px;
  cursor: pointer;
}

.hidden {
  display: none;
}

#tagPrefsSection {
  margin-top: 10px;
}

.tag-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

/* Dark mode */
.icon-button {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: inherit;
}

body.dark-mode {
  background-color: #121212;
  color: #f0f0f0;
}

.dark-mode header,
.dark-mode .modal-content {
  background-color: #1e1e1e;
  color: #f0f0f0;
}

/* Optional: Add transitions for a smooth effect */
body, header, .modal-content {
  transition: background-color 0.3s, color 0.3s;
}


/* Main Content */
.container {
    margin-left: 11vw; /* Adjusts dynamically based on sidebar */
    padding: 1.5rem;
    margin-top: 3rem;
}

.container-profile {
    padding: 1.5rem;
}

.character-section {
  border: 2px solid #ddd;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 2rem;
  max-width: 1250px; /* Matches grid width */
}

/* header layout */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0 0.25rem 0.5rem 0.25rem;
}

.section-title {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: white;
  font-weight: bold;
}

/* controls */
.section-controls { display:flex; align-items:center; }

/* toggle button */
.toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: 6px 8px;
  font-size: 14px;
  line-height: 1;
  border-radius: 6px;
  border: 1px solid #cfcfcf;
  background: transparent;
  cursor: pointer;
  user-select: none;
}

/* small screen-friendly sizing */
.toggle-btn .icon { display:inline-block; transition: transform .25s ease; }

/* visually hide accessible-only text */
.sr-only{
  position: absolute !important;
  height: 1px; width: 1px;
  overflow: hidden;
  clip: rect(1px,1px,1px,1px);
  white-space: nowrap;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
  max-width: 1250px;
  /* smooth collapse */
  overflow: auto;
  max-height: 2000px; /* large enough to contain cards */
  transition: max-height .35s ease, opacity .25s ease, padding .25s ease;
  opacity: 1;
  padding: 0.5rem 0;
  box-sizing: border-box;
}

/* collapsed state */
.character-section.minimized .icon {
  transform: rotate(-90deg);
}
.character-section.minimized .character-grid {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  pointer-events: none;
}

.character {
    background: #e94560;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    position: relative;
    cursor: pointer;
    width: 200px;
    max-width: 100%;
    transition: transform 0.3s;
}

.character:hover {
    transform: scale(1.05);
}

.character img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
}

/* Details Panel */
.details-panel {
    display: block;
    position: fixed;
    width: 20%;
    top: 4rem;
    right: 0px;
    background: #0f3460;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    max-height: 85vh;
    overflow-y: auto;
    z-index: 1501;
}

.details-panel-like {
    text-align: center;
}

.details-panel img {
    width: 100%;
    border-radius: 8px;
    max-height: 53vh;
    object-fit: cover;
}

.details-panel p {
    overflow-y: auto;
    max-height: 10vh;
}

.close-button {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: white;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.close-button:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* Interaction Buttons */
.favorite, .thumbs-up, .thumbs-down, .share {
    font-size: 24px;
    color: #ccc;
    cursor: pointer;
    margin-left: 1vh;
    margin-right: 1vh;
    transition: transform 0.3s ease, color 0.3s;
}

.favorite.active {
    color: red;
    transform: scale(1.2);
}

.thumbs-up.active {
    color: #4caf50;
    transform: scale(1.2);
}

.thumbs-down.active {
    color: #f44336;
    transform: scale(1.2);
}

.share:active {
    transform: scale(1.2);
    color: #2196f3; /* or whatever blue you like */
}

.favorite:hover, .thumbs-up:hover, .thumbs-down:hover, .share:hover {
    opacity: 0.7;
}

.details-panel-madeBy {
    display: flex;
    align-items: center;
    gap: 10px; /* Adjust spacing */
}
 .madeBy {
     display: flex;
     align-items: center;
     gap: 10px;
 }

/* profile page */
.feedback-badge {
  color: #fff;
  background: red;
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 0.7rem;
  position: absolute;
  top: 8px;
  right: 8px;
}

.edit-btn.attention {
  animation: pulse 1.2s infinite;
  background-color: #e67e22;
  color: white;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(230, 126, 34, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(230, 126, 34, 0); }
  100% { box-shadow: 0 0 0 0 rgba(230, 126, 34, 0); }
}

.delete-btn {
  background-color: #e74c3c;
  color: #fff;
}

/* Tags */
.tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
}

.tag {
    background: #ff6600;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.tag:hover {
    background: #ff4500;
}

/* Exclude Checkbox */
.exclude-checkbox {
    appearance: none;
    -webkit-appearance: none;
    background-color: #fff;
    border: 2px solid red;
    width: 20px;
    height: 20px;
    cursor: pointer;
    position: relative;
    margin-left: 8px;
    vertical-align: middle;
    border-radius: 3px;
}

.exclude-checkbox:checked {
    background-color: red;
}

.exclude-checkbox:checked::after {
    content: "✖";
    color: #fff;
    font-size: 17px;
    position: absolute;
    top: -4px;
    left: 0px;
}

/* Footer */
footer {
    background: rgba(0, 0, 0, 0.8);
    padding: 10px;
    position: fixed;
    bottom: 0;
    width: 100%;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.tab {
     cursor: pointer;
     text-decoration: underline; /* Makes it look like a link */
     color: blue; /* Traditional link color */
     font-size: 24px;
     margin: 0 15px; /* Adds spacing */
 }
 
 .tab:hover {
     color: darkblue; /* Darker on hover */
 }
/* Buttons */
button, .register-btn {
    background: #ff6600;
    color: white;
    padding: 10px 20px;
    font-size: 18px;
    border-radius: 5px;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.3s;
}

button:hover, .register-btn:hover {
    background: #ff4500;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #ccc;
    color: #666;
}

/* Review Page */
.review-highlight {
  border: 2px solid #e74c3c !important;
  border-radius: 4px;
}
.review-sidebar {
  padding: 12px;
  background: #fff7f7;
  border-left: 3px solid #e74c3c;
  font-size: 0.9rem;
}
.review-sidebar h4 {
  margin: 0 0 6px;
  color: #c0392b;
}
.review-sidebar p {
  margin: 0 4px 8px;
  line-height: 1.4;
}

/* Profile Page */
.profilePage {
    text-align: center;
}

.back-btn {
    padding: 10px 20px;
    background: #ff6600;
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.3s;
}

.back-btn:hover {
    background: #ff4500;
}

.custom-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    background-color: #333;
    color: #fff;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 14px;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 9999;
    pointer-events: none;
}

.custom-toast.show {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* Mobile Styles */
@media (max-width: 768px) {
    /* Header */
    header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: #16213e;
        padding: 1rem 0.2rem;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 1502;
        height: 2rem; /* Relative height for adaptability */
    }
    .logo {
    font-size: 20px;
    font-weight: bold;
    width: 9vw; /* Adjust size as needed */
    height: 9vw;
    }
    /* Show the hamburger menu on mobile */
    .menu-toggle {
        display: inline;
        cursor: pointer;
        font-size: 1.5rem;
        color: white;
    }
    
    .header-toggle {
        display: block;
        background: none;
        border: none;
        color: white;
        font-size: 24px;
        cursor: pointer;
        margin: 0vw 1vw;
    }

    nav {
    display: none;
    flex-direction: column;
    position: absolute;
    align-items: center;
    top: 4rem;
    right: 0;
    background: #16213e;
    padding: 0rem 1rem;
    margin: 0vw 3vw;
    z-index: 1502;
    }
    
    nav.active {
        display: flex;
    }

    nav a {
    color: white;
    text-decoration: none;
    margin: 2vw 0vw;
    transition: color 0.3s;
    }
        
    /* Sidebar adjustments: overlay style */
    .sidebar {
        width: 45%;
        max-width: 300px;
        position: fixed;
        top: 4rem;
        left: 0;
        height: calc(100vh - 4rem);
        z-index: 2000;
        transform: translateX(-100%);
    }
    
    /* Active state: slide in sidebar */
    .sidebar.active {
        transform: translateX(0);
    }

    /* Details Panel */
    .details-panel {
        display: block;
        position: fixed;
        width: 60%;
        top: 4rem;
        right: 0px;
        background: #0f3460;
        padding: 20px;
        border-radius: 10px;
        box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
        max-height: 85vh;
        overflow-y: auto;
        z-index: 1501;
    }

    /* Active state: slide in sidebar */
    .details-panel.active {
        transform: translateX(0);
    }
    
    /* Main content takes full width when sidebar is hidden */
    .container {
        margin-left: 0;
        margin-top: 3rem;
    }

    .character-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 2vw;
        max-width: 1250px;
    }

    .character {
        background: #e94560;
        border-radius: 8px;
        text-align: center;
        cursor: pointer;
        width: 9.8rem;
        max-width: 85%;
        transition: transform 0.3s;
    }
    
    /* Overlay: covers main content when sidebar is active */
    .overlay {
        display: none;
        position: fixed;
        top: 0rem;
        left: 0;
        width: 100%;
        height: 110vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1500;
        transition: opacity 0.3s ease-in-out;
        opacity: 0;
    }
    
    .overlay.active {
        display: block;
        opacity: 0;
    }

@media (max-width: 400px) {
    .character-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(125px, 1fr));
        gap: 2vw;
        max-width: 1250px;
    }
}
}
