/* Reset and Base Container */
* {
  box-sizing: border-box;
}

.portfolio-container {
  width: 100%;
  max-width: 900px; /* 932px - (2 * 16px padding) */
  margin: 0 auto;
  padding: 16px;
  box-sizing: border-box;
}

/* Filter Section */
.filter-section {
  width: 100%;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: #f8f9fa;
  border-radius: 8px;
  box-sizing: border-box;
}

.filter-group {
  margin-bottom: 1.5rem;
}

.filter-group:last-child {
  margin-bottom: 0;
}

.filter-group-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Tag Styles */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 16px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  user-select: none;
  white-space: nowrap;
}

/* Tag Categories */
.tag[data-category="program"] {
  background: #e3f2fd;
  color: #1565c0;
}

.tag[data-category="type"] {
  background: #e8f5e9;
  color: #2e7d32;
}

.tag[data-category="license"] {
  background: #fff3e0;
  color: #ef6c00;
}

.tag:hover {
  filter: brightness(0.95);
}

.tag.active {
  filter: brightness(0.9);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

/* Portfolio Grid */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  width: 100%;
  box-sizing: border-box;
}

/* Portfolio Items */
.portfolio-item {
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: all 0.2s ease;
  width: 100%;
  box-sizing: border-box;
}

.portfolio-item:hover {
  transform: translateY(-2px);
}

.portfolio-image {
  width: 80px;
  height: 113px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.portfolio-content {
  flex: 1;
  min-width: 0;
}

.portfolio-title {
  margin: 0 0 0.75rem 0;
  font-size: 1.25rem;
  word-wrap: break-word;
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.portfolio-title a {
  color: #2c3e50;
  text-decoration: none;
}

.portfolio-title a:hover {
  text-decoration: underline;
}

.portfolio-description {
  margin: 0 0 1rem 0;
  color: #666;
  line-height: 1.5;
  font-size: 1rem;
}

.portfolio-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Tooltips */
.tooltip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 0.75rem;
  background: #2c3e50;
  color: white;
  border-radius: 4px;
  font-size: 0.8rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 1000;
}

.tooltip::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 8px;
  height: 8px;
  background: #2c3e50;
}

.tag:hover .tooltip {
  opacity: 1;
  visibility: visible;
  bottom: calc(100% + 5px);
}

/* Info Icon and Software Tooltip */
.info-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #64748b;
  font-size: 0.75rem;
  cursor: help;
  flex-shrink: 0;
}

.software-tooltip {
  position: absolute;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
  width: 250px;
  padding: 1rem;
  background: #2c3e50;
  color: white;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: normal;
  line-height: 1.4;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 1000;
  pointer-events: none;
}

/* Hide software tooltip by default */
.software-tooltip {
  display: none;
  opacity: 0;
  visibility: hidden;
}

/* Show software tooltip only on info-icon hover */
.info-icon:hover + .software-tooltip {
  display: block;
  opacity: 1;
  visibility: visible;
}

/* Clear Filters Button */
.clear-filters-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  background: #e2e8f0;
  color: #4a5568;
  border: none;
  border-radius: 4px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.clear-filters-btn:hover {
  background: #cbd5e1;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* Responsive Design */
@media (max-width: 932px) {
  .portfolio-grid {
    width: 100%;
  }
  
  .software-tooltip {
    right: -260px;
    left: auto;
  }
}

@media (max-width: 768px) {
  .portfolio-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .portfolio-item {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .portfolio-tags {
    justify-content: center;
  }
  
  .portfolio-title {
    justify-content: center;
    flex-wrap: wrap;
  }

  .software-tooltip {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    top: 100%;
    margin-top: 10px;
  }
}