/* ==========================================================
   COMPONENTS.CSS — A BÍBLIA VISUAL DO VIRALINK 13.1
   VERSÃO MASTER: UI Premium, Bento Grid & Badges
   ========================================================== */

/* ----------------------------------------------------------
   1. GRID DE POSTS (Listagem Padrão)
---------------------------------------------------------- */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

/* ----------------------------------------------------------
   2. POST CARD (Card Universal)
---------------------------------------------------------- */
.post-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    z-index: 1;
}

.post-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: rgba(13, 110, 253, 0.2);
}

/* Container da Imagem */
.thumb-wrapper, .card-thumb {
    position: relative;
    width: 100%;
    height: 200px; /* Altura fixa para uniformidade */
    overflow: hidden;
    background: #eef2f6;
    z-index: 1;
}

.thumb-wrapper img, .card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.post-card:hover .thumb-wrapper img,
.post-card:hover .card-thumb img {
    transform: scale(1.1);
}

/* Overlay de Play (Vídeo) */
.card-overlay-play, .card-play-overlay {
    position: absolute; top: 50%; left: 50%; 
    transform: translate(-50%, -50%);
    width: 45px; height: 45px; 
    background: rgba(0,0,0,0.6);
    border-radius: 50%; 
    display: flex; align-items: center; justify-content: center;
    border: 2px solid #fff; 
    color: #fff;
    backdrop-filter: blur(2px);
    z-index: 5; 
    transition: 0.3s;
    opacity: 0.9;
}
.post-card:hover .card-overlay-play { 
    background: #ff0000; 
    border-color: #ff0000; 
    transform: translate(-50%, -50%) scale(1.15); 
    opacity: 1;
}

/* Indicador de Áudio */
.card-indicator-audio {
    position: absolute; bottom: 10px; right: 10px;
    background: rgba(13, 110, 253, 0.9); color: #fff;
    width: 30px; height: 30px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; z-index: 5;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Conteúdo do Card */
.card-body, .card-content {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    background: #fff;
    position: relative;
    z-index: 5;
}

.card-title { margin: 0 0 10px; font-size: 1.1rem; line-height: 1.4; font-weight: 700; }

.card-title a {
    color: #1e293b;
    text-decoration: none;
    transition: color 0.2s;
}
.post-card:hover .card-title a { color: #0d6efd; }

.card-excerpt { font-size: 0.9rem; color: #64748b; margin-bottom: 15px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.card-meta { margin-top: auto; font-size: 0.75rem; color: #94a3b8; display: flex; gap: 12px; border-top: 1px solid #f1f5f9; padding-top: 12px; }
.meta-item { display: flex; align-items: center; gap: 4px; }

/* ----------------------------------------------------------
   3. SISTEMA DE BADGES (Categorias & Tendências)
---------------------------------------------------------- */
.card-badge, .cat-badge {
    position: absolute; top: 12px; left: 12px;
    padding: 4px 10px; border-radius: 6px;
    font-size: 0.65rem; font-weight: 800; text-transform: uppercase;
    color: #fff; z-index: 10; letter-spacing: 0.5px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* Cores Específicas */
.badge-politics { background: #dc3545 !important; }
.badge-world { background: #6f42c1 !important; }
.badge-top, .badge-brasil { background: #0d6efd !important; }
.badge-business { background: #198754 !important; }
.badge-technology { background: #0dcaf0 !important; color:#000 !important;}
.badge-health { background: #20c997 !important; }
.badge-sports { background: #fd7e14 !important; }
.badge-entertainment { background: #d63384 !important; }
.badge-environment { background: #157347 !important; }
.badge-science { background: #6610f2 !important; }
.badge-food { background: #ffc107 !important; color:#000 !important; }
.badge-receitas { background: #ff4757 !important; }
.badge-games { background: #70a1ff !important; }
.badge-ofertas { background: #2f3542 !important; }

/* Receitas Específicas */
.recipe-badge-drink { background: #8b5cf6 !important; }
.recipe-badge-sweet { background: #ec4899 !important; }
.recipe-badge-healthy { background: #10b981 !important; }
.recipe-badge-food { background: #f59e0b !important; }

/* Fallback */
.card-badge:not([class*="badge-"]) { background: #64748b; }

/* Badge de Tendência */
.card-badge-trend {
    position: absolute; top: 12px; right: 12px;
    padding: 4px 8px; border-radius: 4px;
    font-weight: 800; font-size: 0.65rem; color: #fff;
    z-index: 10; text-transform: uppercase;
}
.card-badge-trend.hot { background: #ff4757; animation: pulse 2s infinite; }
.card-badge-trend.rising { background: #ffa502; }

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

/* Ranking Circle (Coroa) */
.trend-rank-circle {
    position: absolute; top: -5px; left: -5px;
    width: 40px; height: 40px; background: #fff;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-weight: 900; font-size: 1.2rem; color: #333;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2); z-index: 20;
    border: 3px solid #f1f5f9;
}
.rank-1 .trend-rank-circle { background: linear-gradient(135deg, #ffd700, #fdb931); color: #fff; border-color: #fff; }
.rank-1 .trend-rank-circle::before { content: '👑'; position: absolute; top: -22px; font-size: 1.2rem; }
.rank-2 .trend-rank-circle { background: linear-gradient(135deg, #e0e0e0, #bdbdbd); color: #fff; border-color: #fff; }
.rank-3 .trend-rank-circle { background: linear-gradient(135deg, #cd7f32, #a0522d); color: #fff; border-color: #fff; }

/* ----------------------------------------------------------
   4. HIGHLIGHTS (BENTO GRID)
---------------------------------------------------------- */
.highlights-container {
    display: grid;
    grid-template-columns: 1.8fr 1fr;
    gap: 30px; margin-bottom: 3rem; min-height: 450px;
}

/* Card Principal */
.highlight-main {
    position: relative; border-radius: 16px; overflow: hidden;
    height: 100%; box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}
.highlight-link { display: block; height: 100%; width: 100%; position: relative; color: #fff; }
.highlight-img-main { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
.highlight-main:hover .highlight-img-main { transform: scale(1.05); }

.highlight-content {
    position: absolute; bottom: 0; left: 0; width: 100%; padding: 2rem; z-index: 3;
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
}
.highlight-content .title {
    font-size: clamp(1.5rem, 3vw, 2.2rem); text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    margin-bottom: 0.5rem; color: #fff; font-weight: 800;
}
.highlight-meta { font-size: 0.85rem; opacity: 0.9; margin-bottom: 10px; display: flex; gap: 15px; }

/* Sidebar Lateral */
.highlights-sidebar { display: flex; flex-direction: column; gap: 20px; height: 100%; }
.highlight-side-item {
    flex: 1; background: #fff; border-radius: 16px; overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: 0.3s; border: 1px solid rgba(0,0,0,0.05);
}
.highlight-side-item:hover { transform: translateX(-5px); border-color: #0d6efd; }

.side-item-link { display: flex; height: 100%; text-decoration: none; color: #1e293b; }
.side-thumb { width: 40%; position: relative; overflow: hidden; }
.highlight-img-side { width: 100%; height: 100%; object-fit: cover; }
.side-info { width: 60%; padding: 1.2rem; display: flex; flex-direction: column; justify-content: center; }
.side-title { font-size: 1rem; font-weight: 700; line-height: 1.4; margin: 5px 0 0 0; }

/* ----------------------------------------------------------
   5. TENDÊNCIAS (RANKING BLOCK)
---------------------------------------------------------- */
.trends-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 25px; }

.trend-card {
    background: #fff; border-radius: 16px; padding: 20px;
    display: flex; gap: 15px; align-items: flex-start;
    border: 1px solid rgba(0,0,0,0.05); transition: 0.3s;
    position: relative; overflow: visible; box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}
.trend-card:hover { border-color: #0d6efd; box-shadow: 0 10px 20px rgba(13, 110, 253, 0.1); transform: translateY(-3px); }

.trend-content { flex-grow: 1; }
.trend-title { font-size: 1rem; margin: 0 0 10px 0; font-weight: 700; line-height: 1.4; }
.trend-title a { color: #1e293b; text-decoration: none; }
.trend-stats { margin-top: 10px; }
.trend-bar-bg { height: 6px; background: #e2e8f0; border-radius: 10px; overflow: hidden; margin-top: 5px; }
.trend-bar-fill { height: 100%; background: linear-gradient(90deg, #0d6efd, #0dcaf0); border-radius: 10px; }
.trend-source { display: block; margin-top: 10px; font-size: 0.75rem; color: #94a3b8; font-weight: 600; text-transform: uppercase; }

/* ----------------------------------------------------------
   6. AFILIADOS (VITRINE)
---------------------------------------------------------- */
.affiliates-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 25px; }

.affiliate-card {
    background: #fff; border-radius: 16px; overflow: hidden;
    border: 1px solid #e2e8f0; transition: 0.3s;
    display: flex; flex-direction: column;
}
.affiliate-card:hover { box-shadow: 0 15px 30px rgba(0,0,0,0.1); transform: translateY(-5px); }

.affiliate-thumb-wrapper { position: relative; height: 220px; padding: 20px; background: #fff; display: flex; align-items: center; justify-content: center; }
.affiliate-img { max-height: 100%; max-width: 100%; object-fit: contain; transition: 0.3s; }
.affiliate-card:hover .affiliate-img { transform: scale(1.05); }

.discount-badge {
    position: absolute; top: 10px; right: 10px;
    background: #ef4444; color: #fff; font-size: 0.7rem; font-weight: 800;
    padding: 4px 8px; border-radius: 4px;
}

.affiliate-info { padding: 15px; border-top: 1px solid #f1f5f9; flex-grow: 1; display: flex; flex-direction: column; }
.vendor-badge { display: inline-block; font-size: 0.7rem; color: #64748b; font-weight: 600; margin-bottom: 5px; text-transform: uppercase; }
.vendor-amazon { color: #f97316; } .vendor-shopee { color: #ea580c; }

.affiliate-title a { font-size: 0.95rem; font-weight: 700; color: #1e293b; text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 10px; }

.price-box { margin-top: auto; }
.price-old { text-decoration: line-through; color: #94a3b8; font-size: 0.85rem; }
.price-current { font-size: 1.3rem; font-weight: 800; color: #10b981; margin: 0; }

.affiliate-btn {
    display: block; text-align: center; background: #f8fafc; color: #475569;
    padding: 10px; border-radius: 8px; font-weight: 700; text-decoration: none;
    margin-top: 15px; transition: 0.2s; font-size: 0.9rem;
}
.affiliate-btn:hover { background: #0d6efd; color: #fff; }

/* ----------------------------------------------------------
   7. RESPONSIVIDADE
---------------------------------------------------------- */
@media (max-width: 1024px) {
    .highlights-container { grid-template-columns: 1fr; height: auto; }
    .highlights-sidebar { flex-direction: row; overflow-x: auto; padding-bottom: 10px; }
    .highlight-side-item { min-width: 280px; }
    .recipes-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .posts-grid { grid-template-columns: 1fr; }
    .highlights-sidebar { flex-direction: column; }
    .highlight-side-item { width: 100%; min-height: 100px; }
    .recipes-grid { grid-template-columns: repeat(2, 1fr); }
    .highlight-main { min-height: 300px; }
    .affiliates-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .recipes-grid { grid-template-columns: 1fr; }
    .affiliates-grid { grid-template-columns: 1fr; }
}
