/* Public Portfolio Styles (Cinematic Sale Engine) */

/* Layout */
body {
    overflow-x: hidden;
}

.portfolio-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-md);
}

/* Header / Filters */
.portfolio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--border-glass);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.header-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    width: 100%;
    /* Ensure full width for scrolling */
}

.filter-group {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 5px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-grow: 1;
    /* Allow it to take up space */
    flex-wrap: nowrap;
    /* Prevent wrapping on mobile */
    mask-image: linear-gradient(to left, black 85%, transparent 100%);
    /* Subtle fade on the edge */
}

.filter-group::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-body);
    white-space: nowrap;
    font-size: 0.9rem;
    flex-shrink: 0;
    /* Important for horizontal scrolling */
}

.filter-btn.active,
.filter-btn:hover {
    background: var(--brand-cyan);
    color: #000;
    border-color: var(--brand-cyan);
    font-weight: 600;
}

.lang-toggle-btn {
    background: none;
    border: 1px solid var(--border-glass);
    padding: 6px 12px;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.lang-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--brand-cyan);
}

/* Featured Hero */
.featured-hero {
    position: relative;
    width: 100%;
    height: 60vh;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: var(--space-xl);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    background: #000;
}

@media (max-width: 768px) {
    .featured-hero {
        height: 40vh;
        margin-bottom: var(--space-lg);
    }

    .play-button-large {
        width: 60px;
        height: 60px;
    }
}

.featured-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: var(--space-lg);
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95), transparent);
    z-index: 2;
}

.play-button-large {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 2;
}

.play-button-large:hover {
    background: var(--brand-cyan);
    transform: translate(-50%, -50%) scale(1.1);
    border-color: var(--brand-cyan);
}

/* Grid */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-md);
}

@media (max-width: 480px) {
    .portfolio-grid {
        grid-template-columns: 1fr;
    }
}

.portfolio-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 16/9;
    cursor: pointer;
    background: #000;
}

.portfolio-card.is-vertical {
    aspect-ratio: 9/16;
}

.portfolio-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
    opacity: 0.8;
}

.portfolio-card:hover img {
    transform: scale(1.05);
    opacity: 1;
}

.card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
    transform: translateY(10px);
    transition: transform 0.3s ease;
}

.portfolio-card:hover .card-overlay {
    transform: translateY(0);
}

/* Modal (Sales Engine Core) */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-backdrop.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    width: 95%;
    max-width: 1000px;
    max-height: 95vh;
    height: auto;
    background: #0f0f0f;
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    overflow: hidden;
    display: grid;
    grid-template-columns: 2fr 1fr;
    /* Video Area : Sales Area */
    box-shadow: 0 0 50px rgba(0, 188, 212, 0.2);
}

/* Vertical Video Modal Adjustments */
.modal-content.is-vertical {
    grid-template-columns: 45vh 1fr;
    max-width: 800px;
}

.modal-content.is-vertical .modal-video-area iframe {
    aspect-ratio: 9/16;
    height: 100%;
    max-height: 85vh;
    width: auto !important;
}

.modal-video-area {
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-sales-area {
    background: #1a1a1a;
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    height: 100%;
    border-left: 1px solid var(--border-glass);
    overflow: hidden;
    /* Main container fixed, children scroll */
}

#modal-details {
    flex: 1;
    overflow-y: auto;
    margin-bottom: var(--space-md);
    padding-right: 8px;
    /* Space for scrollbar */
}

/* Cinematic Slim Scrollbar */
#modal-details::-webkit-scrollbar {
    width: 4px;
}

#modal-details::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

#modal-details::-webkit-scrollbar-thumb {
    background: var(--brand-cyan);
    border-radius: 10px;
}

.cta-box {
    flex-shrink: 0;
    background: linear-gradient(135deg, rgba(0, 188, 212, 0.1), rgba(106, 27, 154, 0.1));
    padding: var(--space-md);
    border-radius: 12px;
    border: 1px solid var(--border-glass);
}

.cta-btn {
    width: 100%;
    margin-top: 10px;
    padding: 12px;
    background: var(--brand-cyan);
    color: #000;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: background 0.3s;
}

.cta-btn:hover {
    background: #fff;
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    color: white;
    font-size: 2.5rem;
    cursor: pointer;
    z-index: 1100;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

/* Responsive Modal */
@media (max-width: 1100px) {
    .modal-content {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        height: auto;
        max-height: 95vh;
        width: 95%;
        overflow-y: auto;
    }

    .modal-video-area {
        aspect-ratio: 16/9;
        width: 100%;
        position: relative;
        /* Remove sticky to allow natural scrolling if height is tight */
        z-index: 5;
    }

    .modal-content.is-vertical {
        max-width: 500px;
    }

    .modal-content.is-vertical .modal-video-area {
        aspect-ratio: 9/16;
        max-height: 60vh;
    }

    #modal-details {
        overflow-y: visible;
        /* Back to normal scrolling on mobile */
        max-height: none;
        padding-right: 0;
    }

    .modal-sales-area {
        border-left: none;
        border-top: 1px solid var(--border-glass);
        padding: var(--space-md);
        overflow-y: visible;
        /* Content scrolls with the modal body */
        max-height: none;
        height: auto;
    }
}

@media (max-width: 600px) {
    .portfolio-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .portfolio-header h1 {
        font-size: 1.5rem;
    }

    .portfolio-container {
        padding: var(--space-sm);
    }
}