/* AJAX Post Search Styles for Vikinger Theme */
/* Perfect integration with Vikinger's design system and color themes */
/* Optimized for instant search performance */

/* Post Preview Performance Optimization - Preserving Original Structure */
.post-preview {
    transition: opacity 0.15s ease !important; /* Faster opacity transitions */
    will-change: opacity !important; /* Optimize for frequent changes */
}

/* Default Search Container */
#aps-search-container {
    margin: 20px 0;
    padding: 20px;
    background: #ffffff !important;
    border: none;
    border-radius: 12px;
    position: relative;
}

/* Basic Search Input - Vikinger Style */
#aps-search-input {
    width: 100%;
    height: 54px;
    padding: 0 20px;
    font-family: var(--font-primary, 'Rajdhani', sans-serif);
    font-size: 14px;
    font-weight: 500;
    border: 2px solid var(--color-border, #dedeea);
    border-radius: 12px;
    background-color: #ffffff !important;
    color: #666666 !important;
    outline: none;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

#aps-search-input:focus {
    border-color: var(--color-secondary, #615dfa);
    box-shadow: 0 0 0 4px rgba(97, 93, 250, 0.1);
}

#aps-search-input::placeholder {
    color: var(--color-text-alt-2, #8b88c7);
    font-weight: 400;
    font-style: normal;
}

/* Search Results Counter - Vikinger Style - Optimized for Speed */
#aps-search-results {
    margin: 12px 0 0 0;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--color-secondary, #615dfa) 0%, var(--color-secondary-hover, #7b68ee) 100%);
    color: #ffffff;
    border-radius: 8px;
    font-family: var(--font-primary, 'Rajdhani', sans-serif);
    font-size: 13px;
    font-weight: 500;
    border: none;
    box-shadow: 0 4px 12px rgba(97, 93, 250, 0.2);
    /* Removed animation for instant display */
    opacity: 1;
    transform: translateY(0);
}

/* Vikinger Animation and Transitions */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideUp {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-12px) scale(0.98);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Vikinger Animation Classes */
.aps-fade-in {
    animation: fadeIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.aps-slide-up {
    animation: slideUp 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.aps-bounce-in {
    animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Enhanced Hover Effects */
.aps-vikinger-search #aps-search-input:hover {
    border-color: var(--color-secondary, #615dfa);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(97, 93, 250, 0.15);
}

.aps-vikinger-search #aps-search-results:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(97, 93, 250, 0.3);
}

/* Vikinger Form Integration */
.aps-vikinger-search {
    margin: 20px 0;
    background: transparent;
    border: none;
    padding: 0;
}

/* Form Item Wrapper */
.aps-vikinger-search .form-item {
    margin-bottom: 16px;
    position: relative;
}

.aps-vikinger-search .form-item:first-child {
    margin-top: 0;
}

/* Form Input Container */
.aps-vikinger-search .form-input {
    position: relative;
}

/* Floating Label Style */
.aps-vikinger-search .form-input label {
    color: var(--color-text-alt-2, #8b88c7);
    font-family: var(--font-primary, 'Rajdhani', sans-serif);
    font-size: 16px;
    font-weight: 600;
    line-height: 1em;
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 2;
    transition: all 0.3s ease-in-out;
    pointer-events: none;
}

/* Active Label State */
.aps-vikinger-search .form-input.active label {
    background-color: var(--color-box-background, #ffffff);
    padding: 0 6px;
    font-size: 12px;
    top: -6px;
    left: 12px;
}

/* Enhanced Input Styling */
.aps-vikinger-search #aps-search-input {
    width: 100%;
    height: 54px;
    padding: 0 20px;
    border: 2px solid var(--color-border, #dedeea);
    border-radius: 12px;
    background-color: #ffffff !important;
    font-family: var(--font-primary, 'Rajdhani', sans-serif);
    font-size: 14px;
    font-weight: 500;
    color: #666666 !important;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.aps-vikinger-search #aps-search-input:focus {
    border-color: var(--color-secondary, #615dfa);
    box-shadow: 0 0 0 4px rgba(97, 93, 250, 0.1);
}

.aps-vikinger-search #aps-search-input::placeholder {
    color: var(--color-text-alt-2, #8b88c7);
    font-weight: 400;
}

/* Enhanced Results Counter */
.aps-vikinger-search #aps-search-results {
    margin: 12px 0 0 0;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--color-secondary, #615dfa) 0%, var(--color-secondary-hover, #7b68ee) 100%);
    color: #ffffff;
    border-radius: 8px;
    font-family: var(--font-primary, 'Rajdhani', sans-serif);
    font-size: 13px;
    font-weight: 500;
    border: none;
    box-shadow: 0 4px 12px rgba(97, 93, 250, 0.2);
}

/* Responsive Design - Vikinger Compatible */
@media (max-width: 1365px) {
    .aps-vikinger-search #aps-search-input {
        height: 50px;
        font-size: 13px;
    }
    
    .aps-vikinger-search .form-input label {
        font-size: 15px;
        top: 18px;
    }
    
    .aps-vikinger-search .form-input.active label {
        font-size: 11px;
    }
}

@media (max-width: 1024px) {
    #aps-search-container {
        margin: 15px 0;
    }
    
    .aps-vikinger-search #aps-search-input {
        height: 48px;
        padding: 0 16px;
        font-size: 13px;
    }
    
    .aps-vikinger-search .form-input label {
        font-size: 14px;
        top: 16px;
        left: 16px;
    }
    
    .aps-vikinger-search .form-input.active label {
        font-size: 11px;
        left: 10px;
    }
}

@media (max-width: 768px) {
    #aps-search-container {
        margin: 12px 0;
    }
    
    .aps-vikinger-search #aps-search-input {
        height: 44px;
        padding: 0 14px;
        font-size: 12px;
        border-radius: 10px;
    }
    
    .aps-vikinger-search .form-input label {
        font-size: 13px;
        top: 15px;
        left: 14px;
    }
    
    .aps-vikinger-search .form-input.active label {
        font-size: 10px;
        left: 8px;
    }
    
    #aps-search-results {
        font-size: 12px;
        padding: 10px 14px;
        border-radius: 6px;
    }
}

/* Loading State - Vikinger Style */
.aps-loading #aps-search-input {
    background: linear-gradient(90deg, var(--color-box-background, #ffffff) 25%, var(--color-border, #dedeea) 50%, var(--color-box-background, #ffffff) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-color: var(--color-secondary, #615dfa);
}

.aps-loading #aps-search-results {
    background: linear-gradient(135deg, var(--color-secondary, #615dfa) 0%, var(--color-secondary-hover, #7b68ee) 100%);
    color: #ffffff;
    opacity: 0.8;
    animation: pulse 1.5s infinite;
}

#aps-search-input.loading {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24"><path fill="%23999" d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z" opacity=".25"/><path fill="%23999" d="M12,4a8,8,0,0,1,7.89,6.7A1.53,1.53,0,0,0,21.38,12h0a1.5,1.5,0,0,0,1.48-1.75,11,11,0,0,0-21.72,0A1.5,1.5,0,0,0,2.62,12h0a1.53,1.53,0,0,0,1.49-1.3A8,8,0,0,1,12,4Z"><animateTransform attributeName="transform" dur="0.75s" repeatCount="indefinite" type="rotate" values="0 12 12;360 12 12"/></path></svg>');
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 16px;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.8;
    }
    50% {
        opacity: 1;
    }
}



/* Post Preview Transitions */
.post-preview {
    transition: all 0.3s ease;
}

.post-preview.aps-hidden {
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;
}

.post-preview.aps-highlighted {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* Vikinger Style Variants */

/* Minimal Vikinger Style */
.aps-minimal.aps-vikinger-search #aps-search-input {
    border: 1px solid var(--color-border, #dedeea);
    border-radius: 8px;
    height: 48px;
    padding: 0 16px;
    font-size: 13px;
    background-color: #ffffff !important;
    color: #666666 !important;
}

.aps-minimal.aps-vikinger-search #aps-search-results {
    background: var(--color-box-background, #ffffff);
    border: 1px solid var(--color-border, #dedeea);
    color: var(--color-text, #3e3f5e);
    padding: 10px 16px;
    font-size: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Rounded Vikinger Style */
.aps-rounded.aps-vikinger-search #aps-search-input {
    border-radius: 27px;
    height: 54px;
    padding: 0 24px;
    background-color: #ffffff !important;
    color: #666666 !important;
}

.aps-rounded.aps-vikinger-search #aps-search-results {
    border-radius: 20px;
    margin: 12px 8px 0 8px;
}

.aps-rounded.aps-vikinger-search .form-input label {
    left: 24px;
}

.aps-rounded.aps-vikinger-search .form-input.active label {
    left: 18px;
}

/* Modern Vikinger Style */
.aps-modern.aps-vikinger-search #aps-search-input {
    border: none;
    border-bottom: 2px solid var(--color-border, #dedeea);
    border-radius: 0;
    background: #ffffff !important;
    height: 50px;
    padding: 12px 0;
    font-size: 15px;
    color: #666666 !important;
}

.aps-modern.aps-vikinger-search #aps-search-input:focus {
    border-bottom-color: var(--color-secondary, #615dfa);
    box-shadow: none;
}

.aps-modern.aps-vikinger-search #aps-search-results {
    background: var(--color-secondary, #615dfa);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    margin-top: 12px;
    font-weight: 500;
}

.aps-modern.aps-vikinger-search .form-input label {
    left: 0;
    top: 18px;
}

.aps-modern.aps-vikinger-search .form-input.active label {
    left: 0;
    top: -8px;
    background-color: transparent;
}

/* ==========================================================================
   Post Carousel Shortcode & Legacy/Same Style Overrides
   ========================================================================== */
.aps-carousel-wrapper {
    width: 100%;
    position: relative;
    padding: 20px 0 40px;
    box-sizing: border-box;
    overflow: hidden;
}

.aps-swiper-carousel {
    width: 100%;
    height: auto;
    padding: 10px 4px 30px; /* space for shadows and pagination */
}

/* Swiper Slide custom margins to prevent clipping shadows */
.aps-swiper-carousel .swiper-slide {
    height: auto !important;
    display: flex;
    justify-content: center;
    align-items: stretch;
}

.aps-carousel-slide-content {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    overflow: hidden;
    box-sizing: border-box;
    height: 100%;
}

.aps-carousel-slide-content a {
    display: block;
    width: 100%;
    height: 100%;
}

.aps-carousel-image {
    width: auto;
    height: auto;
    max-width: 100%;
    display: block;
    margin: 0 auto;
    border-radius: 12px;
    object-fit: contain;
    transition: transform 0.3s ease !important;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: auto;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.aps-carousel-image:hover {
    transform: scale(1.005) translateZ(0);
}

/* Same Style / Legacy Style overrides */
/* Disables glassmorphism blur and uses clean theme variables for background and borders */
.aps-carousel-style-legacy .aps-carousel-slide-content {
    background-color: var(--color-box-background, #ffffff) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: 1px solid var(--color-border, #dedeea) !important;
    box-shadow: var(--color-box-shadow, 0 2px 8px rgba(0,0,0,0.06)) !important;
}

/* Dark Mode Legacy Style */
body.active-dark-mode .aps-carousel-style-legacy .aps-carousel-slide-content {
    background-color: var(--color-box-background, #1d2333) !important;
    background-image: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: 1px solid var(--color-border, #2f3749) !important;
    box-shadow: none !important;
}

/* Swiper navigation colors to match theme colors (like purple/secondary) */
.aps-swiper-carousel .swiper-button-prev,
.aps-swiper-carousel .swiper-button-next {
    color: var(--color-secondary, #615dfa);
    width: 44px;
    height: 44px;
    background: var(--color-box-background, #ffffff);
    border-radius: 50%;
    box-shadow: var(--color-box-shadow, 0 2px 8px rgba(0,0,0,0.08));
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.aps-swiper-carousel .swiper-button-prev::after,
.aps-swiper-carousel .swiper-button-next::after {
    font-size: 16px;
    font-weight: bold;
}

.aps-swiper-carousel .swiper-button-prev:hover,
.aps-swiper-carousel .swiper-button-next:hover {
    background: var(--color-secondary, #615dfa);
    color: #ffffff;
}

/* Swiper Pagination style */
.aps-swiper-carousel .swiper-pagination-bullet-active {
    background: var(--color-secondary, #615dfa);
}

body.active-dark-mode .aps-swiper-carousel .swiper-button-prev,
body.active-dark-mode .aps-swiper-carousel .swiper-button-next {
    background: var(--color-box-background, #1d2333);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Empty Notice */
.aps-carousel-empty-notice {
    padding: 20px;
    text-align: center;
    background: #f8f9fa;
    border: 1px dashed #ccc;
    border-radius: 8px;
    color: #666;
}

/* ==========================================================================
   Admin Options Page Carousel Item Styles
   ========================================================================== */
.aps-admin-carousel-card {
    margin-top: 20px;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

#aps-carousel-items-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.aps-carousel-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    box-sizing: border-box;
}

.aps-item-preview {
    width: 100px;
    height: 60px;
    background: #eee;
    border: 1px solid #ddd;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.aps-item-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.aps-no-image {
    font-size: 11px;
    color: #999;
}

.aps-item-fields {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.aps-item-fields input[type="text"] {
    width: 100% !important;
    max-width: 100% !important;
}

.aps-upload-button {
    align-self: flex-start;
}

.aps-remove-button {
    align-self: center;
}

