/* Zmienne CSS dla strony projektów */
:root {
  --primary: #00d1b2;
  --primary-light: rgba(0, 209, 178, 0.1);
  --primary-hover: #00bea5;
  --primary-dark: #00a896;
  --text-dark: #2c3e50;
  --text-light: #6c757d;
  --bg-light: #f8f9fa;
  --bg-dark: #1e2a38;
  --card-light: #ffffff;
  --card-dark: #2d3748;
  --border-light: #e9ecef;
  --border-dark: #4a5568;
  --shadow-light: 0 2px 10px rgba(0, 0, 0, 0.1);
  --shadow-dark: 0 2px 10px rgba(0, 0, 0, 0.3);
  --transition: 0.25s ease;
  --radius: 8px;
  --header-height: 70px; /* Added variable for header height */
}

/* Base styles */
body {
  font-family: "Poppins", sans-serif;
  color: var(--text-dark);
  background: var(--bg-light);
  line-height: 1.6;
  overflow-x: hidden; /* Prevent horizontal scrolling */
  width: 100%;
}

body.dark-theme {
  color: #f1f1f1;
  background: var(--bg-dark);
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
  box-sizing: border-box; /* Ensure padding is included in width */
}

.projects-page {
  padding-top: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* Simple hero section - FIXED to prevent navigation overlap */
.projects-hero {
  background: linear-gradient(135deg, #00d1b2 0%, #2c3e50 100%);
  padding: 120px 0 50px; /* Increased top padding from 100px to 120px */
  margin-top: 0; /* Removed negative margin that was causing overlap */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  color: white;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
  position: relative;
}

.projects-hero-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
}

.projects-title {
  font-size: 3.2rem;
  font-weight: 700;
  margin-bottom: 15px;
}

.projects-description {
  font-size: 1.2rem;
  opacity: 0.9;
  max-width: 700px;
  margin: 0 auto;
}

/* Main content layout */
.projects-content {
  padding: 40px 0;
  flex: 1;
  width: 100%;
  box-sizing: border-box;
}

.projects-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 30px;
  align-items: start;
}

/* Sidebar styles */
.projects-sidebar {
  background: var(--card-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-light);
  padding: 25px;
  position: sticky;
  top: 90px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

body.dark-theme .projects-sidebar {
  background: var(--card-dark);
  box-shadow: var(--shadow-dark);
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.sidebar-header h2 {
  font-size: 1.4rem;
  font-weight: 600;
}

.sidebar-close-mobile {
  display: none;
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--text-light);
  cursor: pointer;
}

body.dark-theme .sidebar-close-mobile {
  color: #cbd5e0;
}

.sidebar-section {
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
}

body.dark-theme .sidebar-section {
  border-bottom-color: var(--border-dark);
}

.sidebar-section:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.sidebar-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 15px;
  color: var(--text-dark);
}

body.dark-theme .sidebar-title {
  color: #f1f1f1;
}

/* Filter list */
.filter-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-dark);
  transition: var(--transition);
  text-align: left;
}

body.dark-theme .filter-item {
  color: #cbd5e0;
}

.filter-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.filter-item.active {
  background: var(--primary);
  color: white;
  font-weight: 500;
}

.filter-count {
  display: inline-block;
  background: rgba(0, 0, 0, 0.1);
  color: inherit;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 0.8rem;
  min-width: 24px;
  text-align: center;
  transition: var(--transition);
}

body.dark-theme .filter-count {
  background: rgba(255, 255, 255, 0.1);
}

.filter-item.active .filter-count {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

/* Sort options */
.sort-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sort-option {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: var(--text-dark);
  font-size: 0.9rem;
}

body.dark-theme .sort-option {
  color: #cbd5e0;
}

.sort-option input {
  accent-color: var(--primary);
}

.sort-option:hover {
  color: var(--primary);
}

/* Layout options */
.layout-options {
  display: flex;
  gap: 10px;
}

.layout-option {
  flex: 1;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--text-dark);
  transition: var(--transition);
}

body.dark-theme .layout-option {
  border-color: var(--border-dark);
  color: #cbd5e0;
}

.layout-option:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-light);
}

.layout-option.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Sidebar footer */
.sidebar-footer {
  margin-top: 25px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

body.dark-theme .sidebar-footer {
  border-top-color: var(--border-dark);
}

.back-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
}

.back-link:hover {
  color: var(--primary-hover);
  transform: translateX(-5px);
}

/* Main content area */
.projects-main {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.projects-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.projects-header h2 {
  font-size: 1.4rem;
  font-weight: 600;
}

.projects-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.toggle-filters-mobile {
  display: none;
  background: var(--primary);
  color: white;
  border: none;
  padding: 8px 15px;
  border-radius: 20px;
  font-size: 0.9rem;
  cursor: pointer;
  gap: 8px;
  align-items: center;
  transition: var(--transition);
  color: #000000; /* Explicitly set color to black for light theme */
}

.toggle-filters-mobile i {
  color: #000000; /* Ensure the icon is also black in light theme */
}

body.dark-theme .toggle-filters-mobile,
body.dark-theme .toggle-filters-mobile i {
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

.toggle-filters-mobile:hover {
  background: var(--primary-hover);
}

/* No results message */
.no-results {
  background: var(--card-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-light);
  padding: 40px;
  text-align: center;
  display: none;
}

body.dark-theme .no-results {
  background: var(--card-dark);
  box-shadow: var(--shadow-dark);
}

.no-results-icon {
  font-size: 3rem;
  color: var(--primary);
  margin-bottom: 15px;
  opacity: 0.7;
}

.no-results h3 {
  font-size: 1.5rem;
  margin-bottom: 10px;
}

.no-results p {
  color: var(--text-light);
  margin-bottom: 20px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

body.dark-theme .no-results p {
  color: #cbd5e0;
}

.reset-filters {
  background: var(--primary);
  color: white;
  border: none;
  padding: 8px 20px;
  border-radius: 20px;
  font-weight: 500;
  cursor: pointer;
  transition: var (--transition);
}

.reset-filters:hover {
  background: var(--primary-hover);
}

/* Projects grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 25px;
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

/* Special handling for featured project layout */
.projects-grid.has-featured {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.projects-grid.has-featured .project-card.featured:not(.hidden) {
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  min-height: auto; /* Remove fixed min-height */
}

/* Standard layout without featured project */
.projects-grid:not(.has-featured) .project-card.featured:not(.hidden) {
  grid-column: span 1;
  display: flex;
  flex-direction: column;
  grid-template-columns: 1fr;
}

.projects-grid:not(.has-featured)
  .project-card.featured:not(.hidden)
  .project-image {
  height: 200px;
}

/* List view styles */
.projects-grid.list-layout {
  grid-template-columns: 1fr;
}

/* Mobile responsiveness for Projects Grid */
@media (max-width: 992px) {
  .projects-grid.has-featured .project-card.featured:not(.hidden) {
    grid-column: span 2;
    grid-template-columns: 1fr;
    display: flex;
    flex-direction: column;
  }
}

@media (max-width: 768px) {
  /* Projects grid for mobile */
  .projects-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  /* Featured project should be full width on mobile */
  .projects-grid.has-featured .project-card.featured:not(.hidden) {
    grid-column: span 1;
    display: flex;
    flex-direction: column;
  }

  /* All projects in single column on mobile */
  .projects-grid.list-layout {
    grid-template-columns: 1fr;
  }

  /* Mobile sidebar handling */
  .projects-sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 80%;
    max-width: 300px;
    height: 100%;
    background: #fff;
    z-index: 1000;
    transition: left 0.3s ease;
    box-shadow: none;
    padding: 20px;
    overflow-y: auto;
  }

  body.dark-theme .projects-sidebar {
    background: #2d3748;
  }

  .projects-sidebar.active {
    left: 0;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
  }

  .sidebar-close-mobile {
    display: block;
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #666;
    cursor: pointer;
  }

  body.dark-theme .sidebar-close-mobile {
    color: #e2e8f0;
  }

  /* Mobile filter toggle button */
  .toggle-filters-mobile {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    color: #000000; /* Explicitly set color to black for light theme */
  }

  .toggle-filters-mobile i {
    color: #000000; /* Ensure the icon is also black in light theme */
  }

  body.dark-theme .toggle-filters-mobile {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
  }

  /* Project card styles for mobile */
  .project-card {
    width: 100%;
  }

  .project-image {
    height: 180px;
  }

  .project-content {
    padding: 15px;
  }

  .project-categories {
    flex-wrap: wrap;
    margin-bottom: 8px;
  }

  .project-category {
    margin-bottom: 4px;
  }

  .project-title {
    font-size: 1.1rem;
    margin-bottom: 8px;
  }

  .project-description {
    font-size: 0.95rem;
    margin-bottom: 12px;
  }

  .project-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  /* Fix for mobile layout - force single column */
  .projects-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 15px;
  }

  /* Ensure each project card spans the full width */
  .project-card,
  .projects-grid .project-card,
  .projects-grid.has-featured .project-card {
    width: 100% !important;
    max-width: 100% !important;
    grid-column: 1 !important;
    margin-bottom: 15px;
  }

  /* Featured project should also be full width on mobile */
  .projects-grid.has-featured .project-card.featured:not(.hidden) {
    grid-column: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
  }

  /* Remove any existing grid spans */
  .project-card.featured,
  .project-card.featured:not(.hidden) {
    grid-column: 1 !important;
  }

  /* Force proper layout for all views */
  .projects-grid.list-layout,
  .projects-grid:not(.list-layout) {
    grid-template-columns: 1fr !important;
  }
}

/* Extra small screens */
@media (max-width: 480px) {
  .projects-hero {
    padding: 80px 15px 40px;
  }

  .projects-title {
    font-size: 2rem;
  }

  .projects-description {
    font-size: 1rem;
  }

  .projects-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .projects-sidebar {
    width: 90%;
    padding: 15px;
  }

  .sidebar-section {
    padding: 12px 0;
  }

  .pagination {
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }
}

/* Project card styles */
.project-card {
  background: var(--card-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-light);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid var(--border-light);
}

body.dark-theme .project-card {
  background: var(--card-dark);
  box-shadow: var(--shadow-dark);
  border-color: var(--border-dark);
}

.project-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

body.dark-theme .project-card:hover {
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.project-card.hidden {
  display: none !important;
  opacity: 0;
  transform: translateY(20px);
}

.project-image {
  position: relative;
  height: 200px;
  overflow: hidden;
}

.project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.project-card:hover .project-image img {
  transform: scale(1.05);
}

.project-badge {
  position: absolute;
  top: 15px;
  left: 15px;
  background: var(--primary);
  color: white;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  z-index: 1;
}

.project-content {
  padding: 20px;
}

.project-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.project-category {
  background: var(--primary-light);
  color: var(--primary);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}

.project-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-dark);
}

body.dark-theme .project-title {
  color: #f1f1f1;
}

.project-description {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 15px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

body.dark-theme .project-description {
  color: #cbd5e0;
}

.project-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid var(--border-light);
}

body.dark-theme .project-meta {
  border-top-color: var(--border-dark);
}

.project-date {
  color: var(--text-light);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 5px;
}

body.dark-theme .project-date {
  color: #cbd5e0;
}

.project-link {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: var(--transition);
}

.project-link:hover {
  color: var(--primary-hover);
}

.project-link i {
  transition: transform 0.2s ease;
}

.project-link:hover i {
  transform: translateX(4px);
}

/* Featured project */
.project-card.featured {
  overflow: hidden;
  border-radius: var(--radius);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(0, 209, 178, 0.2);
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.03),
    rgba(0, 209, 178, 0.05)
  );
}

body.dark-theme .project-card.featured {
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
  border-color: rgba(0, 209, 178, 0.3);
  background: linear-gradient(
    145deg,
    rgba(45, 55, 72, 0.6),
    rgba(30, 42, 56, 0.8)
  );
}

.project-card.featured .project-image {
  position: relative;
  overflow: hidden;
  height: 250px; /* Further reduced from 280px to 250px */
  width: 100%;
}

/* Add a gradient overlay that's always visible to help integrate with content */
.image-gradient-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 60%;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.7));
  z-index: 1;
}

.project-card.featured .project-badge {
  position: absolute;
  top: 20px;
  left: 20px;
  background: var(--primary);
  color: white;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  border-radius: 20px;
  z-index: 2;
}

.project-card.featured .project-overlay {
  background: rgba(0, 0, 0, 0.5); /* Semi-transparent overlay */
  z-index: 2;
}

.project-card.featured .overlay-link {
  padding: 14px 28px;
  font-size: 1.1rem;
}

.project-card.featured .project-content {
  padding: 20px; /* Reduced from 35px to 20px */
  position: relative;
  z-index: 3;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.03),
    rgba(0, 209, 178, 0.07)
  );
}

body.dark-theme .project-card.featured .project-content {
  background: linear-gradient(
    to bottom,
    rgba(45, 55, 72, 0.7),
    rgba(30, 42, 56, 0.9)
  );
}

.project-card.featured .project-header {
  position: relative;
  margin-bottom: 15px; /* Reduced from 25px to 15px */
  text-align: center;
}

.project-card.featured .project-header::after {
  content: "";
  position: absolute;
  bottom: -8px; /* Adjusted from -10px to -8px */
  left: 50%;
  transform: translateX(-50%);
  width: 60px; /* Reduced from 80px to 60px */
  height: 3px;
  background: var(--primary);
  border-radius: 2px;
}

.project-card.featured .project-title {
  font-size: 1.25rem; /* Reduced from 1.8rem to match regular projects */
  margin: 10px 0; /* Reduced margin from 15px to 10px */
  color: var(--text-dark);
  line-height: 1.3;
  font-weight: 700; /* Keeping it bold for emphasis */
}

body.dark-theme .project-card.featured .project-title {
  color: #fff;
}

.project-card.featured .project-description {
  font-size: 0.95rem; /* Reduced from 1.1rem to be closer to regular projects */
  line-height: 1.5; /* Reduced from 1.6 */
  margin-bottom: 15px; /* Reduced from 25px */
  color: var(--text-light);
}

body.dark-theme .project-card.featured .project-description {
  color: rgba(255, 255, 255, 0.8);
}

/* Enhanced categories for featured projects */
.project-card.featured .project-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.project-card.featured .project-category {
  background: rgba(0, 209, 178, 0.15);
  color: var(--primary);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

body.dark-theme .project-card.featured .project-category {
  background: rgba(0, 209, 178, 0.2);
  color: rgba(255, 255, 255, 0.9);
}

/* Enhanced meta section */
.project-card.featured .project-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 15px; /* Reduced from 25px */
  padding-top: 15px; /* Reduced from 25px */
  border-top: 1px solid rgba(0, 209, 178, 0.2);
}

.project-card.featured .project-date {
  font-size: 0.95rem;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

body.dark-theme .project-card.featured .project-date {
  color: rgba(255, 255, 255, 0.7);
}

.project-card.featured .project-link {
  padding: 10px 20px;
  background: var(--primary-light);
  border-radius: 20px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.project-card.featured .project-link:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 209, 178, 0.3);
}

/* List view styles */
.projects-grid.list-layout .project-card {
  display: grid;
  grid-template-columns: 250px 1fr;
  grid-column: 1 / -1;
}

.projects-grid.list-layout .project-card.featured {
  grid-template-columns: 350px 1fr;
}

.projects-grid.list-layout .project-content {
  display: flex;
  flex-direction: column;
}

.projects-grid.list-layout .project-description {
  flex-grow: 1;
  -webkit-line-clamp: 2;
}

/* Enhanced pagination styling */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 40px;
}

.pagination-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border-light);
  color: var (--text-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

body.dark-theme .pagination-button {
  border-color: var(--border-dark);
  color: #cbd5e0;
}

.pagination-button:hover:not([disabled]) {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.pagination-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination-pages {
  display: flex;
  gap: 8px;
}

.pagination-page {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-dark);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

body.dark-theme .pagination-page {
  border-color: var(--border-dark);
  color: #cbd5e0;
}

.pagination-page:hover {
  background: var (--primary-light);
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.pagination-page.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 5px 15px rgba(0, 209, 178, 0.3);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  margin-top: 30px;
}

.pagination-button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border-light);
  color: var (--text-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

body.dark-theme .pagination-button {
  border-color: var(--border-dark);
  color: #cbd5e0;
}

.pagination-button:hover:not([disabled]) {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-light);
}

.pagination-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination-pages {
  display: flex;
  gap: 5px;
}

.pagination-page {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var (--border-light);
  color: var (--text-dark);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

body.dark-theme .pagination-page {
  border-color: var (--border-dark);
  color: #cbd5e0;
}

.pagination-page:hover {
  background: var(--primary-light);
  color: var (--primary);
  border-color: var (--primary-light);
}

.pagination-page.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Notification */
.notification {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--card-dark);
  color: white;
  padding: 10px 20px;
  border-radius: 25px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  z-index: 100;
  font-size: 0.9rem;
}

.notification.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Back to top button */
#back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  border: none;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
  z-index: 100;
}

#back-to-top.visible {
  opacity: 1;
}

#back-to-top:hover {
  background: var(--primary-hover);
  transform: translateY(-5px);
}

/* Fix for mobile navigation menu */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  height: var(--header-height);
}

.nav-toggle {
  background: transparent;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  display: none; /* Hidden by default, shown in mobile view */
  z-index: 1010;
}

/* Media queries - IMPROVED for better mobile layout */
@media (max-width: 992px) {
  .projects-grid.list-layout .project-card,
  .projects-grid.list-layout .project-card.featured {
    grid-template-columns: 200px 1fr;
  }

  .projects-card.featured {
    grid-column: span 1;
    grid-template-columns: 1fr;
  }

  .project-card.featured {
    grid-column: span 1; /* Ensure featured card doesn't span multiple columns */
    grid-template-columns: 1fr;
  }

  .projects-grid.has-featured .project-card.featured:not(.hidden) {
    grid-column: span 1;
    grid-template-columns: 1fr;
    display: flex;
    flex-direction: column;
  }

  /* Ensure proper grid display on tablets */
  .projects-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  }

  .project-card.featured .project-image {
    height: 220px; /* Reduced from 250px */
  }
}

@media (max-width: 768px) {
  /* Fixed header height adjustment for mobile */
  .projects-hero {
    padding: 100px 0 40px; /* Adjusted for mobile header */
  }

  .projects-title {
    font-size: 2.5rem;
  }

  .projects-description {
    font-size: 1.1rem;
    padding: 0 10px;
  }

  .projects-layout {
    grid-template-columns: 1fr; /* Single column on mobile */
  }

  /* Improved mobile sidebar behavior */
  .projects-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    max-height: none; /* Reset max-height */
    border-radius: 0; /* Remove border-radius */
  }

  .projects-sidebar.active {
    transform: translateX(0);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
  }

  .sidebar-close-mobile {
    display: block;
  }

  .toggle-filters-mobile {
    display: flex;
  }

  /* Improved grid for mobile */
  .projects-grid {
    grid-template-columns: 1fr; /* Single column for better mobile layout */
    gap: 20px;
    width: 100%;
  }

  .projects-grid.list-layout .project-card,
  .projects-grid.list-layout .project-card.featured {
    grid-template-columns: 1fr;
  }

  .project-card.featured {
    grid-column: span 1;
    grid-template-columns: 1fr;
    display: block; /* Fix for featured project layout */
  }

  /* Improved featured project card for mobile */
  .projects-grid.has-featured .project-card.featured:not(.hidden),
  .project-card.featured:not(.hidden) {
    grid-column: span 1;
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: 1fr !important;
  }

  .project-card.featured .project-image {
    height: 200px; /* Reduced from 220px */
    width: 100%;
    max-height: 250px;
  }

  .project-card.featured .project-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
  }

  .project-card.featured .project-meta {
    margin-top: auto;
  }

  /* Fix for the project categories in mobile view */
  .project-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
  }

  /* Enhance project title visibility on mobile */
  .project-card.featured .project-title {
    font-size: 1.4rem;
    margin-bottom: 10px;
    line-height: 1.3;
  }

  /* Ensure proper display of nav menu on mobile */
  .navbar .nav-menu {
    width: 100%;
    position: absolute;
    top: var(--header-height);
    background-color: rgba(26, 26, 26, 0.95);
    z-index: 999;
    left: 0;
  }

  .navbar .nav-menu.active {
    display: flex !important;
    flex-direction: column;
  }

  /* Ensure filter button is properly visible */
  .toggle-filters-mobile {
    display: inline-flex;
    padding: 8px 15px;
    font-size: 0.9rem;
    align-items: center;
    justify-content: center;
  }

  /* Ensure burger button is visible and clickable */
  .nav-toggle {
    display: block;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
  }

  /* Fix menu display */
  .nav-menu {
    display: none; /* Hidden by default */
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 100%;
    background-color: rgba(26, 26, 26, 0.95);
    z-index: 1000;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
    padding: 20px 0;
    flex-direction: column;
  }

  .nav-menu.active {
    display: flex !important;
  }

  .nav-menu li {
    width: 100%;
    text-align: center;
    margin: 10px 0;
  }

  .nav-menu li a {
    display: inline-block;
    padding: 12px 20px;
    width: 80%;
  }

  /* Prevent scrolling when menu is open */
  body.menu-open {
    overflow: hidden;
  }

  /* Ensure proper spacing for mobile content */
  .container {
    padding: 0 15px;
  }

  .projects-content {
    padding: 30px 0;
  }

  .projects-main {
    gap: 20px;
  }

  /* Ensure project cards fill width on mobile */
  .project-card {
    width: 100%;
    margin: 0 auto;
  }

  /* Fix project card spacing and layout */
  .project-content {
    padding: 15px;
  }

  .projects-grid.list-layout .project-card,
  .projects-grid.list-layout .project-card.featured {
    grid-template-columns: 1fr;
    display: flex;
    flex-direction: column;
  }

  /* Fix mobile layout issues */
  .projects-sidebar {
    width: 250px; /* Slightly narrower for better fit */
    z-index: 2000; /* Higher z-index to ensure it appears above all content */
  }

  /* Fix main content area */
  .projects-main {
    width: 100%;
    padding: 0;
  }

  /* Ensure project cards display properly */
  .projects-grid {
    display: grid;
    grid-template-columns: 1fr; /* Force single column layout */
    gap: 15px;
    width: 100%;
    margin: 0;
  }

  /* Force proper card layout */
  .project-card {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    margin-bottom: 15px;
  }

  /* Fix featured project display */
  .project-card.featured,
  .project-card.featured:not(.hidden),
  .projects-grid.has-featured .project-card.featured:not(.hidden) {
    grid-column: 1 !important;
    grid-template-columns: 1fr !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
  }

  /* Fix image heights for consistent appearance */
  .project-image,
  .project-card.featured .project-image {
    height: 180px !important;
    width: 100% !important;
  }

  /* Ensure proper content padding */
  .project-content {
    padding: 15px !important;
  }

  /* Improve meta layout for mobile */
  .project-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  /* Make project links more touch-friendly */
  .project-link {
    width: 100%;
    justify-content: center;
    padding: 12px 0;
    min-height: 44px;
    border-radius: var(--radius);
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 500;
  }

  .project-link:hover,
  .project-link:active {
    background: var(--primary);
    color: white;
  }

  /* Fix grid container */
  .projects-grid.list-layout .project-card,
  .projects-grid.list-layout .project-card.featured {
    grid-template-columns: 1fr !important;
    display: flex !important;
    flex-direction: column !important;
  }

  /* Ensure proper container padding */
  .container {
    padding: 0 15px;
  }

  /* Fix pagination for mobile */
  .pagination {
    padding: 15px 0;
  }

  .project-card.featured .project-image {
    height: 200px; /* Reduced from 220px */
  }
}

@media (max-width: 576px) {
  .projects-hero {
    padding: 90px 0 30px; /* Further adjusted for smaller screens */
  }

  .projects-title {
    font-size: 2rem;
  }

  .projects-description {
    font-size: 1rem;
    padding: 0 15px;
  }

  .project-image {
    height: 180px;
  }

  .project-content {
    padding: 15px;
  }

  .project-title {
    font-size: 1.1rem;
  }

  .project-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .project-link {
    width: 100%;
    justify-content: center;
    padding: 8px 0;
    border-radius: var(--radius);
    background: var(--primary-light);
    color: var(--primary);
  }

  .project-link:hover {
    background: var(--primary);
    color: white;
  }

  /* Further adjustments for small mobile screens */
  .project-card.featured .project-image {
    height: 200px;
  }

  .project-card.featured .project-title {
    font-size: 1.3rem;
  }

  .project-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .project-link {
    width: 100%;
    justify-content: center;
    padding: 10px 0;
    border-radius: var(--radius);
    background: var(--primary-light);
    color: var(--primary);
    text-align: center;
    font-weight: 500;
  }

  .project-link:hover {
    background: var(--primary);
    color: white;
  }

  /* Better mobile navigation */
  .navbar {
    padding: 0 10px;
  }

  .logo {
    max-width: 140px;
  }

  /* Ensure proper spacing for projects main area */
  .projects-main {
    padding: 0 5px;
  }

  /* Further optimize for small screens */
  .projects-grid {
    gap: 15px;
  }

  .projects-hero {
    padding: 100px 0 30px;
  }

  .projects-title {
    font-size: 1.8rem;
  }

  .projects-description {
    font-size: 0.9rem;
  }

  .project-image {
    height: 160px;
  }

  .project-title {
    font-size: 1.1rem;
  }

  .project-card.featured .project-image {
    height: 180px;
  }

  /* Ensure touch-friendly links */
  .project-link {
    width: 100%;
    justify-content: center;
    padding: 12px 0; /* Larger touch target */
    min-height: 44px; /* Minimum recommended touch target size */
    border-radius: var(--radius);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
  }

  /* Fix no-results message */
  .no-results {
    padding: 30px 15px;
  }
}

@media (max-width: 400px) {
  .projects-title {
    font-size: 1.8rem;
  }

  .projects-description {
    font-size: 0.9rem;
  }

  .project-image,
  .project-card.featured .project-image {
    height: 160px !important;
  }

  /* Ensure proper touch targets */
  .pagination-button,
  .pagination-page {
    width: 40px;
    height: 40px;
  }
}

/* Fix for mobile device touch handling */
@media (hover: none) {
  .project-card:hover {
    transform: none;
    box-shadow: var(--shadow-light);
  }

  body.dark-theme .project-card:hover {
    box-shadow: var(--shadow-dark);
  }

  .project-link:active {
    background: var(--primary);
    color: white;
  }
}

/* Remove animations on older or less capable devices */
@media (prefers-reduced-motion: reduce) {
  .project-card {
    transition: none;
  }

  .project-card:hover {
    transform: none;
  }

  .project-image img {
    transition: none;
  }

  .project-card:hover .project-image img {
    transform: none;
  }
}

/* Animation classes */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

.fade-in {
  animation: fadeIn 0.5s ease forwards;
}

.slide-in {
  animation: slideIn 0.5s ease forwards;
}

/* Loading state */
.loading {
  opacity: 0.7;
  pointer-events: none;
}

.loading::after {
  content: "";
  display: block;
  width: 30px;
  height: 30px;
  border: 3px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -15px 0 0 -15px;
}

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

/* Mobile menu overlay - added to prevent body scrolling when menu is open */
body.menu-open {
  overflow: hidden;
}

/* Fixed z-index for mobile sidebar to ensure it appears above other elements */
.projects-sidebar {
  z-index: 1001;
}

/* Ensure notification stays above other elements but below sidebar */
.notification {
  z-index: 1000;
}

/* Project overlay for hover effect */
.project-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.project-card:hover .project-overlay {
  opacity: 1;
}

.overlay-content {
  text-align: center;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.project-card:hover .overlay-content {
  transform: translateY(0);
}

.overlay-link {
  display: inline-block;
  background: var(--primary);
  color: white;
  padding: 12px 25px;
  border-radius: 25px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.1rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.overlay-link:hover {
  background: var(--primary-hover);
  transform: scale(1.05);
}

/* Enhanced featured project styling */
.project-card.featured {
  overflow: hidden;
  border-radius: var(--radius);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
  border-color: rgba(0, 209, 178, 0.2);
}

body.dark-theme .project-card.featured {
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
  border-color: rgba(0, 209, 178, 0.3);
}

.project-card.featured .project-image {
  position: relative;
  overflow: hidden;
  height: 250px; /* Taller for featured project */
}

.project-card.featured .project-badge {
  background: var(--primary);
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  left: 20px;
  top: 20px;
}

.project-card.featured .project-content {
  padding: 20px; /* Reduced from 35px to 20px */
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.02),
    rgba(0, 209, 178, 0.03)
  );
}

body.dark-theme .project-card.featured .project-content {
  background: linear-gradient(
    to bottom,
    rgba(45, 55, 72, 0.5),
    rgba(0, 209, 178, 0.05)
  );
}

.project-card.featured .project-title {
  font-size: 1.25rem; /* Reduced from 1.8rem to match regular projects */
  margin: 10px 0; /* Reduced margin from 15px to 10px */
  color: var(--text-dark);
}

body.dark-theme .project-card.featured .project-title {
  color: #fff;
}

.project-card.featured .project-description {
  font-size: 0.95rem; /* Reduced from 1.1rem to be closer to regular projects */
  line-height: 1.5; /* Reduced from 1.6 */
  margin-bottom: 15px; /* Reduced from 25px */
}

/* Enhance project meta section */
.project-card.featured .project-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 15px; /* Reduced from 25px */
  padding-top: 15px; /* Reduced from 25px */
  border-top: 1px solid rgba(0, 209, 178, 0.2);
}

body.dark-theme .project-card.featured .project-meta {
  border-top-color: rgba(0, 209, 178, 0.2);
}

.project-card.featured .project-link {
  padding: 10px 20px;
  background: var(--primary-light);
  border-radius: 20px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.project-card.featured .project-link:hover {
  background: var(--primary);
  color: white;
}

/* Responsive adjustments for featured card */
@media (max-width: 1200px) {
  .project-card.featured .project-image {
    height: 240px; /* Reduced from 280px */
  }
}

@media (max-width: 992px) {
  .project-card.featured .project-image {
    height: 220px; /* Reduced from 250px */
  }
}

@media (max-width: 768px) {
  .project-card.featured .project-image {
    height: 200px; /* Reduced from 220px */
  }
}
