/* ========================================
   Portfolio Showcase Plugin - Frontend CSS
   ======================================== */

:root {
    --psp-accent:      #0073aa;
    --psp-dark:        #1a1a2e;
    --psp-text:        #333;
    --psp-light:       #f5f5f5;
    --psp-white:       #ffffff;
    --psp-shadow:      0 4px 20px rgba(0,0,0,0.12);
    --psp-radius:      8px;
    --psp-transition:  0.3s ease;
    --psp-gap:         20px;
}

/* ---- Filter Bar ---- */
.psp-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 30px;
}

.psp-filter-btn {
    padding: 8px 20px;
    border: 2px solid var(--psp-accent);
    background: transparent;
    color: var(--psp-accent);
    border-radius: 30px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all var(--psp-transition);
    letter-spacing: 0.03em;
}

.psp-filter-btn:hover,
.psp-filter-btn.active {
    background: var(--psp-accent);
    color: var(--psp-white);
}

/* ---- Grid ---- */
.psp-grid {
    display: grid;
    gap: var(--psp-gap);
}

.psp-cols-2 { grid-template-columns: repeat(2, 1fr); }
.psp-cols-3 { grid-template-columns: repeat(3, 1fr); }
.psp-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Masonry simulation */
.psp-layout-masonry { align-items: start; }
.psp-layout-masonry .psp-item:nth-child(3n+1) { margin-top: 0; }
.psp-layout-masonry .psp-item:nth-child(3n+2) { margin-top: 20px; }
.psp-layout-masonry .psp-item:nth-child(3n+3) { margin-top: 40px; }

/* Responsive */
@media (max-width: 1024px) {
    .psp-cols-4 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .psp-cols-3,
    .psp-cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .psp-cols-2,
    .psp-cols-3,
    .psp-cols-4 { grid-template-columns: 1fr; }
}

/* ---- Portfolio Item ---- */
.psp-item {
    border-radius: var(--psp-radius);
    overflow: hidden;
    background: var(--psp-white);
    box-shadow: var(--psp-shadow);
    transition: transform var(--psp-transition), box-shadow var(--psp-transition);
    position: relative;
}

.psp-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 35px rgba(0,0,0,0.18);
}

/* Item Image */
.psp-item-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 4/3;
    background: var(--psp-light);
}

.psp-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.psp-item:hover .psp-item-image img {
    transform: scale(1.08);
}

.psp-no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 13px;
}

/* Overlay */
.psp-item-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    opacity: 0;
    transition: opacity var(--psp-transition);
}

.psp-item:hover .psp-item-overlay {
    opacity: 1;
}

.psp-view-btn,
.psp-link-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--psp-white);
    color: var(--psp-dark);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--psp-transition), transform var(--psp-transition);
    text-decoration: none;
}

.psp-view-btn:hover,
.psp-link-btn:hover {
    background: var(--psp-accent);
    color: var(--psp-white);
    transform: scale(1.1);
}

.psp-view-btn svg,
.psp-link-btn svg { pointer-events: none; }

/* Badge */
.psp-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--psp-accent);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Item Info */
.psp-item-info {
    padding: 16px;
}

.psp-item-title {
    margin: 0 0 5px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}

.psp-item-title a {
    color: var(--psp-dark);
    text-decoration: none;
    transition: color var(--psp-transition);
}

.psp-item-title a:hover { color: var(--psp-accent); }

.psp-item-cat {
    margin: 0;
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Filter hidden (legacy — kept for non-JS fallback) */
.psp-item.psp-hidden { display: none !important; }
.psp-no-items { text-align: center; color: #666; padding: 30px; grid-column: 1/-1; }

/* ---- Results header ---- */
.psp-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    min-height: 24px;
}

.psp-count {
    font-size: 13px;
    color: #888;
    font-style: italic;
    transition: opacity 0.2s;
}

.psp-is-loading .psp-count { opacity: 0.4; }

/* ---- Grid transition animations ---- */
.psp-grid {
    transition: opacity 0.22s ease;
}

.psp-grid.psp-fade-out {
    opacity: 0;
    pointer-events: none;
}

.psp-grid.psp-fade-in {
    animation: pspFadeIn 0.35s ease forwards;
}

@keyframes pspFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- Loading spinner ---- */
.psp-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 7px;
    height: 0;
    overflow: hidden;
    opacity: 0;
    transition: height 0.2s, opacity 0.2s;
    margin: 0 auto;
}

.psp-loading.psp-loading-active {
    height: 52px;
    opacity: 1;
    margin: 12px auto;
}

.psp-loading span {
    display: block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--psp-accent);
    animation: pspBounce 0.7s ease-in-out infinite;
}

.psp-loading span:nth-child(2) { animation-delay: 0.12s; }
.psp-loading span:nth-child(3) { animation-delay: 0.24s; }

@keyframes pspBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40%            { transform: scale(1);   opacity: 1; }
}

/* ---- Pagination wrapper ---- */
.psp-pagination {
    display: flex;
    justify-content: center;
    margin-top: 36px;
}

/* ---- Load More button ---- */
.psp-load-more {
    padding: 13px 36px;
    background: var(--psp-accent);
    color: var(--psp-white);
    border: none;
    border-radius: 40px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--psp-transition);
    box-shadow: 0 4px 16px rgba(0,115,170,0.3);
    letter-spacing: 0.03em;
    position: relative;
    overflow: hidden;
}

.psp-load-more::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.15);
    opacity: 0;
    transition: opacity var(--psp-transition);
}

.psp-load-more:hover::before { opacity: 1; }

.psp-load-more:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,115,170,0.4);
}

.psp-load-more:active { transform: translateY(0); }

.psp-load-more:disabled,
.psp-load-more-done {
    background: #ccc !important;
    color: #666 !important;
    cursor: default !important;
    box-shadow: none !important;
    transform: none !important;
}

.psp-load-more-count {
    font-weight: 400;
    font-size: 13px;
    opacity: 0.8;
}

/* ---- Numbered pagination ---- */
.psp-numbered-pagination {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.psp-page-btn {
    min-width: 40px;
    height: 40px;
    padding: 0 10px;
    border: 2px solid #ddd;
    background: var(--psp-white);
    color: var(--psp-text);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--psp-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.psp-page-btn:hover:not([disabled]) {
    border-color: var(--psp-accent);
    color: var(--psp-accent);
}

.psp-page-btn.active {
    background: var(--psp-accent);
    border-color: var(--psp-accent);
    color: var(--psp-white);
    cursor: default;
    box-shadow: 0 2px 10px rgba(0,115,170,0.3);
}

.psp-page-btn[disabled] {
    opacity: 0.35;
    cursor: not-allowed;
}

.psp-page-btn.psp-page-prev,
.psp-page-btn.psp-page-next {
    font-size: 18px;
    border-radius: 50%;
    width: 40px;
}

.psp-page-ellipsis {
    font-size: 16px;
    color: #aaa;
    padding: 0 4px;
    line-height: 40px;
    display: flex;
    align-items: center;
}

/* ========================================
   Lightbox
   ======================================== */
.psp-lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 99998;
    cursor: pointer;
}

.psp-lightbox-overlay.active { display: block; }

.psp-lightbox {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 99999;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    background: var(--psp-white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0,0,0,0.5);
}

.psp-lightbox.active { display: flex; flex-direction: column; }

.psp-lightbox-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    font-size: 22px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--psp-transition);
}
.psp-lightbox-close:hover { background: rgba(0,0,0,0.9); }

.psp-lightbox-prev,
.psp-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    font-size: 22px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--psp-transition);
}
.psp-lightbox-prev { left: 12px; }
.psp-lightbox-next { right: 12px; }
.psp-lightbox-prev:hover,
.psp-lightbox-next:hover { background: var(--psp-accent); }

.psp-lightbox-inner {
    display: flex;
    flex-direction: row;
    overflow-y: auto;
    max-height: 90vh;
}

.psp-lightbox-image {
    flex: 0 0 55%;
    background: var(--psp-light);
}

.psp-lightbox-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.psp-lightbox-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.psp-lightbox-content h2 {
    margin: 0 0 10px;
    font-size: 22px;
    color: var(--psp-dark);
}

.psp-lightbox-content p {
    margin: 0 0 20px;
    color: #555;
    font-size: 14px;
    line-height: 1.7;
}

.psp-lightbox-meta {
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
    border-top: 1px solid #eee;
    padding-top: 16px;
}

.psp-lightbox-meta li {
    display: flex;
    gap: 10px;
    font-size: 13px;
    margin-bottom: 8px;
}

.psp-lightbox-meta li strong {
    min-width: 80px;
    color: #888;
}

.psp-lightbox-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.psp-lightbox-actions a {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--psp-transition);
}

.psp-btn-primary {
    background: var(--psp-accent);
    color: white;
}
.psp-btn-primary:hover { opacity: 0.85; }

.psp-btn-secondary {
    background: transparent;
    border: 2px solid var(--psp-accent);
    color: var(--psp-accent);
}
.psp-btn-secondary:hover {
    background: var(--psp-accent);
    color: white;
}

@media (max-width: 600px) {
    .psp-lightbox-inner { flex-direction: column; }
    .psp-lightbox-image { flex: none; height: 220px; }
}

/* ========================================
   Widget
   ======================================== */
.psp-widget-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.psp-widget-item {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    align-items: center;
}

.psp-widget-thumb img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}

.psp-widget-info a {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--psp-dark);
    text-decoration: none;
    margin-bottom: 3px;
}

.psp-widget-info a:hover { color: var(--psp-accent); }

.psp-widget-info span {
    font-size: 12px;
    color: #888;
}
