/* ============================================
   Actor / Person Page V4 Styles (.ap-)
   ============================================ */

/* ── Hero ── */
.ap-hero {
    position: relative;
    background: linear-gradient(135deg, #383d40 0%, #2c3e50 100%);
    padding: 3rem 0 2.5rem;
    color: #fff;
    overflow: visible;
}

.ap-hero__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    gap: 2.5rem;
    align-items: flex-start;
}

.ap-hero__photo-wrap {
    flex-shrink: 0;
    width: 220px;
}

.ap-hero__photo {
    width: 220px;
    height: 330px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    background: rgba(255,255,255,0.05);
}

.ap-hero__photo--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5rem;
    color: rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.05);
    width: 220px;
    height: 330px;
    border-radius: 12px;
}

.ap-hero__info {
    flex: 1;
    min-width: 0;
}

.ap-hero__name {
    font-size: 2.4rem;
    font-weight: 700;
    margin: 0 0 0.6rem;
    line-height: 1.2;
    color: #fff;
}

.ap-hero__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    margin-bottom: 1.2rem;
    font-size: 0.95rem;
    color: rgba(255,255,255,0.7);
}

.ap-hero__meta-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.ap-hero__meta-icon {
    font-size: 1rem;
    opacity: 0.6;
}

.ap-hero__badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    font-size: 0.85rem;
    color: rgba(255,255,255,0.85);
    margin-bottom: 1rem;
}

.ap-hero__age {
    opacity: 0.7;
    font-size: 0.9em;
}

.ap-hero__homepage-link {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,0.3);
    transition: border-color 0.2s;
}
.ap-hero__homepage-link:hover {
    border-color: rgba(255,255,255,0.7);
    color: #fff;
}

/* ── Stats row ── */
.ap-hero__stats {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.ap-stat {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    padding: 0.8rem 1.2rem;
    min-width: 160px;
}

.ap-stat__label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255,255,255,0.5);
    margin-bottom: 0.3rem;
}

.ap-stat__value {
    font-size: 1rem;
    font-weight: 600;
}

.ap-stat__value a {
    color: #fff;
    text-decoration: none;
}

.ap-stat__value a:hover {
    text-decoration: underline;
}

.ap-stat__rating {
    color: var(--mp-accent, #e6a817);
    font-weight: 700;
    margin-left: 0.3rem;
}

/* ── Social Links ── */
.ap-hero__social {
    display: flex;
    gap: 0.6rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.ap-social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.75);
    transition: background 0.2s, color 0.2s, transform 0.2s;
    text-decoration: none;
}

.ap-social-link:hover {
    transform: translateY(-2px);
    color: #fff;
}

.ap-social-link--instagram:hover  { background: #E1306C; }
.ap-social-link--twitter:hover    { background: #1da1f2; }
.ap-social-link--facebook:hover   { background: #1877F2; }
.ap-social-link--tiktok:hover     { background: #010101; }
.ap-social-link--youtube:hover    { background: #FF0000; }
.ap-social-link--imdb:hover       { background: #F5C518; color: #000; }

/* ── Two-Column Layout ── */
.ap-content {
    max-width: 1200px;
    margin: 2rem auto 3rem;
    padding: 0 2rem;
    display: flex;
    gap: 2.5rem;
    align-items: flex-start;
}

.ap-sidebar {
    flex: 0 0 320px;
    min-width: 0;
    position: sticky;
    top: 2rem;
}

.ap-main {
    flex: 1;
    min-width: 0;
}

.ap-sidebar__section {
    background: #fff;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.ap-sidebar__heading {
    font-size: 0.95rem;
    font-weight: 700;
    color: #333;
    margin: 0 0 0.8rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #f0f0f0;
}

.ap-sidebar__count {
    font-weight: 400;
    color: #999;
    font-size: 0.85rem;
}

/* ── Personal Details (sidebar) ── */
.ap-details__list {
    margin: 0;
}

.ap-details__list dt {
    font-size: 0.78rem;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 0.7rem;
}

.ap-details__list dt:first-child {
    margin-top: 0;
}

.ap-details__list dd {
    margin: 0.15rem 0 0;
    font-size: 0.9rem;
    color: #333;
    line-height: 1.4;
}

.ap-details__age {
    color: #999;
    font-size: 0.85em;
}

/* ── Also Known As (sidebar) ── */
.ap-aka__list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.ap-aka__name {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: #f5f5f5;
    border-radius: 20px;
    font-size: 0.78rem;
    color: #555;
}

/* ── Photo Gallery (sidebar) ── */
.ap-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.ap-gallery__item {
    display: block;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 2/3;
    background: #f0f0f0;
}

.ap-gallery__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.ap-gallery__item:hover img {
    transform: scale(1.08);
}

/* ── Biography (sidebar) ── */
.ap-bio__text {
    font-size: 0.9rem;
    line-height: 1.65;
    color: #444;
    position: relative;
    max-height: 8em;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.ap-bio__text.ap-bio__text--expanded {
    max-height: 5000px;
}

.ap-bio__toggle {
    display: inline-block;
    margin-top: 0.5rem;
    color: var(--mp-accent, #e6a817);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    background: none;
    padding: 0;
}

.ap-bio__toggle:hover {
    text-decoration: underline;
}

.ap-bio__credit {
    margin-top: 0.6rem;
    font-size: 0.75rem;
    color: #aaa;
}

.ap-bio__credit a {
    color: #aaa;
    text-decoration: underline;
}

/* ── Filmography Grid (main) ── */
.ap-filmography {
    margin-bottom: 2rem;
}

.ap-filmography__heading {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: #222;
}

.ap-filmography__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.5rem;
}

.ap-film-card {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background: #f5f5f5;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ap-film-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.ap-film-card__poster-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.ap-film-card__poster {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    display: block;
    background: #e0e0e0;
}

.ap-film-card__poster--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 2/3;
    background: #e8e8e8;
    color: #bbb;
    font-size: 2.5rem;
}

.ap-film-card__info {
    padding: 0.6rem 0.7rem;
}

.ap-film-card__title {
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ap-film-card__title a {
    color: #222;
    text-decoration: none;
}

.ap-film-card__title a:hover {
    color: var(--mp-accent, #e6a817);
}

.ap-film-card__meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    color: #888;
}

.ap-film-card__rating {
    color: var(--mp-accent, #e6a817);
    font-weight: 700;
}

.ap-film-card__role {
    font-size: 0.75rem;
    color: #aaa;
    margin-top: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Admin Panel ── */
.ap-admin {
    margin: 2rem 0;
}

.ap-admin__panel {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 1.2rem 1.5rem;
}

.ap-admin__title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #555;
    margin-bottom: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ap-admin__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.ap-admin__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid #ccc;
    background: #fff;
    color: #333;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.ap-admin__btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.ap-admin__btn--primary {
    background: var(--mp-accent, #e6a817);
    color: #fff;
    border-color: var(--mp-accent, #e6a817);
}

.ap-admin__btn--primary:hover {
    background: #d4990f;
    border-color: #d4990f;
}

.ap-admin__btn--danger {
    color: #dc3545;
    border-color: #dc3545;
}

.ap-admin__btn--danger:hover {
    background: #dc3545;
    color: #fff;
}

/* ── TMDB search results ── */
.ap-tmdb-results {
    margin: 0 0 1.5rem;
}

.ap-tmdb-results__list {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.ap-tmdb-result {
    display: flex;
    gap: 0.8rem;
    padding: 0.8rem;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #fff;
    width: calc(50% - 0.5rem);
    align-items: center;
}

.ap-tmdb-result__photo {
    width: 60px;
    height: 90px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.ap-tmdb-result__info {
    flex: 1;
    min-width: 0;
}

.ap-tmdb-result__name {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
}

.ap-tmdb-result__known {
    font-size: 0.8rem;
    color: #888;
}

.ap-tmdb-result__btn {
    padding: 0.35rem 0.8rem;
    border-radius: 5px;
    font-size: 0.8rem;
    background: var(--mp-accent, #e6a817);
    color: #fff;
    border: none;
    text-decoration: none;
    white-space: nowrap;
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .ap-content {
        flex-direction: column;
        padding: 0 1.2rem;
        gap: 1.5rem;
    }

    .ap-sidebar {
        flex: none;
        width: 100%;
        position: static;
    }

    .ap-gallery {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .ap-hero__inner {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1.5rem;
        padding: 0 1.2rem;
    }

    .ap-hero__photo-wrap {
        width: 160px;
    }

    .ap-hero__photo,
    .ap-hero__photo--placeholder {
        width: 160px;
        height: 240px;
    }

    .ap-hero__name {
        font-size: 1.8rem;
    }

    .ap-hero__meta {
        justify-content: center;
    }

    .ap-hero__stats {
        justify-content: center;
    }

    .ap-hero__social {
        justify-content: center;
    }

    .ap-filmography__grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 1rem;
    }

    .ap-tmdb-result {
        width: 100%;
    }

    .ap-gallery {
        grid-template-columns: repeat(3, 1fr);
    }
}


/* ── Fancybox override: ensure overlay is full-viewport centered ── */
.fancybox-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 99992 !important;
}

.fancybox-slide {
    text-align: center !important;
}

.fancybox-slide .fancybox-image-wrap {
    margin: auto !important;
}

/* ── Upload & Crop Modal ── */
.ap-upload-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ap-upload-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
}

.ap-upload-modal__content {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 820px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.ap-upload-modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #383d40;
    color: #fff;
}

.ap-upload-modal__header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.ap-upload-modal__close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 0.3rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.ap-upload-modal__close:hover {
    opacity: 1;
}

.ap-upload-modal__iframe {
    border: none;
    width: 100%;
    height: 600px;
    max-height: 75vh;
}