/* ==========================================================================
   GLOBAL RESPONSIVE DESIGN SYSTEM FOR TABLERO ENGINE
   ========================================================================== */

.tablero-wrap {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Ensure all form inputs inherit fluent sizing properties natively */
.tablero-wrap input[type="text"],
.tablero-wrap input[type="number"],
.tablero-wrap textarea,
.tablero-wrap select {
    box-sizing: border-box;
    max-width: 100%;
}

/* --------------------------------==========================================
   1. FLUID GRID FOR FORMS (Overrides inline floating parameters)
   ========================================================================== */
.tablero-wrap form {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 15px;
    width: 100%;
}

/* Standardize layout titles and horizontal separators across the grid */
.tablero-wrap form h3,
.tablero-wrap form h4,
.tablero-wrap form hr,
.tablero-wrap form .notice {
    grid-column: span 12;
    margin: 5px 0;
}

/* Override your existing 48% / 31% inline float style attributes cleanly */
.tablero-wrap form p[style*="float: left"] {
    float: none !important;
    width: 100% !important;
    margin-right: 0 !important;
}

/* Assign structural grid spaces to standard field paragraphs */
.tablero-wrap form p {
    grid-column: span 12; /* Default to mobile-first full width */
    margin: 0;
}

@media (min-width: 768px) {
    /* Half-width block assignments */
    .tablero-wrap form p[style*="width: 48%"],
    .tablero-wrap form p[style*="width: 48%; float: left"] {
        grid-column: span 6;
    }
    
    /* Third-width block assignments */
    .tablero-wrap form p[style*="width: 31%"],
    .tablero-wrap form p[style*="width: 31%; float: left"] {
        grid-column: span 4;
    }
}

/* --------------------------------==========================================
   2. RESPONSIVE DATA TABLES (Transforms dense tables to adaptive cards)
   ========================================================================== */
@media (max-width: 767px) {
    /* Hide the standard table header row on small screens */
    .tablero-wrap table.widefat thead {
        display: none;
    }
    
    .tablero-wrap table.widefat, 
    .tablero-wrap table.widefat tbody, 
    .tablero-wrap table.widefat tr {
        display: block;
        width: 100% !important;
    }
    
    /* Transform each table row into an isolated card widget */
    .tablero-wrap table.widefat tr {
        margin-bottom: 15px;
        border: 1px solid #ccd0d4;
        border-radius: 4px;
        background: #fff;
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
        padding: 10px;
    }
    
    .tablero-wrap table.widefat td {
        display: block;
        width: 100% !important;
        box-sizing: border-box;
        padding: 8px 4px !important;
        border: none !important;
        text-align: left;
    }

    /* Inject programmatic row labels dynamically using data positioning if necessary, 
       or let data flow cleanly within stacked column blocks */
    .tablero-wrap table.widefat td:not(:last-child) {
        border-bottom: 1px dashed #e6e6e6 !important;
    }

    /* Un-stretch action layouts to line up buttons horizontally or cleanly fill the block */
    .tablero-wrap .tablero_tournament_competition_action_container {
        display: flex;
        gap: 10px;
        width: 100%;
    }

    .tablero-wrap .tablero_tournament_competition_action_container a,
    .tablero-wrap .tablero_tournament_competition_action_container button {
        flex: 1;
        text-align: center;
        justify-content: center;
    }
}