/*
    ---------------------------------------------------------------------------------
    -- 1. General/Global Styles
    ---------------------------------------------------------------------------------
*/
.hidden {
    display: none !important;
}

.card {
    background-color: #ffffff;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.input-text {
    border: 1px solid #d1d5db;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    width: 100%;
    font-size: 0.875rem;
}

.btn-primary {
    background-color: #1f2937;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: #111827;
}

.container-title {
    color: var(--color-primary, #1a472a);
    font-weight: 700;
    margin-bottom: 1rem;
    text-transform: uppercase;
    border-left: 5px solid var(--color-secondary, #f6bc3f);
    padding-left: 1rem;
    font-size: 1.25rem;
}

/*
    ---------------------------------------------------------------------------------
    -- 2. Header Section
    ---------------------------------------------------------------------------------
*/
.header-section {
    background: linear-gradient(135deg, var(--color-primary, #1a472a) 0%, #0d2b18 100%);
    color: white;
    padding: 2rem;
    border-radius: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.header-title {
    font-size: 2rem;
    font-weight: 800;
    margin: 0 0 0.5rem 0;
    color: var(--color-secondary, #f6bc3f);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.search-container {
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem;
    border-radius: 0.5rem;
    backdrop-filter: blur(5px);
}

.search-container input {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    min-width: 250px;
}

/*
    ---------------------------------------------------------------------------------
    -- 3. Tables (List, Stats, History)
    ---------------------------------------------------------------------------------
*/
/* NEW: Ensure the container scrolls horizontally on small screens */
.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Smooth scrolling on iOS */
    margin-top: 1rem;
}

.trainer-list-table,
.stats-table,
.race-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
    /* Prevents text wrapping to keep rows neat */
}

.trainer-list-table thead th,
.stats-table thead th,
.race-table thead th {
    background-color: var(--color-primary, #1a472a);
    color: white;
    text-align: left;
    padding: 0.75rem 1rem;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

.trainer-list-table tbody tr,
.stats-table tbody tr,
.race-table tbody tr {
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.2s;
}

.trainer-list-table tbody tr:hover,
.stats-table tbody tr:hover,
.race-table tbody tr:hover {
    background-color: #f9fafb;
}

.trainer-list-table td,
.stats-table td,
.race-table td {
    padding: 0.75rem 1rem;
    color: #374151;
}

.trainer-list-table tbody tr {
    cursor: pointer;
}

.text-center {
    text-align: center;
}

/*
    ---------------------------------------------------------------------------------
    -- 4. Profile Layout
    ---------------------------------------------------------------------------------
*/
.profile-content {
    display: flex;
    flex-direction: column-reverse;
    gap: 2rem;
}

.profile-details-column {
    flex: 2;
}

.profile-image-column {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.trainer-image {
    width: 200px;
    height: 200px;
    object-fit: cover;
    border-radius: 50%;
    border: 5px solid var(--color-secondary, #f6bc3f);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/*
    ---------------------------------------------------------------------------------
    -- 5. Play Button (Replay)
    ---------------------------------------------------------------------------------
*/
.play-btn {
    transition: transform 0.2s, color 0.2s;
}

.play-btn:hover {
    transform: scale(1.2);
    color: #dc2626 !important;
}

/*
    ---------------------------------------------------------------------------------
    -- 6. Video Modal
    ---------------------------------------------------------------------------------
*/
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.modal-content {
    background: white;
    width: 100%;
    max-width: 800px;
    border-radius: 0.5rem;
    overflow: hidden;
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background-color: #f3f4f6;
    border-bottom: 1px solid #e5e7eb;
}

.close-modal {
    font-size: 1.5rem;
    font-weight: bold;
    color: #6b7280;
    cursor: pointer;
    line-height: 1;
}

.close-modal:hover {
    color: #ef4444;
}

.video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    background: black;
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/*
    ---------------------------------------------------------------------------------
    -- 7. Responsive Styles
    ---------------------------------------------------------------------------------
*/
@media (min-width: 768px) {
    .profile-content {
        flex-direction: row;
        align-items: flex-start;
    }

    .profile-image-column {
        justify-content: flex-end;
    }

    .trainer-image {
        width: 250px;
        height: 250px;
    }
}

@media (max-width: 768px) {
    .header-section {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem;
    }

    .search-container {
        width: 100%;
    }

    .search-container input {
        width: 100%;
        min-width: unset;
    }
}