/* VIS Team Members - Style v2.4.5 */

:root {
    --tm-glass-bg: rgba(255, 255, 255, 0.6);
    --tm-glass-border: rgba(255, 255, 255, 0.4);
    --tm-accent: #1d2935;
    --tm-text: #333;
    --tm-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --tm-duration: 0.8s;
    --tm-modal-z: 100000;
    --tm-zen-z: 99990;
}

.vis-tm-wrapper { width: 100%; position: relative; font-family: inherit; box-sizing: border-box; transition: background 0.3s; }
.vis-tm-wrapper * { box-sizing: border-box; }

/* --- ZEN MODE (Full Screen) --- */
.vis-tm-wrapper.vis-zen-active {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: #f8f9fa;
    z-index: var(--tm-zen-z);
    padding: 40px;
    overflow-y: auto;
}
.vis-tm-wrapper.vis-zen-active .vis-tm-grid {
    max-width: 1400px;
    margin: 0 auto;
}
.vis-tm-zen-toggle {
    background: transparent; border: none; cursor: pointer;
    color: #999; transition: 0.3s; padding: 8px;
    display: flex; align-items: center; justify-content: center;
}
.vis-tm-zen-toggle:hover { color: var(--tm-accent); transform: scale(1.1); }

/* --- TOOLBAR --- */
.vis-tm-toolbar { 
    display: flex; flex-wrap: wrap; gap: 20px; 
    margin-bottom: 40px; justify-content: space-between; align-items: center; 
}
.vis-tm-tools-left { display: flex; gap: 15px; flex: 1; min-width: 300px; align-items: center; }

/* Search Input */
.vis-tm-search { position: relative; flex: 2; }
.vis-tm-search svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); opacity: 0.5; z-index: 5; pointer-events: none; }
.vis-tm-search-input { 
    width: 100%; padding: 12px 12px 12px 40px; border-radius: 50px; 
    border: 1px solid rgba(0,0,0,0.1); background: rgba(255, 255, 255, 0.5); 
    backdrop-filter: blur(5px); transition: 0.3s; font-size: 0.95rem; 
}
.vis-tm-search-input:focus { background: #fff; box-shadow: 0 5px 15px rgba(0,0,0,0.05); border-color: var(--tm-accent); outline: none; }

/* Custom Sort Dropdown */
.vis-tm-sort-custom { position: relative; flex: 1; min-width: 160px; font-size: 0.9rem; z-index: 10; }
.vis-tm-sort-trigger {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 20px; background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0,0,0,0.1); border-radius: 50px;
    cursor: pointer; transition: all 0.3s ease; backdrop-filter: blur(5px);
    color: var(--tm-text); font-weight: 500;
}
.vis-tm-sort-trigger:hover, .vis-tm-sort-custom.active .vis-tm-sort-trigger { background: #fff; border-color: var(--tm-accent); box-shadow: 0 5px 15px rgba(0,0,0,0.05); }
.vis-tm-sort-options {
    position: absolute; top: calc(100% + 10px); left: 0; width: 100%;
    background: #fff; border-radius: 15px; box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    padding: 10px; margin: 0; list-style: none; opacity: 0; visibility: hidden;
    transform: translateY(-10px); transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1); z-index: 20;
}
.vis-tm-sort-custom.active .vis-tm-sort-options { opacity: 1; visibility: visible; transform: translateY(0); }
.vis-tm-sort-item { padding: 8px 15px; border-radius: 8px; cursor: pointer; transition: 0.2s; color: #555; margin-bottom: 2px; }
.vis-tm-sort-item:hover { background: #f5f5f5; color: var(--tm-accent); }
.vis-tm-sort-item.active { background: var(--tm-accent); color: #fff; }

/* Filters (Capsule) */
.vis-tm-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.vis-tm-filter-btn { 
    background: transparent; border: 1px solid rgba(0,0,0,0.1); 
    padding: 8px 20px; border-radius: 50px; cursor: pointer; 
    color: #666; font-size: 0.85rem; font-weight: 600; 
    transition: all 0.3s ease; text-transform: uppercase; letter-spacing: 0.5px; 
}
.vis-tm-filter-btn:hover { background: #fff; color: var(--tm-accent); border-color: var(--tm-accent); transform: translateY(-1px); }
.vis-tm-filter-btn.active { background: var(--tm-accent); color: #fff; border-color: var(--tm-accent); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }

/* --- GRID --- */
.vis-tm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; }
.vis-tm-wrapper.has-active-card .vis-tm-card:not(.is-expanded) { opacity: 0.1; filter: blur(4px) grayscale(1); pointer-events: none; transform: scale(0.85); transition: all 0.8s; }

/* Animations */
@keyframes visFadeUp { from { opacity: 0; transform: translateY(40px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes visSkeleton { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* --- CARD BASE --- */
.vis-tm-card {
    position: relative; background: var(--tm-glass-bg);
    border: 1px solid var(--tm-glass-border); backdrop-filter: blur(10px);
    border-radius: 20px; cursor: pointer;
    transition: transform 0.1s ease-out, opacity 0.5s, filter 0.5s;
    will-change: transform, top, left, width, height;
    box-sizing: border-box; overflow: hidden;
    opacity: 1; transform: translateY(0);
}
.vis-tm-card.vis-stagger-active { opacity: 0; animation-name: visFadeUp; animation-duration: 0.8s; animation-fill-mode: forwards; animation-timing-function: cubic-bezier(0.25, 1, 0.25, 1); }
.vis-tm-card:focus-visible { outline: 2px solid var(--tm-accent); outline-offset: 4px; }
.vis-tm-placeholder { background: transparent; pointer-events: none; }

/* Glow & Skeleton */
.vis-tm-glow {
    position: absolute; top: 50%; left: 50%; width: 100%; height: 100%;
    transform: translate(-50%, -50%) scale(0.8);
    background: radial-gradient(circle, var(--tm-accent) 0%, transparent 70%);
    opacity: 0; transition: opacity 0.5s ease; z-index: 0; pointer-events: none; filter: blur(40px);
}
.vis-tm-card:hover .vis-tm-glow { opacity: 0.15; }

.vis-tm-card-inner { position: relative; z-index: 1; padding: 40px 20px; display: flex; flex-direction: column; align-items: center; text-align: center; height: 100%; width: 100%; transition: all var(--tm-duration) var(--tm-ease); }

/* --- TEAM BUILDER BUTTON (ON CARD) --- */
.vis-tm-add-btn {
    position: absolute; top: 15px; right: 15px;
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(255,255,255,0.7); border: 1px solid rgba(0,0,0,0.05);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; z-index: 10; transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: #999;
}
.vis-tm-add-btn:hover { background: #fff; transform: scale(1.1); color: var(--tm-accent); }
.vis-tm-add-btn.active { background: var(--tm-accent); color: #fff; border-color: var(--tm-accent); transform: scale(1.1); }
.vis-tm-icon-check { display: none; }
.vis-tm-add-btn.active .vis-tm-icon-add { display: none; }
.vis-tm-add-btn.active .vis-tm-icon-check { display: block; }
.vis-tm-card.is-expanded .vis-tm-add-btn { display: none; }

/* --- VISUALS (PHOTO & VIDEO HOVER) --- */
.vis-tm-photo-wrapper {
    width: 140px; height: 140px; border-radius: 50%; overflow: hidden; margin-bottom: 20px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1); position: relative; z-index: 2;
    transition: all var(--tm-duration) var(--tm-ease); background: #f0f0f0;
}
.vis-tm-photo-wrapper.vis-tm-skeleton { background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%); background-size: 200% 100%; animation: visSkeleton 1.5s infinite; }
.vis-tm-photo-wrapper.vis-tm-skeleton img { opacity: 0; }

.vis-tm-photo { width: 100%; height: 100% !important; object-fit: cover; display: block; opacity: 1; transition: opacity 0.4s ease; position: relative; z-index: 2; }

/* Video Styles */
.vis-tm-video {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    opacity: 0; 
    transition: opacity 0.4s ease;
    z-index: 3; 
    border-radius: 50%;
}
.vis-tm-photo-wrapper.vis-video-active .vis-tm-video { opacity: 1; }
.vis-tm-photo-wrapper.vis-video-active .vis-tm-photo { opacity: 0; }

/* --- TEXTS --- */
.vis-tm-texts { z-index: 2; width: 100%; transition: all var(--tm-duration) var(--tm-ease); overflow: hidden; color: var(--tm-text); }
.vis-tm-name { margin: 0 0 5px; color: var(--tm-accent); font-size: 1.2rem; white-space: nowrap; transform-origin: center top; transition: all var(--tm-duration) var(--tm-ease); }
.vis-tm-job { display: block; font-size: 0.9rem; color: #666; font-weight: 600; margin-bottom: 15px; text-transform: uppercase; letter-spacing: 1px; transform-origin: center top; transition: all var(--tm-duration) var(--tm-ease); }
.vis-tm-short { font-size: 0.9rem; color: #555; line-height: 1.5; margin: 0; transition: all var(--tm-duration) var(--tm-ease); }

.vis-tm-full, .vis-tm-extra-content, .vis-tm-close-card, .vis-tm-footer { display: none; opacity: 0; }

/* --- EXPANDED CARD (STANDARD LAYOUT) --- */
.vis-tm-card.is-expanded { 
    background: #fff; box-shadow: 0 25px 50px rgba(0,0,0,0.3); 
    border-radius: 15px; cursor: default; 
    max-width: 900px;
    width: 90vw; 
    max-height: 90vh; 
    display: flex;
    flex-direction: column;
    opacity: 1 !important; transform: translate(-50%, -50%) !important; 
}

.vis-tm-card.is-expanded .vis-tm-card-inner { 
    display: grid; 
    grid-template-columns: 350px 1fr; 
    gap: 40px; 
    padding: 50px; 
    align-items: start; 
    text-align: left; 
    height: 100%;
    overflow: hidden; 
}

.vis-tm-card.is-expanded .vis-tm-photo-wrapper { 
    width: 100%; aspect-ratio: 1/1; height: auto; border-radius: 15px; margin: 0; 
}

/* Scrollable Text Area */
.vis-tm-card.is-expanded .vis-tm-texts { 
    height: 100%; 
    overflow-y: auto; 
    padding-right: 30px; 
    scrollbar-width: thin;
    scrollbar-color: var(--tm-accent) #f0f0f0;
}
.vis-tm-card.is-expanded .vis-tm-texts::-webkit-scrollbar { width: 6px; }
.vis-tm-card.is-expanded .vis-tm-texts::-webkit-scrollbar-track { background: #f5f5f5; border-radius: 3px; }
.vis-tm-card.is-expanded .vis-tm-texts::-webkit-scrollbar-thumb { background: var(--tm-accent); border-radius: 3px; }

/* Expanded Text Styles */
.vis-tm-card.is-expanded .vis-tm-name { 
    font-size: 2.5rem; 
    margin-bottom: 10px; 
    transform-origin: left top; 
    white-space: normal; 
}
.vis-tm-card.is-expanded .vis-tm-job { transform-origin: left top; margin-bottom: 30px; }
.vis-tm-card.is-expanded .vis-tm-short { font-size: 1.1rem; font-weight: 500; color: var(--tm-text); margin-bottom: 20px; }
.vis-tm-card.is-expanded .vis-tm-full { line-height: 1.6; margin-bottom: 30px; }
.vis-tm-card.is-expanded .vis-tm-full p { margin-bottom: 1em; }

/* --- WIDE LAYOUT (No Skills) --- */
/* In this mode, we break the structure using display:contents to rearrange grid */
@media (min-width: 769px) {
    .vis-tm-card.is-expanded.vis-layout-wide {
        overflow-y: auto; /* Scroll entire card */
    }
    
    .vis-tm-card.is-expanded.vis-layout-wide .vis-tm-card-inner {
        overflow: visible;
        height: auto;
        padding-right: 20px; /* General padding */
        /* Redefine grid for the unwrapped items */
        display: grid;
        grid-template-columns: 350px 1fr;
        grid-template-rows: min-content min-content min-content 1fr;
        gap: 0 40px;
    }
    
    /* Unwrap containers */
    .vis-tm-card.is-expanded.vis-layout-wide .vis-tm-texts,
    .vis-tm-card.is-expanded.vis-layout-wide .vis-tm-bio-wrapper {
        display: contents;
    }
    
    /* Reposition Elements */
    .vis-tm-card.is-expanded.vis-layout-wide .vis-tm-visuals {
        grid-column: 1;
        grid-row: 1 / 4; /* Span rows next to header info */
        margin-bottom: 20px;
    }
    
    .vis-tm-card.is-expanded.vis-layout-wide .vis-tm-name { 
        grid-column: 2; grid-row: 1; align-self: end; margin-bottom: 5px; 
    }
    .vis-tm-card.is-expanded.vis-layout-wide .vis-tm-job { 
        grid-column: 2; grid-row: 2; margin-bottom: 20px; 
    }
    .vis-tm-card.is-expanded.vis-layout-wide .vis-tm-short { 
        grid-column: 2; grid-row: 3; margin-bottom: 20px; 
    }
    
    /* Full Width Elements underneath */
    .vis-tm-card.is-expanded.vis-layout-wide .vis-tm-full {
        grid-column: 1 / -1;
        grid-row: 4;
        margin-top: 20px;
        padding-right: 20px; /* Ensure text doesn't hit scrollbar edge */
    }
    .vis-tm-card.is-expanded.vis-layout-wide .vis-tm-footer {
        grid-column: 1 / -1;
        grid-row: 5;
    }
}

/* Closing Fix */
.vis-tm-card.is-expanded.is-closing .vis-tm-card-inner { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 40px 20px; overflow: visible; }
.vis-tm-card.is-expanded.is-closing .vis-tm-photo-wrapper { width: 140px; height: 140px; border-radius: 50%; margin-bottom: 20px; }
.vis-tm-card.is-expanded.is-closing .vis-tm-name { font-size: 1.2rem; transform-origin: center top; margin-bottom: 5px; }
.vis-tm-card.is-expanded.is-closing .vis-tm-job { transform-origin: center top; margin-bottom: 15px; }
.vis-tm-card.is-expanded.is-closing .vis-tm-short { font-size: 0.9rem !important; font-weight: 400 !important; margin-bottom: 0 !important; text-align: center !important; color: #555 !important; }
.vis-tm-card.is-expanded.is-closing .vis-tm-texts { overflow-y: hidden; height: auto; padding-right: 0; }
.vis-tm-card.is-expanded.is-closing .vis-tm-full, .vis-tm-card.is-expanded.is-closing .vis-tm-extra-content, .vis-tm-card.is-expanded.is-closing .vis-tm-footer, .vis-tm-card.is-expanded.is-closing .vis-tm-close-card { display: none !important; }

/* Content Reveal */
.vis-tm-card.is-content-visible .vis-tm-full, .vis-tm-card.is-content-visible .vis-tm-extra-content, .vis-tm-card.is-content-visible .vis-tm-footer { display: block; animation: visFadeUp 0.8s forwards; }
.vis-tm-card.is-content-visible .vis-tm-close-card { display: block; opacity: 1; }

.vis-tm-section-title { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; color: #999; margin: 0 0 15px; font-weight: 700; }
.vis-tm-skill-header { display: flex; justify-content: space-between; font-size: 0.85rem; font-weight: 600; margin-bottom: 4px; color: var(--tm-text); }
.vis-tm-extra-content { margin-top: 30px; }
.vis-tm-skill { margin-bottom: 12px; }
.vis-tm-skill-track { width: 100%; height: 6px; background: #eee; border-radius: 3px; }
.vis-tm-skill-bar { height: 100%; background: var(--tm-accent); width: 0; animation: visGrow 1.2s 0.3s forwards; border-radius: 3px; }
@keyframes visGrow { to { width: var(--w); } }

.vis-tm-footer { margin-top: 40px; border-top: 1px solid #eee; padding-top: 20px; width: 100%; }
.vis-tm-footer-row { display: flex; justify-content: space-between; align-items: center; }
.vis-tm-socials { display: flex; gap: 10px; flex-wrap: wrap; }
.vis-tm-socials a { width: 44px; height: 44px; border-radius: 50%; background: #f5f5f5; color: #333; display: flex; align-items: center; justify-content: center; transition: 0.3s; font-size: 18px; }
.vis-tm-socials a:hover { background: var(--tm-accent); color: #fff !important; transform: translateY(-3px); }
.vis-tm-socials a i { color: inherit; } .vis-tm-socials a svg { width: 20px; height: 20px; fill: currentColor; } .vis-tm-socials a:hover i, .vis-tm-socials a:hover svg { fill: #fff; color: #fff; }
.vis-tm-qr img { width: 80px; mix-blend-mode: multiply; }

.vis-tm-close-card { position: absolute; top: 20px; right: 20px; background: #f5f5f5; border: none; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; font-size: 24px; transition: 0.2s; color: var(--tm-text); }
.vis-tm-close-card:hover, .vis-tm-close-card:focus { background: var(--tm-accent); color: #fff; outline: none; }

.vis-tm-backdrop { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); backdrop-filter: blur(5px); z-index: 9999; opacity: 0; pointer-events: none; transition: var(--tm-duration); }
.vis-tm-backdrop.is-visible { opacity: 1; pointer-events: auto; }

/* --- TEAM BUILDER: FLOATING FAB & MODAL --- */
.vis-tm-basket-fab {
    position: fixed; bottom: 30px; right: 30px;
    background: var(--tm-accent); color: #fff;
    padding: 12px 25px; border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    cursor: pointer; z-index: var(--tm-modal-z);
    display: flex; align-items: center; gap: 10px;
    transform: translateY(100px); opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-weight: 600;
}
.vis-tm-basket-fab.visible { transform: translateY(0); opacity: 1; }
.vis-tm-basket-fab:hover { transform: translateY(-5px); box-shadow: 0 15px 35px rgba(0,0,0,0.3); }
.vis-tm-basket-count { background: #fff; color: var(--tm-accent); width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 800; }

.vis-tm-modal-backdrop {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7); backdrop-filter: blur(5px);
    z-index: var(--tm-modal-z); opacity: 0; pointer-events: none;
    display: flex; align-items: center; justify-content: center;
    transition: 0.3s;
}
.vis-tm-modal-backdrop.active { opacity: 1; pointer-events: auto; }

.vis-tm-modal {
    background: #fff; width: 90%; max-width: 500px;
    border-radius: 20px; padding: 40px; position: relative;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    transform: translateY(30px); transition: 0.4s;
    max-height: 90vh; overflow-y: auto;
}
.vis-tm-modal-backdrop.active .vis-tm-modal { transform: translateY(0); }
.vis-tm-modal-close { position: absolute; top: 20px; right: 20px; background: transparent; border: none; font-size: 24px; cursor: pointer; color: #999; }
.vis-tm-modal-title { margin-top: 0; color: var(--tm-accent); font-size: 1.5rem; margin-bottom: 20px; }

.vis-tm-selected-list { margin-bottom: 20px; border-bottom: 1px solid #eee; padding-bottom: 15px; }
.vis-tm-selected-item { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed #eee; font-size: 0.95rem; }
.vis-tm-sel-name { font-weight: 600; color: var(--tm-text); }
.vis-tm-sel-job { color: #888; font-size: 0.85rem; }

.vis-tm-inquiry-form input, .vis-tm-inquiry-form textarea {
    width: 100%; padding: 12px; margin-bottom: 15px; border-radius: 8px; border: 1px solid #ddd; font-family: inherit;
}
.vis-tm-inquiry-form textarea { resize: vertical; }

.vis-tm-submit-btn {
    width: 100%; background: var(--tm-accent); color: #fff; border: none; padding: 14px; border-radius: 8px; font-weight: 600; cursor: pointer; transition: 0.3s; display: flex; align-items: center; justify-content: center; gap: 10px;
}
.vis-tm-submit-btn:hover { background: #333; }
.vis-tm-submit-btn.loading { opacity: 0.7; pointer-events: none; }

.vis-tm-loader {
    width: 16px; height: 16px; border: 2px solid #fff; border-bottom-color: transparent; border-radius: 50%; display: none; animation: visSpin 1s linear infinite;
}
.vis-tm-submit-btn.loading .vis-tm-loader { display: block; }
@keyframes visSpin { to { transform: rotate(360deg); } }

.vis-tm-form-message { margin-top: 15px; font-size: 0.9rem; text-align: center; }
.vis-tm-form-message.success { color: green; }
.vis-tm-form-message.error { color: red; }

/* MOBILE RESPONSIVE */
@media (max-width: 768px) {
    .vis-tm-toolbar { flex-direction: column; }
    .vis-tm-tools-left { width: 100%; }
    .vis-tm-filters { width: 100%; overflow-x: auto; padding-bottom: 5px; justify-content: flex-start; }
    .vis-tm-grid { grid-template-columns: 1fr; }
    
    .vis-tm-card.is-expanded { 
        width: 95vw !important; 
        max-height: 90vh !important; 
        overflow-y: auto; 
        display: block; 
    }
    
    .vis-tm-card.is-expanded .vis-tm-card-inner { 
        grid-template-columns: 1fr; 
        padding: 20px; 
        display: flex;
        flex-direction: column;
        height: auto;
        overflow: visible;
        /* Reset any desktop grid */
        gap: 0;
    }
    
    .vis-tm-card.is-expanded .vis-tm-texts { 
        overflow-y: visible; 
        height: auto; 
        display: block; /* Ensure contents reset */
        padding-right: 0;
    }

    /* Reset layouts for Wide mode on mobile */
    .vis-tm-card.is-expanded.vis-layout-wide .vis-tm-card-inner {
        display: flex;
        flex-direction: column;
        gap: 0;
    }
    .vis-tm-card.is-expanded.vis-layout-wide .vis-tm-texts,
    .vis-tm-card.is-expanded.vis-layout-wide .vis-tm-bio-wrapper {
        display: block;
    }
    .vis-tm-card.is-expanded.vis-layout-wide .vis-tm-visuals {
        margin-bottom: 20px;
    }
    
    .vis-tm-footer-row { flex-direction: column; align-items: flex-start; gap: 20px; }
    .vis-tm-modal { padding: 25px; width: 95%; }
}