/**
 * @package     Joomla.Site
 * @subpackage  mod_gptw_tabbed_section
 * @author      Gemini
 * @copyright   Copyright (C) 2024. All rights reserved.
 * @license     http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

/* Main container for the tab navigation */
.gptw-tab-nav {
    display: flex;
    justify-content: center;
    margin-bottom: 0;
    border-bottom: 1px solid #ccc;
}

/* --- DESKTOP STYLES FOR TABS --- */
/* Individual tab buttons for larger screens */
.gptw-tab-filter {
    cursor: pointer;
    padding: 20px 5px; 
    border: 1px solid #ccc;
    margin-right: 20px;
    margin-bottom: -1px; /* Overlaps the bottom border for a seamless look */
    background-color: #fff;
    transition: background-color 0.3s, color 0.3s;
    text-align: center;

    /* New Font Styling */
    font-size: 12px;
    text-transform: uppercase;

    /* Smart sizing for desktop */
    flex-grow: 1;
    flex-shrink: 1;
    flex-basis: 0;
    
    /* Truncation for very long text on desktop */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 20%;
}

.gptw-tab-filter:last-child {
    margin-right: 0;
}

/* Style for the active tab button */
.gptw-tab-filter.active {
    background-color: #ff1628;
    color: white;
    border-color: #ff1628;
}

/* Container for tab content panes */
.gptw-tab-content {
    display: none;
    padding-top: 40px;
}

.gptw-tab-content.active {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.gptw-tab-content figure img.img-responsive {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.gptw-tab-content figure figcaption {
    text-align: center;
    font-style: italic;
    font-size: 0.9em;
    color: #666;
    margin-top: 10px;
}

/* --- MOBILE STYLES (THE FIX) --- */
/* On screens 768px or less, change the tab layout */
@media (max-width: 768px) {
    .gptw-tab-nav {
        /* Allow tabs to wrap onto new lines, and remove the bottom border */
        flex-wrap: wrap;
        border-bottom: none;
    }

    .gptw-tab-filter {
        /* Make each tab take up the full width */
        flex-basis: 100%;
        flex-grow: 0; /* Turn off growing */
        
        /* Adjust margins for a stacked layout */
        margin-right: 0;
        margin-bottom: 10px; /* Space between stacked tabs */

        /* Allow text to wrap naturally now that there's space */
        white-space: normal; 
    }

    .gptw-tab-content.active {
        /* On mobile, stack the text and image columns */
        flex-direction: column;
    }

    .gptw-tab-content > div[class*="col-md-"] {
        /* Ensure columns take full width and add space between them */
        width: 100%;
        margin-bottom: 20px;
    }
}
