/* static/css/tabbed.css */

.tabbed-interactive-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%; /* Fill the .interactive-container */
    background-color: #f0f0f0;
    padding: 20px; /* Increased padding */
    border-radius: 8px; /* Consistent with other potential interactive styles */
    box-sizing: border-box;
    overflow: hidden; /* Prevent content spill during animations */
}

.interactive-title {
    text-align: center;
    margin-bottom: 10px; /* Reduced margin for cohesion */
    font-size: 1.5em;
    color: #333;
}

.tab-buttons-container {
    display: flex;
    flex-wrap: wrap; /* Allow tabs to wrap on smaller screens */
    margin-bottom: 15px; /* Increased margin for separation */
    border-bottom: 2px solid #ccc;
}

.tab-button {
    padding: 10px 15px;
    cursor: pointer;
    border: none;
    background-color: transparent;
    font-size: 1em;
    color: #555;
    border-bottom: 2px solid transparent; /* For active state */
    transition: color 0.3s ease, border-bottom-color 0.3s ease;
    margin-right: 5px; /* Spacing between tab buttons */
}

.tab-button:hover {
    color: #007bff;
}

.tab-button.active {
    color: #007bff;
    border-bottom-color: #007bff;
    font-weight: bold;
}

.tab-content-container {
    flex-grow: 1;
    position: relative; /* For absolute positioning of panes during transition */
    overflow-y: auto; /* Allow scrolling for long content within a tab */
    overflow-x: hidden; /* Prevent horizontal scrollbar during slide transition */
}

.tab-content-pane {
    padding: 15px;
    background-color: #fff;
    border-radius: 5px;
    border: 1px solid #ddd;
    
    
    
    /* Animation properties */
    opacity: 0;
    visibility: hidden; /* Delayed to hide after transition */
    position: absolute; /* Take out of flow for transitions */
    width: calc(100% - 30px); /* Account for padding */
    height: calc(100% - 30px); /* Account for padding */
    left: 15px; /* Align with container padding */
    top: 15px;  /* Align with container padding */
    transform: translateX(30px); /* Start off-screen to the right for slide-in */

    transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out, visibility 0s linear 0.5s;
    overflow-y: auto; /* Scroll within the pane if content overflows */
}

.tab-content-pane.active {
    opacity: 1;
    visibility: visible;
    position: relative; /* Bring back into flow */
    width: auto; /* Reset width */
    height: 100%; /* Reset height */
    left: auto;
    top: auto;
    transform: translateX(0); /* Slide to original position */
    transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out; /* Animate opacity and transform */
}

.tab-image-container {
    max-width: 100%;
    margin-bottom: 15px;
    aspect-ratio: 3 / 2; /* Reverted to 3/2 aspect ratio */
    text-align: center; /* Center the image if it's smaller than container */
    max-height: 200px; /* Added max-height to constrain container size */
    display: flex; /* Added to help center image within constrained container */
    justify-content: center; /* Added to help center image */
    align-items: center; /* Added to help center image */
}

.tab-image-container img {
    max-width: 100%;
    max-height: 100%; /* Image should not exceed container's max-height */
    height: auto; /* Maintain aspect ratio, adjusted by max-height of container */
    width: auto; /* Maintain aspect ratio, let height drive it if container is taller than wide for 3:2 */
    /* object-fit is now handled by specific classes below */
    border-radius: 4px;
    border: 1px solid #eee;
}

/* Default style (Fit/Contain) */
.tab-image-container.image-style-contain img {
    object-fit: contain; 
}

/* Fill/Cover style */
.tab-image-container.image-style-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tab-text-content {
    line-height: 1.6;
    color: #333;
}

.tab-text-content h1,
.tab-text-content h2,
.tab-text-content h3 {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
    color: #111;
}

.tab-text-content p {
    margin-bottom: 1em;
}

.tab-text-content ul,
.tab-text-content ol {
    margin-left: 20px;
    margin-bottom: 1em;
}

.tab-text-content pre {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    padding: 10px;
    border-radius: 4px;
    overflow-x: auto;
}

.tab-text-content code {
    font-family: monospace;
    background-color: #e9ecef;
    padding: 0.2em 0.4em;
    border-radius: 3px;
}

.tab-text-content pre code {
    background-color: transparent;
    padding: 0;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .tabbed-interactive-wrapper {
        padding: 10px;
    }
    .tab-button {
        padding: 8px 10px;
        font-size: 0.9em;
    }
    .interactive-title {
        font-size: 1.3em;
        margin-bottom: 10px;
    }
    .tab-content-pane {
        padding: 10px;
    }
}
