/* ============================================= */
/* Main Container */
/* ============================================= */
.training-sessions-container {
    margin: 30px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Search Term Highlighting */
.search-highlight {
    background-color: #ffeb3b;
    color: #000;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: bold;
}

/* Pagination Styles */
.training-pagination {
    display: flex;
    justify-content: center;
    margin: 30px 0;
    flex-wrap: wrap;
    gap: 5px;
}

.training-pagination .page-link {
    padding: 8px 15px;
    background: #f1f1f1;
    color: #333;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.3s;
    border: 1px solid #ddd;
}

.training-pagination .page-link:hover {
    background: #e5e5e5;
}

.training-pagination .page-link.active {
    background: #8e3434;
    color: white;
    border-color: #8e3434;
}

.training-pagination .page-link[data-page="prev"],
.training-pagination .page-link[data-page="next"] {
    font-weight: bold;
}

/* Responsive Pagination */
@media (max-width: 600px) {
    .training-pagination {
        gap: 3px;
    }

    .training-pagination .page-link {
        padding: 6px 10px;
        font-size: 14px;
    }
}


/* ============================================= */
/* Controls Section (Search + Sort) */
/* ============================================= */
.training-sessions-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

/* Search Box */
.search-box {
    display: flex;
    flex-grow: 1;
    min-width: 250px;
    max-width: 500px;
    height: 42px; /* Fixed height for alignment */
}
/* Search Input Wrapper */
.search-input-wrapper {
    position: relative;
    flex-grow: 1;
    height: 100%;
}


/* Search Input */
#training-search {
    width: 100%;
    padding: 10px 30px 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    font-size: 16px;
    transition: border-color 0.3s;
    height: 100%;
    box-sizing: border-box;
}
/* Clear Search Icon */
.clear-search {
    position: absolute;
    right: 10px;
    top: 47%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 20px;
    color: #999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    line-height: 1;
    padding: 0 5px;
}

.clear-search.visible {
    opacity: 1;
    visibility: visible;
}

.clear-search:hover {
    color: #333;
}


#training-search:focus {
    outline: none;
    border-color: #8e3434;
}

#search-btn {
    padding: 0 20px;
    background: #8e3434;
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.3s;
    font-weight: 500;
    height: 95%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0px 4px 4px 0px;
}

#search-btn:hover {
    background: #732929;
}

/* Adjust search input padding when clear icon is visible */
#training-search:not(:placeholder-shown) {
    padding-right: 30px;
}

/* Sort Controls */
.sort-controls {
    display: flex;
    gap: 10px;
}

.sort-btn {
    padding: 10px 20px;
    background: #f1f1f1;
    color: #333;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
    font-size: 14px;
    height: 42px; /* Match search box height */
    box-sizing: border-box;
    display: flex;
    align-items: center;
}

.sort-btn:hover {
    background: #e5e5e5;
    color: #8e3434;
}

.sort-btn.active {
    background: #8e3434;
    color: white;
    position: relative;
    padding-right: 35px;
}

.sort-btn.active:after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
}

.sort-btn.active.asc:after {
    border-bottom: 5px solid white;
    margin-top: -2px;
}

.sort-btn.active.desc:after {
    border-top: 5px solid white;
    margin-top: 2px;
}


/* ============================================= */
/* Grid Layout */
/* ============================================= */
/*.row {*/
/*    display: flex;*/
/*    flex-wrap: wrap;*/
/*    margin: 0 -15px;*/
/*}*/

/*.column {*/
/*    padding: 0 15px;*/
/*    box-sizing: border-box;*/
/*    margin-bottom: 30px;*/
/*}*/

/*.one-fourth {*/
/*    width: 25%;*/
/*}*/

.training-sessions-grid .column {
    padding: 0 15px;
    box-sizing: border-box;
    margin-bottom: 30px;
}

/* ============================================= */
/* Training Session Item */
/* ============================================= */
.training-session-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s, box-shadow 0.3s;
}

.training-session-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* Video Section */
.session-video {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    background: #000;
}

.youtube-embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.youtube-embed iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Title Section */
.session-title {
    margin: 15px 15px 5px 15px;
    font-size: 1.1em;
    color: #222;
    line-height: 1.3;
    font-weight: 600;
}

/* Date Section */
.session-date {
    margin: 0 15px 10px 15px;
    color: #777;
    font-size: 0.8em;
    text-align: right;
    font-style: italic;
}

/* Detail Section */
.session-detail {
    margin: 0 15px 15px;
    color: #555;
    font-size: 0.9em;
    line-height: 1.5;
    flex-grow: 1;
}

/* No Results Message */
.no-sessions-found {
    padding: 30px;
    text-align: center;
    color: #666;
    font-size: 1.1em;
    grid-column: 1 / -1;
}

/* Loading Spinner */
.loading-spinner {
    padding: 30px;
    text-align: center;
    color: #666;
    font-size: 1.1em;
    grid-column: 1 / -1;
}

/* Error Message */
.error-message {
    padding: 30px;
    text-align: center;
    color: #d54e21;
    font-size: 1.1em;
    grid-column: 1 / -1;
}

/* ============================================= */
/* Responsive Layout */
/* ============================================= */
@media (max-width: 1200px) {
    .one-fourth {
        width: 33.333%;
    }
}

@media (max-width: 900px) {
    .training-sessions-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        max-width: 100%;
    }

    .sort-controls {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .one-fourth {
        width: 50%;
    }
}

@media (max-width: 480px) {
    .one-fourth, .mobile-one {
        width: 100%;
    }

    .row {
        margin: 0;
    }

    .column {
        padding: 0;
    }

    .sort-controls {
        flex-direction: column;
        gap: 8px;
    }

    .sort-btn {
        width: 100%;
    }
}