/* Modal styles */
.modal-dialog {
    margin-top: 60px;
}

.share-modal .modal-body {
    padding: 20px;
    text-align: center;
}

.share-buttons-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.share-modal .input-group-btn {
    line-height: 0 !important;
}

.share-btn-modal {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #333;
    transition: transform 0.2s;
    width: 80px;
}

.share-btn-modal:hover {
    transform: translateY(-3px);
    text-decoration: none;
}

.share-btn-modal img {
    width: 50px;
    height: 50px;
    margin-bottom: 5px;
}

.share-btn-modal span {
    font-size: 12px;
    color: #666;
}

/* Share button in card - smaller button next to like */
.btn-share {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 6px 10px;
    font-size: 12px;
    height: 34px;
}

.btn-share:hover {
    background-color: #5a6268;
    color: white;
}

/* Action buttons row */
.action-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.view-count {
    font-weight: bold;
    color: #428bca;
    font-size: 13px;
}

.like-share-container {
    display: flex;
    gap: 5px;
}

.like-share-container .btn i {
    line-height: normal !important;
}

/* Ensure thumbnail content fills space */
.thumbnail .caption {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 15px;
}

.thumbnail h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 18px;
    line-height: 1.4;
}

.thumbnail p {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 15px;
    flex-grow: 1;
}

/* Infinite scroll loader */
#infinite-loader {
    text-align: center;
    padding: 30px;
    clear: both;
    width: 100%;
}

.loader {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#no-more-results {
    text-align: center;
    padding: 30px;
    color: #666;
    clear: both;
    width: 100%;
}

/* Fix copy button */
.btn-copy {
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-copy i {
    margin-right: 5px;
    transform: translateY(-2px);
}

/* Modal responsive */
@media (max-width: 768px) {
    .modal:before {
        display: none;
    }
    
    .share-btn-modal {
        width: 70px;
    }
    
    .share-btn-modal img {
        width: 40px;
        height: 40px;
    }
}

/* =========================================== */
/* HOVER ANIMATIONS */
/* =========================================== */

@media screen and (min-width: 768px) {
    #shareModal .modal-dialog {
        left: unset !important;
    }
}

.btn-share i {
    margin: 0!important;
    vertical-align: unset;
}

/* Card animations - Simplified version */
.col-md-4 {
    perspective: 1000px;
    transition: transform 0.3s ease;
}

.col-md-4:hover {
    transform: translateY(-5px);
}

.row.fix-height-div .thumbnail {
    height: 100% !important;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(224, 224, 224, 0.7);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    position: relative;
    background: white;
    border-radius: 4px;
}

.row.fix-height-div .thumbnail:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-5px);
    border-color: rgba(66, 139, 202, 0.3);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
}

/* Image hover effect - subtle */
.image-head {
    overflow: hidden;
    position: relative;
    height: 180px;
    width: 100%;
}

.image-head img {
    transition: all 0.5s ease;
    transform-origin: center;
    height: 100%;
    object-fit: contain;
    display: flex;
    margin: auto;
    width: 100%;
}

.thumbnail:hover .image-head img {
    transform: scale(1.03);
    filter: brightness(1.02);
}

/* Overlay effect on image hover - more transparent */
.image-head::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.thumbnail:hover .image-head::after {
    opacity: 0.7;
}

/* Card content animations */
.caption h3 {
    position: relative;
    padding-bottom: 8px;
    transition: color 0.3s ease;
}

.caption h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: rgba(66, 139, 202, 0.5);
    transition: width 0.4s ease;
}

.thumbnail:hover .caption h3::after {
    width: 60px;
}

.caption p {
    transition: color 0.3s ease;
}

.thumbnail:hover .caption p {
    color: #666;
}

/* Button animations - simplified */
.btn-primary, .btn-default, .btn-share {
    transition: all 0.2s ease !important;
}

.btn-primary:hover {
    background-color: #3071a9 !important;
    transform: translateY(-1px);
}

.btn-default:hover {
    background-color: #e6e6e6 !important;
    transform: translateY(-1px);
}

.btn-share:hover {
    background-color: #5a6268 !important;
    transform: translateY(-1px);
}

.btn-copy:hover {
    transform: unset !important;
}

.btn-info:hover {
    background-color: #3071a9 !important;
    transform: translateY(-1px);
}

/* Simple like and share buttons - no animations */
.like-btn {
    transition: all 0.2s ease;
}

.like-btn:hover {
    opacity: 0.9;
}

.share-btn {
    transition: all 0.2s ease;
}

.share-btn:hover {
    opacity: 0.9;
}

/* Action buttons row - subtle hover */
.action-buttons {
    transition: border-color 0.3s ease;
}

.thumbnail:hover .action-buttons {
    border-top-color: rgba(66, 139, 202, 0.2);
}

.view-count {
    transition: color 0.3s ease;
}

.thumbnail:hover .view-count {
    color: #3071a9 !important;
}

/* Counter - simple transition */
.like-btn .counter {
    transition: color 0.2s ease;
}

/* Fade-in animation for cards */
.col-md-4 {
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}

.col-md-4:nth-child(1) { animation-delay: 0.05s; }
.col-md-4:nth-child(2) { animation-delay: 0.1s; }
.col-md-4:nth-child(3) { animation-delay: 0.15s; }
.col-md-4:nth-child(4) { animation-delay: 0.2s; }
.col-md-4:nth-child(5) { animation-delay: 0.25s; }
.col-md-4:nth-child(6) { animation-delay: 0.3s; }
.col-md-4:nth-child(7) { animation-delay: 0.35s; }
.col-md-4:nth-child(8) { animation-delay: 0.4s; }
.col-md-4:nth-child(9) { animation-delay: 0.45s; }
.col-md-4:nth-child(10) { animation-delay: 0.5s; }
.col-md-4:nth-child(11) { animation-delay: 0.55s; }
.col-md-4:nth-child(12) { animation-delay: 0.6s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Subtle glow effect - very transparent */
.thumbnail::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    background: linear-gradient(45deg, rgba(66, 139, 202, 0.1), rgba(91, 192, 222, 0.1), rgba(66, 139, 202, 0.1));
    z-index: -1;
    border-radius: 3px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.thumbnail:hover::before {
    opacity: 0.3;
}

/* Card animations for newly loaded cards */
.col-md-4.new-card {
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .thumbnail:hover {
        transform: translateY(-3px);
        background: white; /* Keep solid background on mobile */
    }
    
    .thumbnail:hover .image-head img {
        transform: scale(1.01);
    }
    
    /* Disable backdrop-filter on mobile for performance */
    .thumbnail:hover {
        backdrop-filter: none;
    }
    
    /* Adjust animation delays for mobile */
    .col-md-4:nth-child(1) { animation-delay: 0.03s; }
    .col-md-4:nth-child(2) { animation-delay: 0.06s; }
    .col-md-4:nth-child(3) { animation-delay: 0.09s; }
    .col-md-4:nth-child(4) { animation-delay: 0.12s; }
    .col-md-4:nth-child(5) { animation-delay: 0.15s; }
    .col-md-4:nth-child(6) { animation-delay: 0.18s; }
    .col-md-4:nth-child(7) { animation-delay: 0.21s; }
    .col-md-4:nth-child(8) { animation-delay: 0.24s; }
    .col-md-4:nth-child(9) { animation-delay: 0.27s; }
    .col-md-4:nth-child(10) { animation-delay: 0.3s; }
    .col-md-4:nth-child(11) { animation-delay: 0.33s; }
    .col-md-4:nth-child(12) { animation-delay: 0.36s; }
}