/**
 * PrimeKit Elementor Library Styles
 *
 * Styling for the PrimeKit template library tab
 * integrated within Elementor's template modal.
 *
 * @package PrimeKit
 * @since 1.2.11
 */

/* ================================
   Library Logo
   ================================ */
.primekit-library-logo-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.primekit-library-logo {
    width: 24px;
    height: 24px;
    vertical-align: middle;
}

/* ================================
   Toolbar & Search
   ================================ */
#primekit-library-toolbar {
    padding: 20px;
    background: #fff;
    border-bottom: 1px solid #e6e9ec;
}

#primekit-library-filter-text {
    position: relative;
    max-width: 400px;
}

#primekit-library-search {
    width: 100%;
    padding: 10px 40px 10px 15px;
    border: 1px solid #d5dadf;
    border-radius: 3px;
    font-size: 13px;
    line-height: 1;
    transition: all 0.3s;
}

#primekit-library-search:focus {
    outline: none;
    border-color: #a4afb7;
    box-shadow: 0 0 5px rgba(164, 175, 183, 0.3);
}

#primekit-library-filter-text .eicon-search {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #a4afb7;
    font-size: 16px;
    pointer-events: none;
}

/* ================================
   Header Actions
   ================================ */
#primekit-library-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

#primekit-library-header-sync {
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 3px;
    transition: background-color 0.3s;
}

#primekit-library-header-sync:hover {
    background-color: #f1f3f5;
}

#primekit-library-header-sync i {
    font-size: 18px;
    color: #6d7882;
}

/* ================================
   Templates Container
   ================================ */
.primekit-library-templates-container {
    padding: 20px;
    background: #f1f3f5;
    min-height: 400px;
}

#primekit-library-templates-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* ================================
   Individual Template Card
   ================================ */
.primekit-library-template-body {
    background: #fff;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.primekit-library-template-body:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* Template Screenshot */
.primekit-library-template-screenshot {
    position: relative;
    padding-top: 75%; /* 4:3 aspect ratio */
    overflow: hidden;
    background-color: #f5f5f5;
}

.primekit-library-template-screenshot img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.primekit-library-template-body:hover .primekit-library-template-screenshot img {
    transform: scale(1.05);
}

/* Template Overlay */
.primekit-library-template-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.primekit-library-template-body:hover .primekit-library-template-overlay {
    opacity: 1;
}

/* Template Controls */
.primekit-library-template-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px;
}

.primekit-library-btn-insert,
.primekit-library-btn-preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.primekit-library-btn-insert {
    background: #93003c;
    color: #fff;
}

.primekit-library-btn-insert:hover {
    background: #b8004b;
    color: #fff;
}

.primekit-library-btn-insert:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.primekit-library-btn-preview {
    background: transparent;
    color: #fff;
    border: 1px solid #fff;
}

.primekit-library-btn-preview:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.primekit-library-btn-insert i,
.primekit-library-btn-preview i {
    font-size: 14px;
}

/* Template Name */
.primekit-library-template-name {
    padding: 15px;
    font-size: 14px;
    font-weight: 500;
    color: #495157;
    text-align: center;
    border-top: 1px solid #f1f3f5;
}

/* ================================
   Template Badges
   ================================ */
.primekit-library-template-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    z-index: 2;
}

.primekit-library-badge-pro {
    background: linear-gradient(135deg, #93003c 0%, #b8004b 100%);
    color: #fff;
}

/* ================================
   Loading State
   ================================ */
.elementor-loader-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    padding: 40px;
}

.elementor-loader {
    margin-bottom: 20px;
}

.elementor-loader-boxes {
    display: flex;
    gap: 10px;
}

.elementor-loader-box {
    width: 15px;
    height: 15px;
    background: #93003c;
    border-radius: 3px;
    animation: primekit-pulse 1.5s ease-in-out infinite;
}

.elementor-loader-box:nth-child(2) {
    animation-delay: 0.2s;
}

.elementor-loader-box:nth-child(3) {
    animation-delay: 0.4s;
}

.elementor-loader-box:nth-child(4) {
    animation-delay: 0.6s;
}

@keyframes primekit-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

.elementor-loading-title {
    font-size: 14px;
    color: #6d7882;
    font-weight: 500;
}

/* ================================
   Empty State
   ================================ */
.elementor-template-library-blank-icon {
    margin-bottom: 20px;
}

.elementor-template-library-no-results {
    width: 80px;
    height: 80px;
    opacity: 0.5;
}

.elementor-template-library-blank-title {
    font-size: 18px;
    font-weight: 600;
    color: #495157;
    margin-bottom: 10px;
}

.elementor-template-library-blank-message {
    font-size: 13px;
    color: #6d7882;
}

/* ================================
   Responsive Design
   ================================ */
@media (max-width: 1024px) {
    #primekit-library-templates-list {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 15px;
    }
}

@media (max-width: 768px) {
    #primekit-library-templates-list {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 10px;
    }

    .primekit-library-template-controls {
        padding: 15px;
    }

    .primekit-library-btn-insert,
    .primekit-library-btn-preview {
        padding: 8px 15px;
        font-size: 12px;
    }
}

/* ================================
   Loading Spinners
   ================================ */

/* Image loading spinner in template thumbnails */
.primekit-template-image-wrapper {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.primekit-image-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    z-index: 10;
}

.primekit-image-loader .primekit-loader-spinner {
    width: 60px !important;
    height: 60px !important;
    max-width: 60px !important;
    animation: primekit-spin 1s linear infinite;
    display: block;
}

.primekit-template-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 5;
}

/* Template insertion overlay loader */
.primekit-insertion-loader-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.8) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 9999999 !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.primekit-insertion-loader {
    background: #fff !important;
    padding: 60px 80px !important;
    border-radius: 12px !important;
    text-align: center !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5) !important;
    display: block !important;
}

.primekit-insertion-loader .primekit-loader-spinner {
    width: 100px !important;
    height: 100px !important;
    max-width: 100px !important;
    animation: primekit-spin 1s linear infinite !important;
    margin: 0 auto 20px !important;
    display: block !important;
}

.primekit-insertion-loader p {
    margin: 0 !important;
    font-size: 18px !important;
    color: #333 !important;
    font-weight: 600 !important;
    display: block !important;
}

/* Spinning animation */
@keyframes primekit-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
