/* === 1. OTB Page: Filter Controls === */

.otb-filters {
    display: flex;
    flex-wrap: wrap;
    /* Allows filters to stack on mobile */
    gap: 1.5rem;
    padding: 1.5rem;
    background-color: var(--color-white);
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.filter-group {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    /* Both groups will grow */
    flex-basis: 300px;
    /* Base width before growing/shrinking */
    max-height: 80px;
}

.filter-group label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

.filter-group label i {
    margin-right: 0.5rem;
    color: var(--color-secondary-dark);
}

.filter-group select,
.filter-group input[type="text"] {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    background-color: #f9f9f9;
    transition: all 0.3s ease;
}

.filter-group select:focus,
.filter-group input[type="text"]:focus {
    outline: none;
    border-color: var(--color-secondary);
    background-color: var(--color-white);
    box-shadow: 0 0 0 2px var(--color-secondary-dark-fade);
}

/* === 2. OTB Page: Table Styles === */

/* Wrapper to allow horizontal scrolling on mobile */
.otb-table-wrapper {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #eee;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.otb-table {
    width: 100%;
    min-width: 900px;
    /* Forces horizontal scroll if container is smaller */
}

.otb-table th {
    /* Use existing race-card-table styles but adjust font size */
    font-size: 0.8rem;
    background-color: var(--color-primary);
}

.otb-table td {
    vertical-align: top;
    padding: 1rem;
}

/* Specific column widths */
.otb-table .otb-area {
    width: 15%;
}

.otb-table .otb-code {
    width: 8%;
}

.otb-table .otb-name {
    width: 35%;
}

.otb-table .otb-owner {
    width: 22%;
}

.otb-table .otb-contact {
    width: 20%;
}

.otb-table td strong {
    font-weight: 700;
    color: var(--color-text-dark);
    font-size: 0.95rem;
}

.otb-table td p {
    font-size: 0.85rem;
    color: #555;
    margin: 0.25rem 0 0 0;
    line-height: 1.4;
}

/* No results message */
.no-results-message {
    padding: 2rem;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: #777;
    background-color: #fcfcfc;
}

.no-results-message i {
    color: var(--color-secondary);
    margin-right: 0.5rem;
}


/* === 3. OTB Page: Responsive Styles === */

@media (max-width: 768px) {

    /* Filters stack nicely */
    .otb-filters {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    /* Responsive table magic:
       Hide the <thead> and use data-labels to create a "card" look.
    */

    .otb-table {
        min-width: 100%;
        /* Remove min-width on mobile */
        border: none;
    }

    .otb-table thead {
        display: none;
    }

    .otb-table tr.otb-row {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #ddd;
        border-radius: 8px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
        background: var(--color-white);
    }

    .otb-table tr.otb-row:last-child {
        margin-bottom: 0;
    }

    .otb-table td {
        display: block;
        text-align: right;
        /* Align content to the right */
        padding: 0.85rem 1rem;
        /* Adjusted padding */
        position: relative;
        border-bottom: 1px solid #f0f0f0;

        /* --- FIX: Set consistent padding-left for all cells to make room for the label --- */
        padding-left: 110px;
        min-height: 2.75rem;
        /* Ensure consistent height */
        word-wrap: break-word;
        white-space: normal;
    }

    .otb-table td:last-child {
        border-bottom: none;
    }

    /* Create the label on the left */
    .otb-table td::before {
        content: attr(data-label);
        /* Use the data-label attribute */
        position: absolute;
        left: 1rem;
        top: 0.85rem;
        /* Match top padding */
        font-weight: 700;
        color: var(--color-primary);
        text-align: left;

        /* --- FIX: Ensure label doesn't wrap and has a fixed width --- */
        white-space: nowrap;
        width: 90px;
    }

    /* Adjust layout for Name/Address */
    .otb-table td[data-label="Name/Address"] {
        text-align: right;
        /* --- FIX: Make it consistent --- */
        padding-top: 0.85rem;
        /* --- FIX: Make it consistent --- */
        padding-bottom: 0.85rem;
        /* --- FIX: Make it consistent --- */
    }

    .otb-table td[data-label="Name/Address"]::before {
        top: 0.85rem;
        /* --- FIX: Make it consistent --- */
    }

    .otb-table td[data-label="Name/Address"] strong {
        display: block;
        margin-left: 0;
        /* --- FIX: Removed margin --- */
        font-size: 1rem;
        color: var(--color-text-dark);
    }

    .otb-table td[data-label="Name/Address"] p {
        margin-left: 0;
        /* --- FIX: Removed margin --- */
        font-size: 0.85rem;
        color: #555;
        margin-top: 0.25rem;
    }

    /* --- FIX: Removed the special flex-box block for other cells --- */
    /* All cells will now default to the standard 'td' styling above */
}