/* Enhanced General Styles - Matching explore.css */
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  margin: 0;
  padding: 0;
  background: linear-gradient(135deg, #f0f4f8 0%, #e6eef7 100%);
  width: 100%;
  height: 100%;
  color: #2d3748;
  overflow-x: hidden;
  overflow-y: scroll;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
}

/* Enhanced Navbar - Matching explore.css */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
  background: linear-gradient(90deg, rgba(0, 84, 180, 0.9) 0%, rgba(0, 122, 255, 0.9) 100%);
  height: 4rem;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 10;
}

/* Enhanced Logo - Matching explore.css */
.logo {
  display: flex;
  align-items: center;
  height: 100%;
  transition: transform 0.3s ease;
}

.logo:hover {
  transform: scale(1.03);
}

.logo a img {
  height: 4rem;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  background: transparent;
  border-radius: 2%;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
  transition: all 0.3s ease;
}

/* Enhanced Nav Links - Matching explore.css */
.nav-links {
  list-style: none;
  display: flex;
  gap: 1.5rem;
}

.nav-links a {
  text-decoration: none;
  color: white;
  font-weight: 600;
  transition: all 0.3s ease;
  padding: 0.5rem 0;
  position: relative;
}

.nav-links a::after {
  content: "";
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: rgba(255, 255, 255, 0.8);
  transition: width 0.3s ease;
}

.nav-links a:hover::after {
  width: 100%;
}

.nav-links a:hover {
  color: #dbeafe;
}

/* Enhanced Discussion Container */
.discussion-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1rem;
  animation: fadeIn 0.5s ease-out;
  width: 95%;
}

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

/* Enhanced Discussion Header */
.discussion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #edf2f7;
  flex-wrap: wrap; /* Allow wrapping on small screens */
  gap: 1rem; /* Consistent spacing between elements */
}

.discussion-actions {
  display: flex;
  align-items: center;
  gap: 1rem; /* Proper spacing between buttons */
  min-width: 0; /* Prevent overflow */
}

.discussion-header h2 {
  font-size: 2rem;
  color: #2d3748;
  position: relative;
  display: inline-block;
  padding-bottom: 0.5rem;
}

.discussion-header h2::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 3px;
  bottom: 0;
  left: 0;
  background: linear-gradient(90deg, rgba(0, 84, 180, 0.9) 0%, rgba(64, 156, 255, 0.9) 100%);
  border-radius: 3px;
}

#create-discussion-btn {
  padding: 0.75rem 1.25rem; /* Slightly reduced horizontal padding */
  background: rgba(0, 122, 255, 0.9);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 3px 8px rgba(0, 84, 180, 0.3);
  white-space: nowrap;
  font-size: 0.95rem; /* Slightly smaller font size */
  min-width: fit-content; /* Ensure button fits content */
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#create-discussion-btn:hover {
  background: rgba(0, 84, 180, 0.9);
  transform: translateY(-2px);
  box-shadow: 0 5px 12px rgba(0, 84, 180, 0.4);
}

/* Enhanced Buttons - Matching explore.css */
.btn {
  padding: 14px 28px;
  font-size: 18px;
  font-weight: bold;
  text-decoration: none;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
  background: rgba(0, 122, 255, 0.9);
  color: white;
}

.btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

/* Enhanced Discussion Threads */
.discussion-thread {
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 6px 15px rgba(91, 155, 213, 0.15);
  padding: 1.75rem;
  margin-bottom: 1.75rem;
  border-left: 4px solid #5b9bd5;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  word-break: break-word;
  overflow-wrap: break-word;
  overflow: hidden;
}

.discussion-thread:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(91, 155, 213, 0.2);
}

.discussion-thread h3 {
  margin-top: 0;
  color: #2d3748;
  font-size: 1.3rem;
  line-height: 1.4;
}

.discussion-thread h3 a {
  text-decoration: none;
  color: inherit;
  transition: color 0.3s ease;
}

.discussion-thread h3 a:hover {
  color: #5b9bd5;
}

.discussion-thread p {
  margin: 0.5rem 0;
  font-size: 0.95rem;
}

.thread-stats {
  display: flex;
  gap: 1.5rem;
  margin-top: 1rem;
  color: #6b7280;
  flex-wrap: wrap;
}

.thread-stats span {
  cursor: pointer;
  transition: color 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.thread-stats span:hover {
  color: #5b9bd5;
  background-color: #f0f4f8;
}

/* Enhanced Comments Section */
.comments-section {
  display: none;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #edf2f7;
}

.comment {
  margin-bottom: 1rem;
  padding: 1rem;
  background-color: #f8fafc;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  word-break: break-word;
}

.comment-input {
  width: 100%;
  padding: 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  margin-top: 1rem;
  resize: vertical;
  transition: all 0.3s ease;
}

.comment-input:focus {
  border-color: #5b9bd5;
  box-shadow: 0 0 0 3px rgba(91, 155, 213, 0.2);
  outline: none;
}

.comment-submit {
  background: linear-gradient(135deg, #5b9bd5 0%, #4a89c7 100%);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 1rem;
  transition: all 0.3s ease;
  box-shadow: 0 3px 8px rgba(91, 155, 213, 0.3);
}

.comment-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 12px rgba(91, 155, 213, 0.4);
}

/* Enhanced Modal */
.modal {
  display: none; /* Initial state is hidden */
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: white;
  margin: 0 auto;
  padding: 2rem;
  width: 80%;
  max-width: 700px;
  max-height: 80vh;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  animation: modalFadeIn 0.3s ease-out;
  overflow: hidden;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.close {
  color: #9ca3af;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.3s ease;
  position: sticky;
  top: 0;
  z-index: 1;
}

.close:hover {
  color: #6b7280;
}

#tag-filter {
  padding: 0.75rem 1.25rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1rem;
  background: white;
  color: #2d3748;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 150px; /* Minimum width */
  appearance: none; /* Remove default styling */
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
}

#tag-filter:hover {
  border-color: #5b9bd5;
}

#tag-filter:focus {
  outline: none;
  border-color: #5b9bd5;
  box-shadow: 0 0 0 3px rgba(91, 155, 213, 0.2);
}

/* Enhanced Form Elements */
.form-group {
  flex: 0 0 auto;
  margin-top: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.75rem;
  font-weight: 600;
  color: #2d3748;
}

.form-control {
  width: 100%;
  padding: 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.form-control:focus {
  border-color: #5b9bd5;
  box-shadow: 0 0 0 3px rgba(91, 155, 213, 0.2);
  outline: none;
}

.tag-input {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.tag {
  background-color: #e0e7ff;
  color: #3b82f6;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  margin: 0.25rem;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag span {
  cursor: pointer;
  font-size: 1rem;
}

.tag:hover {
  background-color: #dbeafe;
}

/* Enhanced Pagination */
.pagination {
  display: flex;
  justify-content: center;
  margin-top: 2.5rem;
  gap: 0.75rem;
}

.pagination button {
  padding: 0.75rem 1.25rem;
  border: 1px solid #e2e8f0;
  background-color: white;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.pagination button:hover {
  background-color: #f3f4f6;
}

.pagination button.active {
  background: linear-gradient(135deg, #5b9bd5 0%, #4a89c7 100%);
  color: white;
  border-color: transparent;
}

/* Enhanced Search Bar */
.search-bar {
  display: flex;
  gap: 0.75rem; /* Proper spacing between input and button */
  margin-bottom: 1.5rem;
  width: 100%;
  margin-top: -30px;
}

#search-input {
  flex: 1;
  padding: 0.75rem 1.25rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
  min-height: 42px;
}

#search-input:focus {
  border-color: #5b9bd5;
  box-shadow: 0 0 0 3px rgba(91, 155, 213, 0.2);
  outline: none;
}

#search-btn {
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, #ffd166 0%, #ffb347 100%);
  color: #2d3748;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

#search-btn:hover {
  background: linear-gradient(135deg, #ffb347 0%, #ff9a3f 100%);
  transform: translateY(-2px);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .discussion-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .discussion-actions {
    width: 100%;
    justify-content: space-between;
    margin-top: 0.5rem;
  }
  
  #tag-filter {
    flex: 1;
    min-width: 120px;
  }
  
  .search-bar {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  #search-input, 
  #search-btn {
    width: 100%;
  }
}

/* Ensure buttons don't break layout on small screens */
#create-discussion-btn, 
#search-btn, 
.pagination button, 
.comment-submit {
  white-space: nowrap;
  min-width: fit-content;
}

/* Enhanced Footer - Matching explore.css */
.footer {
  text-align: center;
  padding: 1.5rem;
  background: linear-gradient(90deg, #5b9bd5 0%, #4a89c7 100%);
  color: white;
  margin-top: auto;
  width: 100%;
  box-shadow: 0 -2px 15px rgba(0, 0, 0, 0.1);
}

.footer p {
  margin: 0;
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* Enhanced Loader */
.loader {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #5b9bd5;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 2rem auto;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    padding: 1rem;
    max-height: 85vh;
  }
  
  .modal-scrollable-content {
    max-height: 45vh;
  }
}

#view-discussion-modal .modal-content {
  display: flex;
  flex-direction: column;
  padding: 2rem;
  max-height: 80vh;
  margin: 0 auto;
}

#discussion-details {
  flex: 0 0 auto;
  padding-bottom: 1rem;
  border-bottom: 1px solid #edf2f7;
}

.modal-scrollable-content {
  flex: 1 1 auto;
  overflow-y: auto;
  max-height: 60vh;
  padding-right: 0.5rem;
  width: 100%;
  box-sizing: border-box;
}

#comments-container {
  margin: 1rem 0;
}

/* Small devices (phones, 576px and below) */
@media (max-width: 576px) {
  body {
    overflow-x: hidden;
    width: 100%;
  }
  
  /* Navbar mobile styling */
  .navbar {
    padding: 0 0.5rem;
    height: 3.5rem;
  }
  
  .logo a img {
    height: 3rem;
  }
  
  .nav-links {
    gap: 0.75rem;
    font-size: 0.9rem;
  }
  
  /* Content mobile styling */
  .discussion-container {
    width: 100%;
    padding: 1rem 0.75rem;
    margin: 0 auto;
    box-sizing: border-box;
  }
  
  .discussion-thread {
    padding: 1rem;
    margin-bottom: 1rem;
  }
  
  .discussion-header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
  }
  
  /* Discussion actions */
  #create-discussion-btn,
  #search-btn {
    padding: 0.5rem 0.8rem;
    font-size: 0.85rem;
  }
  
  /* Tags */
  .tag {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
  }
  
  /* Reduce padding for vote buttons to avoid overflow */
  .thread-stats span {
    padding: 0.15rem 0.3rem;
    font-size: 0.85rem;
  }
  
  /* Form elements */
  .form-control {
    padding: 0.75rem;
  }
  
  #comment-input {
    font-size: 0.9rem;
    padding: 0.5rem;
  }
  
  #submit-comment {
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
  }
  
  /* Modal */
  .modal-content {
    width: 92%;
    padding: 0.75rem;
    margin: 0 auto;
  }
  
  .modal-scrollable-content {
    max-height: 45vh;
  }
  
  /* Pagination */
  .pagination {
    margin-top: 1.5rem;
  }
  
  .pagination button {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
  }
  
  /* Ensure all content is properly contained */
  * {
    max-width: 100%;
    box-sizing: border-box;
  }
}

@media (max-width: 768px) {
  .discussion-container {
    padding: 1rem;
    width: 100%;
    box-sizing: border-box;
  }
}

/* Hamburger menu for mobile */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 21px;
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  height: 3px;
  width: 100%;
  background-color: white;
  border-radius: 3px;
  transition: all 0.3s ease;
}

/* Mobile navigation styles */
@media (max-width: 768px) {
  .navbar {
    padding: 0 1rem;
  }

  .menu-toggle {
    display: flex;
    z-index: 15;
  }
  
  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 70%;
    height: 100vh;
    padding: 4rem 2rem 2rem;
    background: linear-gradient(135deg, rgba(0, 84, 180, 0.95) 0%, rgba(0, 122, 255, 0.95) 100%);
    flex-direction: column;
    align-items: flex-start;
    transition: right 0.3s ease-in-out;
    z-index: 10;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
  }
  
  .nav-links.active {
    right: 0;
  }
  
  .nav-links li {
    margin: 1rem 0;
  }
  
  .menu-toggle.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
  }
  
  .menu-toggle.active span:nth-child(2) {
    opacity: 0;
  }
  
  .menu-toggle.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
  }
  
  /* Add overlay when menu is open */
  .menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 5;
  }
  
  .menu-overlay.active {
    display: block;
  }
}

.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0.5rem 0;
}

/* Extra small devices (tiny phones) */
@media (max-width: 320px) {
  .discussion-thread {
    padding: 0.75rem;
    margin-bottom: 0.75rem;
  }
  
  .discussion-thread h3 {
    font-size: 1.1rem;
  }
  
  .thread-stats {
    gap: 0.5rem;
  }
  
  .thread-stats span {
    padding: 0.1rem 0.25rem;
    font-size: 0.8rem;
  }
  
  .tag {
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
  }
}

/* Content in modal */
.content {
  word-break: break-word;
  overflow-wrap: break-word;
  overflow: hidden;
  max-width: 100%;
}

