/*
 * DVSwitch Dashboard
 * Responsive smartphone overlay
 * Conferenza Italia
 */

* {
    box-sizing: border-box;
}

html,
body {
    max-width: 100%;
}

@media screen and (max-width: 829px) {

    html,
    body {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow-x: hidden !important;
    }

    .container,
    .content,
    .contentwide {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .content,
    .contentwide {
        padding-left: 4px !important;
        padding-right: 4px !important;
    }

    fieldset {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 4px !important;
        padding-right: 4px !important;
    }

    table {
        width: 100% !important;
        max-width: 100% !important;
        table-layout: auto;
    }

    th,
    td {
        font-size: 10px !important;
        padding: 3px 2px !important;
    }

    #tail {
        width: 100% !important;
        max-width: 100% !important;
    }

    img {
        max-width: 100% !important;
        height: auto;
    }
}


/* ==========================================================
   DVSWITCH MOBILE ACTIVITY CARDS
   Gateway Activity + Local Activity
   Solo smartphone
   ========================================================== */

@media screen and (max-width: 829px) {

    /*
       Elimina l'altezza desktop fissa del contenitore principale
    */
    td[style*="height: 480px"],
    td[style*="height:480px"] {
        height: auto !important;
        min-height: 0 !important;
    }

    /*
       GATEWAY ACTIVITY
    */
    #lastHerd fieldset,
    #localTxs fieldset {
        width: 100% !important;
        max-width: 100% !important;
        overflow: visible !important;
        padding: 8px !important;
    }

    #lastHerd table,
    #localTxs table {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        border: 0 !important;
        background: transparent !important;
    }

    #lastHerd table tbody,
    #localTxs table tbody {
        display: block !important;
        width: 100% !important;
    }

    /*
       Nasconde la riga titoli originale.
       Le etichette vengono ricreate dentro ogni scheda.
    */
    #lastHerd table tr:first-child,
    #localTxs table tr:first-child {
        display: none !important;
    }

    /*
       Ogni QSO diventa una CARD
    */
    #lastHerd table tr:not(:first-child),
    #localTxs table tr:not(:first-child) {
        display: block !important;
        width: 100% !important;
        margin: 0 0 10px 0 !important;
        padding: 7px !important;
        border: 1px solid #8b8b8b !important;
        border-radius: 9px !important;
        background: #f4f4f4 !important;
        box-shadow: 0 2px 7px rgba(0,0,0,.15);
    }

    /*
       Ogni cella diventa una riga:
       ETICHETTA    VALORE
    */
    #lastHerd table td,
    #localTxs table td {
        display: flex !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        align-items: center;
        justify-content: space-between;
        gap: 12px;

        padding: 7px 5px !important;
        border: 0 !important;
        border-bottom: 1px solid #d4d4d4 !important;

        background: transparent !important;
        color: #111 !important;

        font-size: 13px !important;
        line-height: 1.25 !important;

        white-space: normal !important;
        overflow: visible !important;
        overflow-wrap: anywhere;
        text-align: right !important;
    }

    #lastHerd table td:last-child,
    #localTxs table td:last-child {
        border-bottom: 0 !important;
    }

    /*
       ETICHETTE GATEWAY / LOCAL
    */
    #lastHerd table td:nth-child(1)::before,
    #localTxs table td:nth-child(1)::before {
        content: "Time";
    }

    #lastHerd table td:nth-child(2)::before,
    #localTxs table td:nth-child(2)::before {
        content: "Mode";
    }

    #lastHerd table td:nth-child(3)::before,
    #localTxs table td:nth-child(3)::before {
        content: "Callsign";
    }

    #lastHerd table td:nth-child(4)::before,
    #localTxs table td:nth-child(4)::before {
        content: "Target";
    }

    #lastHerd table td:nth-child(5)::before,
    #localTxs table td:nth-child(5)::before {
        content: "Src";
    }

    #lastHerd table td:nth-child(6)::before,
    #localTxs table td:nth-child(6)::before {
        content: "Dur(s)";
    }

    #lastHerd table td::before,
    #localTxs table td::before {
        flex: 0 0 92px;
        text-align: left;
        color: #285f90;
        font-weight: 700;
        font-family: Arial, sans-serif;
        white-space: nowrap;
    }

    /*
       Nominativi e TG restano evidenziati
    */
    #lastHerd table td a,
    #localTxs table td a {
        font-size: 13px !important;
        font-weight: 700;
    }

    /*
       Titoli sezioni più compatti
    */
    #lastHerd > span,
    #localTxs > span {
        display: block;
        margin: 14px 0 7px;
        font-size: 20px !important;
        line-height: 1.2;
        text-align: center;
    }
}

@media screen and (max-width: 420px) {

    #lastHerd table td,
    #localTxs table td {
        font-size: 12px !important;
    }

    #lastHerd table td::before,
    #localTxs table td::before {
        flex-basis: 78px;
        font-size: 12px;
    }

}



/* ==========================================================
   DVSWITCH - Gateway Activity: Loss / BER
   ========================================================== */

@media screen and (max-width:829px) {

    /* Gateway Activity attuale:
       1 Time
       2 Mode
       3 Callsign
       4 Target
       5 Src
       6 Dur(s)
       7 Loss
       8 BER
    */

    #lastHerd table td:nth-child(7)::before {
        content: "Loss";
    }

    #lastHerd table td:nth-child(8)::before {
        content: "BER";
    }

}
