/**
 * Premium Cards CSS
 * Modern card design with images and enhanced UX
 */

/* ===== Post Cards Grid ===== */
#postsContainer {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    padding: 20px 0;
}

@media (max-width: 768px) {
    #postsContainer {
        gap: 10px;
        padding: 10px 0;
    }
}

/* ===== Post Card ===== */
.post-card {
    background: #FFFFFF;
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(255, 193, 7, 0.2);
    border-color: rgba(255, 193, 7, 0.3);
}

/* ===== Product Image ===== */
.post-image-container {
    position: relative;
    width: 100%;
    height: 220px;
    overflow: hidden;
    background: var(--color-surface);
}

@media (max-width: 768px) {
    .post-image-container {
        height: 180px;
    }
}

.post-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

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

.post-discount-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, #ff4444 0%, #cc0000 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 4px 8px rgba(255, 68, 68, 0.4);
    animation: pulse 2s infinite;
}

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

/* ===== Card Content ===== */
.post-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

@media (max-width: 768px) {
    .post-content {
        padding: 10px;
        gap: 4px;
    }
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.post-author {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-gray);
    font-size: 14px;
}

.post-author i {
    color: var(--color-primary);
    font-size: 18px;
}

.post-score {
    background: linear-gradient(135deg, var(--color-primary) 0%, #d4a017 100%);
    color: var(--color-dark);
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
}

.post-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-dark);
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 768px) {
    .post-title {
        font-size: 16px;
        line-height: 1.3;
    }
}

/* ===== Price Section ===== */
.post-price-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin: 0;
}

@media (max-width: 768px) {
    .post-price-container {
        gap: 4px;
        margin: 0;
    }
}

.post-original-price {
    color: var(--color-gray);
    text-decoration: line-through;
    font-size: 14px;
    font-weight: 500;
}

.post-price {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-primary);
    text-shadow: 0 2px 4px rgba(255, 193, 7, 0.3);
    line-height: 1;
}

@media (max-width: 768px) {
    .post-price {
        font-size: 24px;
    }
}

/* Points Price */
.post-points-price {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #ffd700;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 215, 0, 0.15) 100%);
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.post-points-price i {
    font-size: 14px;
    color: #ffd700;
}

.post-points-price span {
    color: #333;
    font-weight: 600;
}

.post-points-price:hover {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2) 0%, rgba(255, 215, 0, 0.25) 100%);
    border-color: rgba(255, 215, 0, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.25);
    transition: all 0.2s ease;
}

.points-discount-badge {
    display: inline-block;
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    margin-left: 4px;
}

@media (max-width: 768px) {
    .post-points-price {
        font-size: 12px;
        padding: 5px 10px;
    }
    
    .post-points-price i {
        font-size: 12px;
    }
}

/* ===== Coupon ===== */
.post-coupon {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.15) 0%, rgba(255, 193, 7, 0.05) 100%);
    border: 2px dashed var(--color-primary);
    color: var(--color-primary);
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    transition: all 0.3s ease;
}

.post-coupon:hover {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.25) 0%, rgba(255, 193, 7, 0.15) 100%);
    transform: scale(1.05);
}

.post-coupon i {
    font-size: 16px;
}

/* ===== Actions Section ===== */
.post-actions {
    margin-top: auto;
    padding: 12px 12px 12px 12px;
    border-top: 1px solid var(--border-color);
}

@media (max-width: 768px) {
    .post-actions {
        padding: 8px 10px 10px 10px;
    }
}

.post-reactions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ===== Reaction Buttons ===== */
.reaction-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--color-surface);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    color: var(--color-gray);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

@media (max-width: 768px) {
    .reaction-btn {
        padding: 6px 10px;
        font-size: 13px;
        gap: 4px;
    }
}

.reaction-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
    z-index: 0;
    pointer-events: none;
}

.reaction-btn:active::before {
    width: 100%;
    height: 100%;
}

.reaction-btn > * {
    position: relative;
    z-index: 1;
}

.reaction-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.reaction-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.reaction-btn i {
    font-size: 16px;
    transition: transform 0.3s ease;
}

.reaction-btn:hover i {
    transform: scale(1.1);
}

.reaction-btn:active i {
    transform: scale(1);
}

/* Active States */
.reaction-btn.active-positive {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.2) 0%, rgba(76, 175, 80, 0.1) 100%);
    border-color: #4caf50;
    color: #4caf50;
}

.reaction-btn.active-positive:hover {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.3) 0%, rgba(76, 175, 80, 0.15) 100%);
    box-shadow: 0 4px 16px rgba(76, 175, 80, 0.4);
}

.reaction-btn.active-negative {
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.2) 0%, rgba(244, 67, 54, 0.1) 100%);
    border-color: #f44336;
    color: #f44336;
}

.reaction-btn.active-negative:hover {
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.3) 0%, rgba(244, 67, 54, 0.15) 100%);
    box-shadow: 0 4px 16px rgba(244, 67, 54, 0.4);
}

/* ===== Score Display ===== */
.post-score-display {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--color-surface);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    font-weight: 700;
    font-size: 14px;
}

.post-score-display.positive {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.2) 0%, rgba(255, 193, 7, 0.1) 100%);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.post-score-display.positive i {
    animation: flicker 2s infinite;
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.post-score-display.negative {
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.2) 0%, rgba(33, 150, 243, 0.1) 100%);
    border-color: #2196f3;
    color: #2196f3;
}

/* ===== Comments Count ===== */
.post-comments-count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.2) 0%, rgba(156, 39, 176, 0.1) 100%);
    border: 2px solid rgba(156, 39, 176, 0.3);
    border-radius: 24px;
    color: #ab47bc;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.post-comments-count:hover {
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.3) 0%, rgba(156, 39, 176, 0.15) 100%);
    border-color: rgba(156, 39, 176, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(156, 39, 176, 0.3);
}

.post-comments-count i {
    font-size: 16px;
}

/* ===== View Deal Button ===== */
.btn-view-deal {
    width: 100%;
    margin-top: 8px;
    padding: 12px;
    background: linear-gradient(135deg, var(--color-primary) 0%, #d4a017 100%);
    color: #FFFFFF;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-view-deal::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.btn-view-deal:hover::before {
    left: 100%;
}

.btn-view-deal:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 193, 7, 0.5);
}

.btn-view-deal:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .btn-view-deal {
        margin-top: 6px;
        padding: 10px;
        font-size: 15px;
    }
}

/* ===== Tooltips ===== */
[data-tooltip] {
    position: relative;
}

.reaction-btn[data-tooltip]::after,
[data-tooltip]:not(.reaction-btn)::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 1001;
}

.reaction-btn[data-tooltip]:hover::after,
[data-tooltip]:not(.reaction-btn):hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .post-title {
        font-size: 16px;
        -webkit-line-clamp: 2;
    }
    
    .post-price {
        font-size: 24px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    #postsContainer {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1025px) {
    #postsContainer {
        grid-template-columns: repeat(3, 1fr);
    }
}
