/* ===== RESET Y VARIABLES ===== */
* { box-sizing: border-box; }
html, body { margin:0; padding:0; }
:root{ 
  --border:#ddd; 
  --ink:#111; 
  --muted:#666; 
  --bg:#fff; 
  --transition: transform .3s ease;
  --hover-scale: scale(1.05);
  --instagram-border: #dbdbdb;
  --instagram-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

/* ===== CONTAINER ===== */
.container{ 
  max-width:1200px; 
  margin:0 auto; 
  padding:16px; 
}

/* ===== GRID INSTAGRAM 2x4 ===== */
#insta-grid{
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}

@media (max-width: 768px){ 
  #insta-grid{ 
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    max-width: 360px;
  } 
}

@media (max-width: 560px){ 
  #insta-grid{ 
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(4, 1fr);
    max-width: 240px;
  } 
}

/* ===== TARJETAS INSTAGRAM STYLE ===== */
#insta-grid > .insta-card{
  position: relative;
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  background: var(--bg);
  border: 1px solid var(--instagram-border);
  border-radius: 12px;
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
  margin: 0;
  padding: 0;
  display: block;
  box-shadow: var(--instagram-shadow);
}

#insta-grid > .insta-card:hover{ 
  transform: var(--hover-scale);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  border-color: #c7c7c7;
}

/* ===== MEDIA CONTAINER ===== */
#insta-grid > .insta-card > .media{
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: block;
}

#insta-grid > .insta-card > .media > a{
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  text-decoration: none;
}

/* ===== IMÁGENES ===== */
#insta-grid > .insta-card img{
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: var(--transition);
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
  border: none;
  margin: 0;
  padding: 0;
}

#insta-grid > .insta-card:hover img{ 
  transform: var(--hover-scale);
}

/* ===== CAPTIONS INSTAGRAM STYLE ===== */
#insta-grid > .insta-card > .meta{
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  color: white;
  padding: 16px 12px 12px;
  transform: translateY(100%);
  transition: transform .3s ease;
  border-radius: 0 0 12px 12px;
}

#insta-grid > .insta-card:hover > .meta{
  transform: translateY(0);
}

#insta-grid > .insta-card > .meta > .title{
  font-size: 11px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
  font-weight: 400;
}

/* ===== ESTADOS ===== */
#insta-grid > .insta-empty, 
#insta-grid > .insta-error{
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 20px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--instagram-border);
  border-radius: 12px;
  box-shadow: var(--instagram-shadow);
}

/* ===== BOTÓN INSTAGRAM STYLE ===== */
.btn{ 
  display: inline-block; 
  padding: 8px 16px; 
  border-radius: 8px; 
  border: none;
  background: #0095f6; 
  color: white; 
  text-decoration: none; 
  cursor: pointer; 
  transition: background .2s ease;
  font-weight: 600;
  font-size: 14px;
}

.btn:hover{ 
  background: #0084d4; 
}

.actions{ 
  text-align: center; 
  margin: 24px 0; 
}

/* ===== EFECTOS ADICIONALES INSTAGRAM ===== */
#insta-grid > .insta-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
  z-index: 1;
  pointer-events: none;
}

#insta-grid > .insta-card:hover::before {
  transform: translateX(100%);
}

/* ===== MARCO INSTAGRAM ADICIONAL ===== */
#insta-grid > .insta-card::after {
  content: '';
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  bottom: -1px;
  background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  border-radius: 12px;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#insta-grid > .insta-card:hover::after {
  opacity: 1;
}

/* ===== ANIMACIONES ===== */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.insta-card.animate-in {
  animation: slideInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== PLACEHOLDER DE IMAGEN ===== */
.image-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6c757d;
}

.placeholder-content {
  text-align: center;
}

.placeholder-content i {
  font-size: 24px;
  margin-bottom: 8px;
  display: block;
}

.placeholder-content span {
  font-size: 12px;
}

/* ===== RESPONSIVE ADICIONAL ===== */
@media (max-width: 480px) {
  #insta-grid {
    gap: 6px;
    max-width: 200px;
  }
  
  #insta-grid > .insta-card {
    border-radius: 8px;
  }
  
  #insta-grid > .insta-card > .meta {
    padding: 12px 8px 8px;
  }
  
  #insta-grid > .insta-card > .meta > .title {
    font-size: 10px;
  }
}