/* ============================================================
   IT Portfolio Manager v2.0 — Frontend Styles
   Dark theme, slider filter, responsive, error-free
   ============================================================ */

.itp-portfolio-wrap *,
.itp-portfolio-wrap *::before,
.itp-portfolio-wrap *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.itp-portfolio-wrap {
    --itp-accent:      #c6ff00;
    --itp-accent-dim:  rgba(198,255,0,0.10);
    --itp-bg-card:     rgba(255,255,255,0.04);
    --itp-border:      rgba(255,255,255,0.08);
    --itp-text:        #f0f0f0;
    --itp-muted:       rgba(255,255,255,0.45);
    --itp-radius:      10px;
    --itp-ease:        0.32s cubic-bezier(0.4,0,0.2,1);
    width: 100%;
    position: relative;
    font-family: inherit;
}

/* ============================================================
   FILTER SLIDER
============================================================ */
.itp-filter-bar {
    position: relative;
    margin-bottom: 36px;
    border-left: 3px solid var(--itp-accent);
    padding-left: 0;
}

/* Fade edges hint on desktop */
.itp-filter-bar::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 48px;
    background: linear-gradient(to right, transparent, rgba(0,0,0,0.7));
    pointer-events: none;
    z-index: 2;
}

/* The scrollable track */
.itp-filter-inner {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;          /* SINGLE ROW — no wrapping ever */
    align-items: center;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    scrollbar-width: none;      /* Firefox */
    -ms-overflow-style: none;   /* IE/Edge */
    padding: 4px 48px 4px 16px;
    gap: 0;
}

.itp-filter-inner::-webkit-scrollbar { display: none; }

/* Each filter button */
.itp-filter-btn {
    position: relative;
    flex-shrink: 0;             /* never shrink — keeps single row */
    background: none;
    border: none;
    color: var(--itp-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    padding: 10px 18px;
    cursor: pointer;
    transition: color var(--itp-ease);
    white-space: nowrap;
    outline: none;
}

.itp-filter-btn::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 18px;
    right: 18px;
    height: 2px;
    background: var(--itp-accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--itp-ease);
}

.itp-filter-btn:hover      { color: #fff; }
.itp-filter-btn.active     { color: #fff; }
.itp-filter-btn.active::after,
.itp-filter-btn:hover::after { transform: scaleX(1); }

/* Sub-menu dropdown */
.itp-sub-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: #111;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--itp-radius);
    min-width: 160px;
    z-index: 9999;
    padding: 6px 0;
    box-shadow: 0 20px 50px rgba(0,0,0,0.7);
    animation: itpMenuIn 0.18s ease;
}
@keyframes itpMenuIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.itp-filter-btn:hover .itp-sub-menu { display: block; }

.itp-sub-btn {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: var(--itp-muted);
    text-align: left;
    padding: 8px 18px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
    white-space: nowrap;
}
.itp-sub-btn:hover {
    background: var(--itp-accent-dim);
    color: var(--itp-accent);
}

/* ============================================================
   LOADING SPINNER
============================================================ */
.itp-grid-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}
.itp-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--itp-accent);
    border-radius: 50%;
    animation: itpSpin 0.7s linear infinite;
}
@keyframes itpSpin { to { transform: rotate(360deg); } }

/* ============================================================
   GRID
============================================================ */
.itp-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

@media (max-width: 1024px) {
    .itp-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .itp-grid { grid-template-columns: 1fr; gap: 14px; }
}

/* Column overrides via data attribute */
[data-columns="2"] .itp-grid { grid-template-columns: repeat(2, 1fr); }
[data-columns="4"] .itp-grid { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
    [data-columns="4"] .itp-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    [data-columns="2"] .itp-grid,
    [data-columns="4"] .itp-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   PORTFOLIO CARD
============================================================ */
.itp-card {
    position: relative;
    border-radius: var(--itp-radius);
    overflow: hidden;
    cursor: pointer;
    background: var(--itp-bg-card);
    border: 1px solid var(--itp-border);
    transition: transform var(--itp-ease), border-color var(--itp-ease), box-shadow var(--itp-ease);
    animation: itpCardIn 0.45s ease both;
}
@keyframes itpCardIn {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to   { opacity: 1; transform: none; }
}
.itp-card:hover {
    transform: translateY(-4px);
    border-color: var(--itp-accent);
    box-shadow: 0 16px 48px rgba(0,0,0,0.5), 0 0 0 1px var(--itp-accent);
}
.itp-card:focus { outline: 2px solid var(--itp-accent); outline-offset: 2px; }

/* Card media — full image, no crop */
.itp-card-media {
    position: relative;
    overflow: hidden;
    background: #111;
    line-height: 0;
}
.itp-card-img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.55s cubic-bezier(0.4,0,0.2,1);
}
.itp-card:hover .itp-card-img { transform: scale(1.04); }

.itp-card-no-img {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    color: rgba(255,255,255,0.15);
    font-size: 40px;
}

/* Overlay */
.itp-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top,
        rgba(0,0,0,0.85) 0%,
        rgba(0,0,0,0.25) 55%,
        transparent 100%);
    opacity: 0;
    transition: opacity var(--itp-ease);
    display: flex;
    align-items: center;
    justify-content: center;
}
.itp-card:hover .itp-card-overlay { opacity: 1; }

.itp-card-overlay-icon {
    width: 50px;
    height: 50px;
    border: 2px solid var(--itp-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--itp-accent);
    font-size: 20px;
    transform: scale(0.75) translateY(8px);
    opacity: 0;
    transition: transform 0.28s ease 0.04s, opacity 0.28s ease;
    background: rgba(198,255,0,0.07);
    backdrop-filter: blur(4px);
}
.itp-card:hover .itp-card-overlay-icon {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* Badges */
.itp-card-count,
.itp-card-video-badge {
    position: absolute;
    top: 10px;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    letter-spacing: 0.4px;
    backdrop-filter: blur(4px);
}
.itp-card-count {
    right: 10px;
    background: rgba(0,0,0,0.7);
    color: var(--itp-muted);
}
.itp-card-video-badge {
    left: 10px;
    background: var(--itp-accent);
    color: #000;
}

/* Card body */
.itp-card-body { padding: 14px 16px 16px; }

.itp-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--itp-text);
    line-height: 1.35;
    margin-bottom: 5px;
}
.itp-card-meta {
    font-size: 11px;
    color: var(--itp-muted);
}
.itp-card-client::before { content: '— '; }

.itp-card-tags {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-top: 7px;
}
.itp-card-tag {
    background: var(--itp-accent-dim);
    color: var(--itp-accent);
    font-size: 9px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: 0.4px;
}

/* Empty */
.itp-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--itp-muted);
    font-size: 14px;
}

/* ============================================================
   LIGHTBOX
============================================================ */
.itp-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
    align-items: center;
    justify-content: center;
}
.itp-lightbox[aria-hidden="false"] { display: flex; }

.itp-lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.92);
    backdrop-filter: blur(8px);
    animation: itpFadeIn 0.22s ease;
}
@keyframes itpFadeIn { from { opacity: 0; } to { opacity: 1; } }

.itp-lightbox-container {
    position: relative;
    z-index: 1;
    width: 92vw;
    max-width: 1080px;
    max-height: 92vh;
    background: #0e0e0e;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: itpLbIn 0.28s cubic-bezier(0.34,1.4,0.64,1);
}
@keyframes itpLbIn {
    from { transform: scale(0.88); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

/* Close / nav buttons */
.itp-lightbox-close {
    position: absolute;
    top: 12px; right: 12px;
    z-index: 10;
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
    backdrop-filter: blur(4px);
}
.itp-lightbox-close:hover { background: rgba(255,255,255,0.12); border-color: #fff; }

.itp-lightbox-prev,
.itp-lightbox-next {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    z-index: 10;
    width: 42px; height: 42px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(0,0,0,0.5);
    color: #fff;
    font-size: 26px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    backdrop-filter: blur(4px);
    line-height: 1;
}
.itp-lightbox-prev { left: 12px; }
.itp-lightbox-next { right: 12px; }
.itp-lightbox-prev:hover,
.itp-lightbox-next:hover {
    background: rgba(198,255,0,0.15);
    border-color: var(--itp-accent);
    color: var(--itp-accent);
}
.itp-lightbox-prev.hidden,
.itp-lightbox-next.hidden { display: none; }

/* Media */
.itp-lightbox-media {
    flex: 1;
    min-height: 0;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.itp-lb-main-img {
    max-width: 100%;
    max-height: 58vh;
    object-fit: contain;
    display: block;
    animation: itpFadeIn 0.22s ease;
}
.itp-lb-video-wrap {
    width: 100%;
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
}
.itp-lb-video-wrap iframe,
.itp-lb-video-wrap video {
    width: 100%; height: 100%; border: none;
}

/* Info */
.itp-lightbox-info {
    padding: 16px 24px 20px;
    background: #0e0e0e;
    border-top: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}
.itp-lb-title {
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 5px;
}
.itp-lb-desc {
    font-size: 13px;
    color: rgba(255,255,255,0.5);
    line-height: 1.5;
    margin-bottom: 10px;
}
.itp-lb-meta {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 12px;
}
.itp-lb-client { font-size: 11px; color: rgba(255,255,255,0.38); }
.itp-lb-link {
    font-size: 11px;
    font-weight: 700;
    color: var(--itp-accent);
    text-decoration: none;
    letter-spacing: 0.5px;
    transition: opacity 0.2s;
}
.itp-lb-link:hover { opacity: 0.7; }
.itp-lb-link.hidden { display: none; }

/* Thumb strip */
.itp-lb-thumb-strip {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    scrollbar-width: none;
}
.itp-lb-thumb-strip::-webkit-scrollbar { display: none; }

.itp-lb-thumb {
    flex-shrink: 0;
    width: 54px; height: 40px;
    border-radius: 5px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.5;
    transition: border-color 0.2s, opacity 0.2s;
}
.itp-lb-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.itp-lb-thumb.active { border-color: var(--itp-accent); opacity: 1; }
.itp-lb-thumb:hover { opacity: 0.8; }

.itp-lb-thumb-video {
    background: rgba(198,255,0,0.08);
    display: flex; align-items: center; justify-content: center;
    color: var(--itp-accent);
    font-size: 16px;
}

/* ============================================================
   RESPONSIVE
============================================================ */
@media (max-width: 768px) {
    .itp-filter-bar { margin-bottom: 24px; }
    .itp-filter-btn { font-size: 11px; padding: 8px 13px; }
    .itp-lightbox-container {
        width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }
    .itp-lightbox-info { padding: 12px 14px 16px; }
    .itp-lb-title { font-size: 15px; }
}

@media (max-width: 480px) {
    .itp-filter-btn { font-size: 10px; padding: 7px 11px; letter-spacing: 0.8px; }
    .itp-card-title { font-size: 13px; }
    .itp-card-body  { padding: 11px 13px 13px; }
}
