/* Team Manager Frontend Styles */

/* Base container */
.tm-team-container {
    width: 100%;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    --tm-primary-color: #4ea8de;
    --tm-text-color: #333;
    --tm-card-bg: #fff;
    --tm-card-border: #e0e0e0;
    --tm-card-shadow: rgba(0, 0, 0, 0.05);
}

/* Grid Layout */
.tm-team-grid {
    display: grid;
    grid-gap: 2rem;
}

/* Responsive grid columns based on data attribute */
.tm-team-grid[data-columns="1"] {
    grid-template-columns: 1fr;
}

.tm-team-grid[data-columns="2"] {
    grid-template-columns: repeat(2, 1fr);
}

.tm-team-grid[data-columns="3"] {
    grid-template-columns: repeat(3, 1fr);
}

.tm-team-grid[data-columns="4"] {
    grid-template-columns: repeat(4, 1fr);
}

/* Grid cards */
.tm-team-card {
    background-color: var(--tm-card-bg);
    border: 1px solid var(--tm-card-border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px var(--tm-card-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    height: 100%; /* Ensure all cards have the same height */
}

.tm-team-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 12px var(--tm-card-shadow);
}

/* List Layout */
.tm-team-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.tm-team-list-item {
    display: flex;
    background-color: var(--tm-card-bg);
    border: 1px solid var(--tm-card-border);
    border-radius: 8px;
    overflow: hidden;
}

/* Member image container */
.tm-member-image-container {
    overflow: hidden;
}

.tm-team-grid .tm-member-image-container {
    width: 100%;
    aspect-ratio: 1 / 1;
}

.tm-team-list .tm-member-image-container {
    width: 120px;
    min-width: 120px;
    height: 120px;
}

/* Member image */
.tm-member-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.tm-member-image:hover {
    transform: scale(1.05);
}

/* Member content */
.tm-member-content {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    /* Make sure content fills available height for consistent button alignment */
    height: 100%;
}

/* Member name */
.tm-member-name {
    margin: 0 0 0.5rem;
    font-size: clamp(1.2rem, 2.5vw, 1.5rem);
    color: var(--tm-text-color);
    line-height: 1.2;
}

/* Member title */
.tm-member-title {
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    color: var(--tm-primary-color);
    margin-bottom: 1rem;
    font-weight: 500;
}

/* Member summary */
.tm-member-summary {
    font-size: clamp(0.85rem, 1.8vw, 1rem);
    line-height: 1.5;
    color: var(--tm-text-color);
    margin-bottom: 1.25rem;
    flex: 1; /* This allows the summary to grow and push the footer down */
    min-height: 3em; /* Minimum height to ensure some space even with short summaries */
}

/* Member footer */
.tm-member-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto; /* Pushes footer to bottom of container */
    padding-top: 0.75rem; /* Consistent spacing above the footer */
    border-top: 1px solid rgba(0, 0, 0, 0.05); /* Subtle separator */
}

/* Read more button */
.tm-member-more-btn {
    display: inline-flex;
    align-items: center;
    background-color: var(--tm-primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.2s;
    cursor: pointer; /* Show pointer cursor on hover */
}

.tm-member-more-btn:hover {
    background-color: #277da1;
    color: white;
    text-decoration: none;
}

/* LinkedIn link */
.tm-member-linkedin {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    background-color: #0a66c2;
    color: white;
    text-decoration: none;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
    cursor: pointer; /* Show pointer cursor on hover */
}

.tm-member-linkedin:hover {
    background-color: #08529c; /* Slightly darker blue */
    color: white;
}

.tm-member-linkedin .dashicons {
    font-size: 1.25rem;
    width: 1.25rem;
    height: 1.25rem;
}

/* Detail content for modal/popup */
.tm-member-detail-content {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    background-color: var(--tm-card-bg);
    border-radius: 8px;
    overflow: hidden;
}

/* Modal layout for two columns */
.tm-modal-layout {
    display: flex;
    flex-direction: row;
    height: 100%;
}

/* Left column for image and LinkedIn */
.tm-modal-left {
    width: 35%;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.03);
}

.tm-modal-image-container {
    width: 100%;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    overflow: hidden;
}

/* Using the same image styles as the grid */
.tm-modal-image-container .tm-member-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

.tm-modal-linkedin {
    display: flex;
    align-items: center;
    text-decoration: none;
    padding: 0.5rem 1rem;
    background-color: #0a66c2; /* LinkedIn blue */
    color: white;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: background-color 0.2s;
    white-space: nowrap; /* Prevent text wrapping */
    min-width: max-content; /* Ensure enough width for the text */
    width: auto; /* Allow the button to resize based on content */
    justify-content: center; /* Center the content */
    margin: 0 auto; /* Center the button in its container */
    cursor: pointer; /* Show pointer cursor on hover */
}

.tm-modal-linkedin:hover {
    background-color: #08529c; /* Slightly darker blue */
    color: white;
    text-decoration: none;
}

.tm-modal-linkedin .dashicons {
    margin-right: 0.5rem;
}

/* Right column for content */
.tm-modal-right {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    max-height: 60vh;
}

/* Modal-specific overrides for the grid styles */
.tm-modal-right .tm-member-name {
    margin: 0 0 1rem;
    font-size: clamp(1.5rem, 3vw, 2rem);
}

.tm-modal-right .tm-member-title {
    margin-bottom: 1.5rem;
}

.tm-modal-right .tm-member-summary {
    margin-bottom: 0;
}

/* Modal styles */
.tm-modal-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    overflow: auto;
}

/* Overlay to block any background interactions */
#tm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: transparent;
    z-index: 99999;
}

/* Body class for when modal is open */
body.tm-modal-open {
    overflow: hidden !important;
    height: 100% !important;
}

.tm-modal-content {
    background-color: var(--tm-card-bg, #fff);
    border-radius: 8px;
    max-width: 900px;
    width: 95%;
    max-height: 85vh;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
    overflow: hidden; /* Back to hidden for the content */
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.tm-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 24px;
    border: none;
    cursor: pointer;
    color: white;
    width: 36px;
    height: 36px;
    line-height: 36px;
    text-align: center;
    border-radius: 50%;
    background-color: var(--tm-primary-color, #0073aa);
    transition: background-color 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    padding: 0;
    margin: 0;
    z-index: 10;
}

.tm-modal-close:hover {
    background-color: rgba(255, 255, 255, 0.9);
}

/* Responsive layout */
@media (max-width: 960px) {
    .tm-team-grid[data-columns="3"],
    .tm-team-grid[data-columns="4"] {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    /* Team member list layout */
    .tm-team-list-item {
        flex-direction: column;
    }
    
    .tm-team-list .tm-member-image-container {
        width: 100%;
        height: auto;
        aspect-ratio: 16/9;
        min-width: auto;
    }
    
    /* Modal responsive layout */
    .tm-modal-layout {
        flex-direction: column;
    }
    
    .tm-modal-left {
        width: 100%;
        padding: 1.5rem 1.5rem 0;
    }
    
    .tm-modal-image-container {
        max-width: 300px;
        margin: 0 auto 1.5rem;
    }
    
    .tm-modal-right {
        padding: 1.5rem;
        max-height: none;
        overflow-y: visible;
    }
    
    .tm-modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }
}

@media (max-width: 576px) {
    .tm-team-grid[data-columns] {
        grid-template-columns: 1fr;
    }
    
    .tm-team-grid {
        grid-gap: 1.5rem;
    }
    
    .tm-modal {
        padding: 10px;
    }
    
    .tm-modal-content {
        width: 100%;
    }
}
