/* ========================================
   Custom Styles for phimho.io.vn
   ======================================== */

/* ========================================
   Post Item Component Styles
   ======================================== */

/* Container for post items with equal width */
.post-items-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

@media (max-width: 767.98px) {
    .post-items-container {
        grid-template-columns: 1fr;
    }
}

/* Post item card styling */
.post-item {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Image container with fixed aspect ratio */
.post-item-image-container {
    width: 100%;
    height: 250px;
    overflow: hidden;
    position: relative;
}

.post-item-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.post-item-image:hover {
    transform: scale(1.05);
}

/* Content area with flex-grow for equal heights */
.post-item-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Title with consistent height */
.post-item-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 3rem;
    line-height: 1.5rem;
}

/* Excerpt with consistent height */
.post-item-excerpt {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 4.5rem;
    line-height: 1.5rem;
}

/* Reading time badge */
.reading-time-badge {
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
}

/* Hover lift effect for cards */
.hover-lift {
    transition: all 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* Image object-fit cover */
.object-fit-cover {
    object-fit: cover;
}

/* Card title link hover effect */
.card-title a:hover {
    color: #0d6efd !important;
}

/* Bootstrap stretched-link override */
.stretched-link::after {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    content: "";
}

/* Badge styling */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
}

/* ========================================
   Additional Utility Classes
   ======================================== */

/* Smooth transitions */
.transition-all {
    transition: all 0.3s ease-in-out;
}

/* Text truncate for multiple lines */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Image aspect ratio containers */
.aspect-ratio-16-9 {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
}

.aspect-ratio-16-9 img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ========================================
   Custom Scrollbar
   ======================================== */

/* For Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ========================================
   Loading Spinner
   ======================================== */

.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* ========================================
   Dark Mode Support (Optional)
   ======================================== */

@media (prefers-color-scheme: dark) {
    .hover-lift:hover {
        box-shadow: 0 0.5rem 1rem rgba(255, 255, 255, 0.15) !important;
    }
    
    ::-webkit-scrollbar-track {
        background: #2d2d2d;
    }
    
    ::-webkit-scrollbar-thumb {
        background: #555;
    }
    
    ::-webkit-scrollbar-thumb:hover {
        background: #888;
    }
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    .hover-lift {
        box-shadow: none !important;
        transform: none !important;
    }
    
    .badge {
        border: 1px solid #000;
    }
}

/* ========================================
   Responsive Utilities
   ======================================== */

/* Mobile-specific styles */
@media (max-width: 767.98px) {
    .hover-lift:hover {
        transform: none; /* Disable hover on mobile */
    }
}

/* ========================================
   Animation Keyframes
   ======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-right {
    animation: slideInRight 0.5s ease-in-out;
}

/* ========================================
   End of Custom Styles
   ======================================== */
