/* Import global styles for theme transitions */
@import url('../css/global.css');

/* Container for the entire gallery */
.grid-container {
  max-width: 1200px;
  transition: padding 0.3s ease;
}

/* grid and items */
.grid-content {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 20px;
  transition: padding 0.3s ease;
  margin-top: 10px;
  box-sizing: border-box;
}

.grid-container {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  margin-top: 20px;
  transition: all 0.3s ease;
}

/* Category row styling */
.category-row {
  margin-bottom: 40px;
  transition: opacity 0.4s ease, height 0.4s ease, margin 0.4s ease, visibility 0.4s ease;
  padding: 0; /* Reset any padding to ensure alignment */
  max-width: 1160px;
  margin-left: auto;
  margin-right: auto;
}

.category-row.hidden {
  opacity: 0;
  height: 0;
  overflow: hidden;
  margin: 0;
  padding: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, height 0.4s ease, margin 0.4s ease, padding 0.4s ease, visibility 0.1s ease 0.4s;
}

.category-row.visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.4s ease, height 0.4s ease, margin 0.4s ease, visibility 0s;
}

.category-header {
  margin-bottom: 15px;
  padding-left: 10px;
  border-left: 4px solid #6366f1;
  margin-left: 0; /* Ensure no left margin */
}

.category-header h2 {
  font-size: 1.5rem;
  margin: 0;
}

/* Scrollable gallery with improved flex layout */
.scrollable-gallery {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  justify-content: center;
}

/* Responsive item styling with improved transitions */
.responsive {
  display: block;
  box-sizing: border-box;
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
  padding: 0 15px;
  margin-bottom: 30px;
}

/* Animation classes for search filtering */
.responsive.hidden {
  display: none;
  visibility: hidden;
  opacity: 0;
  transform: translateY(20px);
}

.responsive.visible {
  display: block;
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

.responsive.animating-in {
  opacity: 0;
  transform: translateY(20px);
}

.responsive.animating-out {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}

/* Gallery styling with consistent borders */
.gallery {
  width: 100%;
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  height: 100%;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

.dark-mode .gallery {
  background-color: rgba(30, 30, 30, 0.7);
  border: 1px solid rgba(70, 70, 70, 0.5);
}

.light-mode .gallery {
  background-color: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(220, 220, 220, 0.5);
}

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

.dark-mode .gallery:hover {
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
  background-color: rgba(40, 40, 40, 0.7);
}

.light-mode .gallery:hover {
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  background-color: rgba(250, 250, 250, 0.8);
}

/* Ensure inner content fills gallery properly */
.inner {
  text-align: center;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  flex: 1;
}

/* Clear existing media queries that are causing conflicts */
/* These media queries will be replaced with new consistent ones below */

/* New consistent responsive layout with proper spacing */
@media screen and (min-width: 1025px) {
  .responsive {
    width: 33.33%;
    max-width: 380px;
    padding: 0 15px;
    margin-bottom: 30px;
  }
}

@media screen and (min-width: 769px) and (max-width: 1024px) {
  .responsive {
    width: 50%;
    max-width: 450px;
    padding: 0 12px;
    margin-bottom: 25px;
  }
}

@media screen and (max-width: 768px) {
  .responsive {
    width: 100%;
    max-width: 500px;
    padding: 0 10px;
    margin-bottom: 20px;
  }
}

.dark-mode .inner {
  border: 1px solid #333;
}

.light-mode .inner {
  border: 1px solid #e0e0e0;
}

.inner img {
  max-width: 100%;
  height: auto;
  display: block;
}

.dark-mode .inner img {
  border-bottom: 1px solid #333;
}

.light-mode .inner img {
  border-bottom: 1px solid #e0e0e0;
}

/* Image container with improved hover effect */
.image-container {
  position: relative;
  overflow: hidden;
  padding-top: 56.25%; /* 16:9 aspect ratio */
  width: 100%;
  background-color: rgba(0, 0, 0, 0.05);
}

.image-container img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.gallery:hover .image-container img {
  transform: scale(1.08);
}

/* Improved description styling */
.desc {
  padding: 15px;
  text-align: left;
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 80px;
}

.desc strong {
  display: block;
  font-size: 1.1rem;
  margin-bottom: 8px;
  font-weight: 600;
  color: inherit;
  position: relative;
  transition: color 0.3s ease;
}

.desc p {
  margin: 0;
  font-size: 0.9rem;
  color: #888;
  line-height: 1.4;
}

/* Consistent styling across themes */
.dark-mode .desc {
  color: #e0e0e0;
}

.light-mode .desc {
  color: #333;
}

.dark-mode .desc p {
  color: #aaa;
}

.light-mode .desc p {
  color: #666;
}

/* Visual indicator for gallery items */
.gallery::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  background: transparent;
  z-index: 3;
}

.gallery:hover::before {
  height: 0;
}

/* Enhanced gallery header */
.gallery-header {
  text-align: center;
  padding: 30px 20px;
  margin: 0 auto;
  max-width: 1160px;
  box-sizing: border-box;
}

.gallery-header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  color: inherit;
}

.gallery-header p {
  font-size: 1.1rem;
  max-width: 800px;
  margin: 0 auto;
  color: inherit;
}

/* Skill icons in gallery items */
.skill-icons {
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  margin-top: 15px;
}

.skill-icons a {
  opacity: 0.7;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.skill-icons a:hover {
  opacity: 1;
  transform: scale(1.15);
}

.skill-icons img {
  width: 24px;
  height: 24px;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .gallery-header {
    padding: 40px 20px 20px;
  }
  
  .grid-container {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
  }
  
  .gallery-header h1 {
    font-size: 2.2rem;
  }
  
  .filter-btn {
    padding: 8px 16px;
    font-size: 14px;
  }
}

@media (max-width: 600px) {
  .grid-container {
    grid-template-columns: 1fr;
  }
  
  .gallery-header h1 {
    font-size: 1.8rem;
  }
  
  .gallery-header p {
    font-size: 1rem;
  }
  
  .gallery-filters {
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 10px;
    justify-content: flex-start;
  }
  
  .filter-btn {
    padding: 6px 12px;
    font-size: 13px;
    white-space: nowrap;
  }
}

/*line stuff*/
.line-header {
  display: flex;
  align-items: center;
  gap: 20px;
}

.line-header h1 {
  margin: 20px;
  text-align: left;
  white-space: nowrap;
}

.dark-mode .line-header .line {
  flex-grow: 1;
  height: 2px;
  background-color: #C8C8C8;
  margin-right: 20px; /* Ensures margin on the right */
}
.light-mode .line-header .line {
  flex-grow: 1;
  height: 2px;
  background-color: #000000;
  margin-right: 20px; /* Ensures margin on the right */
}

@media (max-width: 750px) {
  .line-header .line {
    margin-right: 10px; /* Adjust margin for smaller screens */
  }
}

/*project page*/
.project-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: center; /* Center horizontally */
  align-items: center; /* Center vertically */
  padding: 20px;
  box-sizing: border-box;
  min-height: 100vh; /* Ensure the container takes at least the full viewport height */
}

.project-left {
  flex: 1;
  display: flex;
  align-items: center; /* Center image vertically */
  justify-content: center; /* Center image horizontally */
  margin-right: 20px;
}

.project-left img {
  width: 100%;
  height: auto;
  border: 2px solid #C8C8C8; /* Add border to the image */
}
.light-mode .project-left img {
  width: 100%;
  height: auto;
  border: 2px solid #000000; /* Add border to the image */
}

.project-right {
  flex: 1;
}

.project-right h1 {
  font-size: 2em;
  margin-bottom: 10px;
  text-align: left;
}

.project-right p {
  font-size: 1.2em;
  margin-bottom: 10px;
}

.project-right a {
  font-size: 1.2em;
  text-decoration: underline; /* Underline the text */
  position: relative; /* Position relative for the arrow */
}
.dark-mode .project-right a {
  color: #C8C8C8; /* Change text color to white */
}
.light-mode .project-right a {
  color: #000000; /* Change text color to white */
}

.project-right a::after {
  content: 'â†—'; /* Unicode for arrow pointing to the top right */
  position: absolute;
  right: -20px; /* Adjust the position of the arrow */
  top: 0;
  font-size: 1.2em;
  color: #C8C8C8; /* Match the arrow color with the text */
}
.light-mode .project-right a::after {
  color: #000000; /* Match the arrow color with the text */
}
.dark-mode .project-right a:hover {
  color: #C8C8C8; /* Change text color to white */
}

.project-right a:hover {
  text-decoration: underline;
}

@media only screen and (max-width: 750px) {
  .project-container {
    flex-direction: column; /* Stack items vertically */
    align-items: center; /* Center items horizontally */
  }

  .project-left {
    margin-right: 0;
    margin-bottom: 0px; /* Add space between image and text */
    width: 100%; /* Ensure the image container takes full width */
    align-items: flex-end; /* Center image horizontally */

  }

  .project-right {
    width: 100%; /* Ensure the text container takes full width */
    text-align: center; /* Center text for smaller screens */
  }

  .project-right h1,
  .project-right p,
  .project-right a {
    text-align: center; /* Center text for smaller screens */
  }
}

.text-container {
  padding: 20px;
  margin: 20px;
  border-radius: 5px;
}
.dark-mode .text-container {
  border: 1px solid #C8C8C8;
}
.light-mode .text-container {
  border: 1px solid #000000;
}

.tech-icons {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 10px;
}

.tech-icon {
  width: 50px;
  height: 50px;
  margin: 0 10px;
  border-radius: 5px; /* Optional: Add rounded corners to the border */
}
.dark-mode .tech-icon {
  border: 1px solid #C8C8C8; /* Add a border to each icon */
}
.light-mode .tech-icon {
  border: 1px solid #000000; /* Add a border to each icon */
}

#icon {
  border: 1px solid #C8C8C8;
}
.light-mode #icon {
  border: 1px solid #000000;
}
/* Default font size for h1 */
h1 {
  font-size: 2em; /* Adjust this value as needed */
}

/* Adjust font size for smaller screens */
@media (max-width: 1200px) {
  h1 {
      font-size: 1.8em; /* Adjust this value as needed */
  }
}

@media (max-width: 992px) {
  h1 {
      font-size: 1.6em; /* Adjust this value as needed */
  }
}

@media (max-width: 768px) {
  .gallery-header {
    padding: 20px 15px;
  }
  
  .gallery-header h1 {
    font-size: 2rem;
  }
  
  .gallery-header p {
    font-size: 1rem;
  }
  
  h1 {
    font-size: 2rem;
  }
}

@media (max-width: 576px) {
  h1 {
      font-size: 1.2em; /* Adjust this value as needed */
  }
}

.background {
  max-width: 1160px; /* Match the filter-controls max-width */
  margin: 0 auto;
}
/* Enhanced Gallery Styling */
.gallery-header {
  text-align: center;
  margin-bottom: 40px;
  position: relative;
}

.gallery-header h1 {
  font-size: 2.5rem;
  margin-bottom: 20px;
  position: relative;
  display: inline-block;
}

.gallery-header h1::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, rgba(120, 120, 220, 0.8), rgba(50, 50, 180, 0.8));
}

.gallery-header p {
  max-width: 700px;
  margin: 0 auto;
  font-size: 1.1rem;
  opacity: 0.8;
}

/* Filter Buttons */
.gallery-filters {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 40px;
  padding: 0 20px;
}

.filter-btn {
  padding: 10px 20px;
  background: transparent;
  border: 2px solid;
  border-radius: 30px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

.dark-mode .filter-btn {
  color: #C8C8C8;
  border-color: #333;
}

.light-mode .filter-btn {
  color: #333;
  border-color: #e0e0e0;
}

.dark-mode .filter-btn:hover, .dark-mode .filter-btn.active {
  background-color: #333;
  border-color: #444;
}

.light-mode .filter-btn:hover, .light-mode .filter-btn.active {
  background-color: #f0f0f0;
  border-color: #ccc;
}

/* Gallery Items */
.gallery:hover {
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.inner a {
  display: block;
  position: relative;
  overflow: hidden;
}

/* Animation Classes */
.fade-in-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Search Container */
.filter-controls .search-container {
  flex: 1;
  margin: 0;
  position: relative;
  transition: box-shadow 0.3s ease;
  min-width: 0;
  max-width: none;
}

.filter-controls .search-container.search-focus {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Improved search input styling */
.filter-controls .search-input {
  width: 100%;
  padding: 8px 10px 8px 30px;
  border-radius: 4px;
  border: 1px solid;
  background-color: transparent;
  font-family: inherit;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  height: 38px;
  box-sizing: border-box;
  background-repeat: no-repeat;
  background-position: 8px center;
  background-size: 16px;
}

.dark-mode .filter-controls .search-input {
  border-color: #444;
  color: #C8C8C8;
  background-color: rgba(30, 30, 30, 0.7);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23C8C8C8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
}

.light-mode .filter-controls .search-input {
  border-color: #ddd;
  color: #000000;
  background-color: rgba(250, 250, 250, 0.7);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
}

.filter-controls .search-input:focus {
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
  outline: none;
}

/* Move search icon to right side for cleaner look */
.filter-controls .search-container::before {
  display: none;
  content: none;
}



/* Responsive Adjustments */
@media (max-width: 900px) {
  .grid-container {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
  }
  
  .gallery-header h1 {
    font-size: 2rem;
  }
}

@media (max-width: 600px) {
  .grid-container {
    grid-template-columns: 1fr;
  }
  
  .gallery-header h1 {
    font-size: 1.8rem;
  }
  
  .gallery-header p {
    font-size: 1rem;
  }
  
  .gallery-filters {
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 10px;
    justify-content: flex-start;
  }
  
  .filter-btn {
    padding: 6px 12px;
    font-size: 13px;
    white-space: nowrap;
  }
}

/* Touch device optimizations */
@media (hover: none) {
  .gallery:hover {
    box-shadow: none;
    transform: none;
  }
  
  .gallery:active {
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
  }
}

/* "No results" message styling */
.no-results-message {
  text-align: center;
  padding: 20px 30px;
  font-size: 1.1rem;
  color: #888;
  grid-column: 1 / -1;
  background-color: rgba(0, 0, 0, 0.03);
  border-radius: 12px;
  margin: 20px auto;
  animation: fadeIn 0.3s ease-in-out;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100px;
  width: fit-content;
  max-width: 500px;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

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

.dark-mode .no-results-message {
  color: #aaa;
  background-color: rgba(255, 255, 255, 0.05);
}

.light-mode .no-results-message {
  color: #666;
  background-color: rgba(0, 0, 0, 0.03);
}

/* Description styling for project cards */
.desc p.date {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 8px;
}

.desc p.description {
  font-size: 0.9rem;
  line-height: 1.4;
  margin-bottom: 0;
}

/* Dark mode styles for description */
.dark-mode .desc p.date {
  color: #aaa;
}

.light-mode .desc p.date {
  color: #777;
}

/* Sorting options styling */
.filter-controls {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  max-width: 1160px;
  margin: 0 auto 20px;
  padding: 0 20px;
  gap: 4px;
  flex-wrap: wrap;
  box-sizing: border-box;
}

.search-container {
  flex: 1;
  margin: 0;
  position: relative;
  min-width: 0;
}

.sort-container {
  display: flex;
  align-items: center;
  white-space: nowrap;
  flex-shrink: 0;
  width: auto;
  min-width: 100px;
}

.sort-select {
  padding: 8px 28px 8px 10px;
  border-radius: 4px;
  border: 1px solid;
  background-color: transparent;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  outline: none;
  width: 100%;
  text-overflow: ellipsis;
  height: 38px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 10px;
}

.filter-controls .tags-toggle {
  height: 38px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.dark-mode .sort-select {
  border-color: #444;
  color: #C8C8C8;
  background-color: rgba(30, 30, 30, 0.7);
  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='%23C8C8C8' d='M6 8.825L1.175 4 2.225 2.95 6 6.725 9.775 2.95 10.825 4 6 8.825z'/%3E%3C/svg%3E");
}

.light-mode .sort-select {
  border-color: #ddd;
  color: #000000;
  background-color: rgba(250, 250, 250, 0.7);
  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='%23000000' d='M6 8.825L1.175 4 2.225 2.95 6 6.725 9.775 2.95 10.825 4 6 8.825z'/%3E%3C/svg%3E");
}

.sort-select:focus {
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

@media only screen and (max-width: 768px) {
  .filter-controls {
    flex-direction: row;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding-left: 15px;
    padding-right: 15px;
  }
  
  .filter-controls .search-container {
    flex: 1;
    min-width: 0;
  }
  
  .sort-container {
    min-width: 110px;
    width: auto;
  }
  
  .filter-controls .tags-toggle {
    width: auto;
  }
  
  .tags-container, .grid-content {
    padding-left: 15px;
    padding-right: 15px;
    box-sizing: border-box;
    max-width: 1160px;
    margin: 0 auto;
  }
}

@media only screen and (max-width: 480px) {
  .filter-controls {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    padding-left: 10px;
    padding-right: 10px;
  }
  
  .filter-controls .search-container {
    flex: 1 1 100%;
    order: 1;
  }
  
  .sort-container {
    flex: 0 1 calc(50% - 5px);
    min-width: 0;
    order: 2;
  }
  
  .filter-controls .tags-toggle {
    flex: 0 1 calc(50% - 5px);
    min-width: 0;
    order: 3;
    margin-left: 0;
    justify-content: center;
  }
  
  .tags-container, .grid-content {
    padding-left: 10px;
    padding-right: 10px;
    box-sizing: border-box;
    max-width: 1160px;
    margin: 0 auto;
  }
}

/* Tags system styling with improved layout */
.tags-container {
  max-width: 1160px;
  margin: 0 auto 15px;
  padding: 0 20px;
  box-sizing: border-box;
}

.tags-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 10px;
  padding-right: 0; /* Remove any right padding */
}

.tags-header h3 {
  display: none;
}

/* Tags toggle button styling */
.tags-toggle {
  font-size: 0.9rem;
  background-color: transparent;
  border: 1px solid;
  color: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 4px;
  transition: all 0.2s ease;
  height: 38px;
  box-sizing: border-box;
}

.dark-mode .tags-toggle {
  border-color: #444;
  background-color: rgba(30, 30, 30, 0.7);
}

.light-mode .tags-toggle {
  border-color: #ddd;
  background-color: rgba(250, 250, 250, 0.7);
}

.tags-toggle:hover {
  background-color: rgba(99, 102, 241, 0.15);
}

.tags-toggle svg {
  width: 16px;
  height: 16px;
  margin-left: 5px;
  transition: transform 0.3s ease;
}

.tags-toggle.collapsed svg {
  transform: rotate(180deg);
}

.tags-wrapper {
  max-height: 180px;
  overflow-y: auto;
  opacity: 1;
  border-radius: 4px;
  scrollbar-width: thin;
  position: relative;
  transition: all 0.3s ease;
}

.tags-wrapper::-webkit-scrollbar {
  width: 5px;
}

.tags-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.tags-wrapper::-webkit-scrollbar-thumb {
  background-color: rgba(99, 102, 241, 0.4);
  border-radius: 3px;
}

.tags-wrapper.collapsed {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
}

.tags-search {
  display: none; /* Hide the search container */
}

.tags-search-input-container {
  flex: 1;
  position: relative;
  min-width: 0;
}

.tags-search input {
  width: 100%;
  padding: 6px 30px 6px 12px;
  border: 1px solid;
  border-radius: 4px;
  background-color: transparent;
  color: inherit;
  font-family: inherit;
  font-size: 0.85rem;
  transition: all 0.3s ease;
  box-sizing: border-box;
  outline: none;
  height: 32px;
}

/* Move search icon to right side for consistent look */
.tags-search-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  opacity: 0.6;
}

.dark-mode .tags-search input {
  border-color: #444;
  background-color: rgba(30, 30, 30, 0.7);
}

.light-mode .tags-search input {
  border-color: #ddd;
  background-color: rgba(250, 250, 250, 0.7);
}

.tags-search input:focus {
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 5px 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  user-select: none;
  border: 1px solid;
  background-color: rgba(99, 102, 241, 0.05);
  transition: all 0.3s ease;
}

.dark-mode .tag {
  border-color: rgba(100, 100, 100, 0.5);
  background-color: rgba(50, 50, 50, 0.5);
  color: rgba(220, 220, 220, 0.9);
}

.light-mode .tag {
  border-color: rgba(180, 180, 180, 0.5);
  background-color: rgba(240, 240, 240, 0.5);
  color: rgba(60, 60, 60, 0.9);
}

.tag:hover {
  background-color: rgba(99, 102, 241, 0.15);
}

.tag.active {
  background-color: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.4);
}

.dark-mode .tag.active {
  background-color: rgba(99, 102, 241, 0.25);
  color: rgba(240, 240, 240, 0.95);
  border-color: rgba(130, 130, 200, 0.4);
}

.light-mode .tag.active {
  background-color: rgba(99, 102, 241, 0.15);
  color: rgba(50, 50, 50, 0.95);
  border-color: rgba(99, 102, 241, 0.3);
}

.tag-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 0.7rem;
  border-radius: 50%;
  margin-left: 6px;
  background-color: rgba(99, 102, 241, 0.2);
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 15px;
  padding: 10px;
  border-radius: 8px;
  background-color: rgba(99, 102, 241, 0.05);
  align-items: center;
  transition: all 0.3s ease;
  max-height: 200px;
  min-height: 44px;
  overflow: hidden;
  opacity: 1;
  width: 100%;
  transform: translateY(0);
}

.active-filters.hidden {
  max-height: 0;
  min-height: 0;
  opacity: 0;
  margin-top: 0;
  padding-top: 0;
  padding-bottom: 0;
  pointer-events: none;
  border: none;
  transform: translateY(-10px);
}

.active-filters span {
  font-size: 0.85rem;
  margin-right: 5px;
  opacity: 1;
  transition: opacity 0.3s ease;
  flex-shrink: 0;
}

.active-filters .filter-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 15px;
  font-size: 0.8rem;
  background-color: rgba(99, 102, 241, 0.15);
  color: inherit;
  transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
  opacity: 1;
  transform: translateX(0);
  margin: 0 2px;
  will-change: opacity, transform;
}

.active-filters .filter-tag.new-tag {
  opacity: 0;
  transform: translateX(-20px);
}

.active-filters .filter-tag.removing {
  opacity: 0;
  transform: translateX(20px);
  pointer-events: none;
}

.filter-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 15px;
  font-size: 0.8rem;
  background-color: rgba(99, 102, 241, 0.15);
  color: inherit;
  transition: all 0.3s ease;
  opacity: 1;
  transform: translateX(0);
}

.filter-tag button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 5px;
  padding: 0;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.filter-tag button:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.filter-tag.new-tag {
  opacity: 0;
  transform: translateX(-20px);
}

.filter-tag.removing {
  opacity: 0;
  transform: translateX(20px);
  pointer-events: none;
}

.clear-all-filters {
  margin-left: auto;
  background: none;
  border: none;
  color: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.clear-all-filters:hover {
  background-color: rgba(99, 102, 241, 0.1);
}

/* Active filters container animation */
.active-filters {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.no-results-message {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Project tag badges */
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.project-tag {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 10px;
  color: inherit;
}

.dark-mode .project-tag {
  background-color: rgba(60, 60, 60, 0.6);
  color: rgba(220, 220, 220, 0.9);
}

.light-mode .project-tag {
  background-color: rgba(230, 230, 230, 0.6);
  color: rgba(60, 60, 60, 0.9);
}

/* Filter bar heading */
.filter-bar-title {
  display: none;
}

/* Remove conflicting responsive media queries */
/* End of responsive styles */

/* Add fluid transitions for window resizing */
.grid-container, .grid-content, .responsive, .scrollable-gallery {
  transition: all 0.3s ease-in-out;
}

/* Tag highlight effects */
.tag.search-highlight {
  transform: scale(1.05);
  z-index: 1;
}

.dark-mode .tag.search-highlight {
  background-color: rgba(130, 130, 220, 0.4);
  border-color: rgba(130, 130, 220, 0.6);
}

.light-mode .tag.search-highlight {
  background-color: rgba(99, 102, 241, 0.25);
  border-color: rgba(99, 102, 241, 0.5);
}

.tag.tag-click {
  animation: tag-pulse 0.3s ease;
}

@keyframes tag-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* Matched items highlight */
.gallery.search-match {
  position: relative;
}

.dark-mode .responsive.search-match .gallery {
  box-shadow: 0 0 0 2px rgba(130, 130, 220, 0.4);
}

.light-mode .responsive.search-match .gallery {
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.4);
}

/* Filter tag animations */
.filter-tag {
  transition: all 0.3s ease;
}

.filter-tag.new-tag {
  opacity: 0;
  transform: translateX(-20px);
}

.filter-tag.removing {
  opacity: 0;
  transform: translateX(20px);
  pointer-events: none;
}

/* Active filters container animation */
.active-filters {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.no-results-message {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.tag.clear-tags-btn {
  background-color: rgba(255, 100, 100, 0.15);
  cursor: pointer;
  display: flex; /* Always in the layout */
  margin-left: auto;
  border-color: rgba(255, 100, 100, 0.3);
  opacity: 0; /* Hidden by default */
  transform: scale(0.8);
  max-width: 0;
  overflow: hidden;
  padding: 4px 0;
  transition: all 0.3s ease-in-out;
  white-space: nowrap;
}

.tag.clear-tags-btn.visible {
  opacity: 1;
  transform: scale(1);
  max-width: 200px;
  padding: 4px 10px;
}

.dark-mode .tag.clear-tags-btn {
  background-color: rgba(255, 100, 100, 0.2);
  color: rgba(240, 240, 240, 0.95);
  border-color: rgba(255, 100, 100, 0.4);
}

.light-mode .tag.clear-tags-btn {
  background-color: rgba(255, 100, 100, 0.15);
  color: rgba(50, 50, 50, 0.95);
  border-color: rgba(255, 100, 100, 0.3);
}

.tag.clear-tags-btn:hover {
  background-color: rgba(255, 100, 100, 0.25);
}

.tag.clear-tags-btn.visible:hover {
  background-color: rgba(255, 100, 100, 0.35);
}

@media only screen and (max-width: 1200px) {
  .filter-controls, 
  .tags-container, 
  .grid-content,
  .gallery-header {
    max-width: 960px;
    box-sizing: border-box;
    padding-left: 20px;
    padding-right: 20px;
    margin-left: auto;
    margin-right: auto;
  }
  
  .grid-container {
    max-width: 960px;
  }
  
  .scrollable-gallery {
    justify-content: space-between;
  }
  
  .responsive {
    width: 48%;
    max-width: none;
  }
}

@media only screen and (max-width: 768px) {
  .filter-controls, 
  .tags-container, 
  .grid-content,
  .gallery-header {
    max-width: 720px;
    padding-left: 15px;
    padding-right: 15px;
  }
  
  .grid-container {
    max-width: 720px;
  }
  
  .scrollable-gallery {
    justify-content: center;
  }
  
  .responsive {
    width: 100%;
    max-width: 500px;
    padding: 0 10px;
    margin-bottom: 20px;
  }
  
  .filter-controls {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
  }
  
  .search-container {
    flex: 1;
    min-width: 0;
  }
  
  .sort-container {
    min-width: 140px;
    width: auto;
  }
  
  .filter-controls .tags-toggle {
    width: auto;
  }
}

@media only screen and (max-width: 480px) {
  .filter-controls, 
  .tags-container, 
  .grid-content,
  .gallery-header {
    padding-left: 10px;
    padding-right: 10px;
  }
  
  .scrollable-gallery {
    justify-content: center;
  }
  
  .responsive {
    width: 100%;
    max-width: 100%;
    padding: 0;
  }
  
  .filter-controls {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
  }
  
  .search-container {
    flex: 1 1 100%;
    order: 1;
  }
  
  .sort-container {
    flex: 0 1 calc(50% - 5px);
    min-width: 0;
    order: 2;
  }
  
  .filter-controls .tags-toggle {
    flex: 0 1 calc(50% - 5px);
    min-width: 0;
    order: 3;
    margin-left: 0;
    justify-content: center;
  }
  
  .gallery-header {
    padding: 15px 10px;
  }
  
  .gallery-header h1 {
    font-size: 1.8rem;
  }
  
  .gallery-header p {
    font-size: 0.9rem;
  }
}

/* Ensure everything aligns correctly by matching padding */
.filter-controls, 
.tags-container, 
.grid-content, 
.gallery-header {
  max-width: 1160px;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}
