:root {
  --primary-color: #4f7495;
  --secondary-color: #3a0ca3;
  --light-color: #f8f9fa;
  --dark-color: #212529;
  --card-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
  --hover-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
  --transition: all 0.3s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--dark-color);
  line-height: 1.6;
  padding: 0;
  background: linear-gradient(105deg,#FFDF99 ,#CC8C00);	
/*background: linear-gradient(105deg,#fff9ed ,#ad996f);*/
/*background: linear-gradient(90deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);*/
/*background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);*/
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

header {
  text-align: center;
  margin-bottom: 30px;
  padding: 15px;
}

h1 {
  font-size: 2.6rem;
  margin-bottom: 8px;
  color: #212529;
  position: relative;
  display: inline-block;
}

.subtitle {
  font-size: 1.1rem;
  color: #6c757d;
  margin-bottom: 20px;
}

/* ==================== CONTROLES Y FILTROS ==================== */
.controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  flex-wrap: wrap;
  gap: 15px;
}

.search-box {
  position: relative;
  flex-grow: 1;
  max-width: 400px;
}

.search-box input {
  width: 100%;
  padding: 10px 20px 10px 45px;
  border: none;
  border-radius: 50px;
  background: white;
  box-shadow: var(--card-shadow);
  font-size: 0.95rem;
  transition: var(--transition);
}

.search-box input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.3);
}

.search-box i {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: #6c757d;
  font-size: 0.9rem;
}

.right-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.view-toggle {
  background: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--card-shadow);
  cursor: pointer;
  transition: var(--transition);
  color: #495057;
}

.view-toggle.active {
  background: var(--primary-color);
  color: white;
}

/* 🔧 FILTROS – AHORA TOTALMENTE RESPONSIVOS */
.filter-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;           /* ← Permite múltiples filas */
  justify-content: center;   /* ← Centra visualmente */
  min-width: 0;
}

.filter-btn {
  padding: 8px 18px;
  background: white;
  border: none;
  border-radius: 50px;
  box-shadow: var(--card-shadow);
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
  font-size: 0.9rem;
  /* Hace que los botones sean adaptables */
  flex: 1 1 auto;
  min-width: 70px;
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filter-btn.active {
  background: var(--primary-color);
  color: white;
}

/* ==================== VISTA DE CUADRÍCULA ==================== */
.projects-grid:not(.list-view) {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 15px;
}

.projects-grid:not(.list-view) .project-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: var(--transition);
  position: relative;
  display: flex;
  flex-direction: column;
}

.projects-grid:not(.list-view) .project-image {
  height: 100px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.projects-grid:not(.list-view) .project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.projects-grid:not(.list-view) .project-image i {
  font-size: 2.8rem;
  color: rgba(255, 255, 255, 0.85);
}

.projects-grid:not(.list-view) .project-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(8px);
  color: white;
  padding: 3px 8px;
  border-radius: 16px;
  font-size: 0.7rem;
  font-weight: 600;
}

.projects-grid:not(.list-view) .project-content {
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.projects-grid:not(.list-view) .project-title {
  font-size: 1rem;
  margin-bottom: 4px;
  color: var(--dark-color);
  font-weight: 600;
}

.projects-grid:not(.list-view) .project-description {
  color: #6c757d;
  font-size: 0.8rem;
  line-height: 1.4;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.projects-grid:not(.list-view) .project-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 14px;
  font-size: 0.85rem;
  background: #4f7495;
  color: white;
  text-decoration: none;
  border-radius: 50px;
  font-weight: 500;
  transition: var(--transition);
  margin-top: auto;
}

.projects-grid:not(.list-view) .project-link:hover {
  background: var(--secondary-color);
  transform: scale(1.03);
}

.projects-grid:not(.list-view) .project-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--hover-shadow);
}

/* ==================== VISTA DE LISTA ==================== */
.projects-grid.list-view {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.projects-grid.list-view .project-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: var(--transition);
  position: relative;
  display: flex;
  align-items: center;
  padding: 0;
}

.projects-grid.list-view .project-image {
  width: 50px;
  height: 100%;
  border-radius: 8px 0 0 8px;
  position: relative;
  display: grid;
  place-items: center; /* Centrado perfecto, sin baseline */
  flex-shrink: 0;
  margin-right: 10px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.projects-grid.list-view .project-image i {
  font-size: 1.6rem;
  color: white;
  line-height: 1; /* ← Elimina espacio tipográfico extra */
}




.projects-grid.list-view .project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}





.projects-grid.list-view .project-badge {
  display: none;
}

.projects-grid.list-view .project-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 8px 12px;
}

.projects-grid.list-view .project-info {
  flex-grow: 1;
  margin-right: 16px;
}

.projects-grid.list-view .project-title {
  font-size: 0.95rem;
  margin-bottom: 4px;
  font-weight: 600;
  color: var(--dark-color);
}

.projects-grid.list-view .project-description {
  font-size: 0.75rem;
  color: #6c757d;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.projects-grid.list-view .project-link {
  white-space: nowrap;
  padding: 4px 10px;
  font-size: 0.75rem;
  background: #4f7495;
  color: white;
  border-radius: 20px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  margin-left: auto;
}

.projects-grid.list-view .project-link:hover {
  background: var(--secondary-color);
  transform: scale(1.02);
}

.projects-grid.list-view .project-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--hover-shadow);
}

/* ==================== ESTILOS COMUNES ==================== */
.empty-state {
  text-align: center;
  padding: 50px 20px;
  grid-column: 1 / -1;
}

.empty-state i {
  font-size: 3.5rem;
  color: #dee2e6;
  margin-bottom: 16px;
}

.empty-state h2 {
  color: #6c757d;
  margin-bottom: 8px;
  font-size: 1.4rem;
}

.footer {
  text-align: center;
  padding: 1rem;
  font-size: 14px;
  background-color: #1c1c1c;
  color: #ccc;
  width: 100%;
  bottom: 0;
  left: 0;
  position: fixed;
}

.footer span {
  color: #bb6060;
  font-weight: 600;
}

.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 180px;
  grid-column: 1 / -1;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(67, 97, 238, 0.2);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  animation: spin 1s linear infinite;
}

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

/* ==================== RESPONSIVO ==================== */
@media (max-width: 1200px) {
  .projects-grid:not(.list-view) {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 900px) {
  .projects-grid:not(.list-view) {
    grid-template-columns: repeat(3, 1fr);
  }
  .projects-grid.list-view {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .controls {
    flex-direction: column;
    align-items: stretch;
  }
  .search-box {
    max-width: 100%;
  }
  .right-controls {
    justify-content: center;
  }
  h1 {
    font-size: 2.1rem;
  }
  .projects-grid.list-view {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .projects-grid:not(.list-view) {
    grid-template-columns: 1fr;
  }
  h1 {
    font-size: 1.8rem;
  }
  .container {
    padding: 15px;
  }
  .project-link span {
    display: none;
  }

  /* 🔧 Ajuste extra para filtros en móviles pequeños */
  .filter-btn {
    min-width: 60px;
    padding: 8px 12px;
    font-size: 0.85rem;
  }
}

.search-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 10vh;
  width: 100%;
}

/* Mejora en dispositivos en apaisado o pantallas estrechas pero anchas */
@media (max-width: 900px) and (min-width: 500px) {
  .projects-grid.list-view .project-image {
    width: 60px;
    height: 66px;
  }
  .projects-grid.list-view .project-image i {
    font-size: 1.5rem;
  }
}