/* ===============================
   SIDENAV USER DISPLAY
=============================== */

.sidenav-user {
    display: flex;
    align-items: center;
    gap: 8px;

    margin: 10px 20px 18px 20px;
    padding: 8px 12px;

    font-size: 13px;
    font-weight: 600;

    background: rgba(255,255,255,0.08);
    border-radius: 10px;

    color: #ffffff;
}

/* Green online dot */
.sidenav-user .user-dot {
    width: 8px;
    height: 8px;
    background: #28a745;
    border-radius: 50%;
}
/*   */
/* ===============================
   LOGIN PAGE
=============================== */

.login-wrapper {
    min-height: 80vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 380px;
    padding: 35px 30px;

    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.08);
}

.login-title {
    text-align: center;
    margin-bottom: 25px;
    font-weight: 700;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.login-input {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #dee2e6;
    font-size: 14px;
    transition: all 0.2s ease;
}

.login-input:focus {
    outline: none;
    border-color: #212529;
    box-shadow: 0 0 0 3px rgba(33,37,41,0.08);
}

.login-btn {
    padding: 12px;
    border-radius: 12px;
    border: none;
    background: #212529;
    color: #ffffff;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.login-btn:hover {
    background: #000000;
    transform: translateY(-1px);
}

.login-btn:active {
    transform: scale(0.98);
}

.login-error {
    background: #ffebee;
    color: #c62828;
    padding: 10px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 15px;
    text-align: center;
}


.is-hidden {
    display: none !important;
}

.toggle-btn .arrow {
    display: inline-block;
    transition: transform 0.25s ease;
}

.toggle-btn.expanded .arrow {
    transform: rotate(180deg);
}

.trend-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    margin-left: 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: #ffffff;              /* White text */
    line-height: 1;
    white-space: nowrap;
}

/* Strong green */
.trend-up {
    background-color: #28a745;
}

/* Strong red */
.trend-down {
    background-color: #dc3545;
}

/* ===============================
   GP SELECT (ALL DEVICES)
=============================== */

.gp-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    width: 100%;
    max-width: 260px;

    padding: 8px 14px;
    font-size: 14px;
    font-weight: 500;

    border-radius: 12px;
    border: 1px solid #dee2e6;
    background-color: #ffffff;

    text-align: center;
    text-align-last: center; /* centers selected value */

    cursor: pointer;
    transition: all 0.2s ease;
}

.gp-select:focus {
    outline: none;
    border-color: #212529;
    box-shadow: 0 0 0 2px rgba(33,37,41,0.08);
}

.gp-select-wrapper {
    display: flex;
    justify-content: center;
    margin: 16px 0 20px 0;
}

.gp-select-form {
    display: flex;
    justify-content: center;
    width: 100%;
}

/* ===============================
   COMPACT CENTERED TABS
=============================== */
.stats-tabs {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 18px;
}

.tab-btn {
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;

    /* INACTIVE STATE */
    background: #e9ecef;   /* light grey */
    color: #000000;        /* black text */
}

/* ACTIVE STATE */
.tab-btn.active {
    background: #212529;   /* black */
    color: #ffffff;        /* white text */
}

/* Optional subtle hover */
.tab-btn:not(.active):hover {
    background: #dee2e6;
}

/* ===============================
   DESKTOP ROUNDED TABLE
=============================== */

@media (min-width: 769px) {

    .table-responsive {
        border-radius: 16px;
        overflow: hidden; /* critical for rounding */
        box-shadow: 0 12px 32px rgba(0,0,0,0.06);
        background: #ffffff;
    }

    #driversTable {
        margin-bottom: 0; /* remove Bootstrap spacing */
        border-collapse: separate;
        border-spacing: 0;
    }

    /* Round top corners of header */
    #driversTable thead th:first-child {
        border-top-left-radius: 16px;
    }

    #driversTable thead th:last-child {
        border-top-right-radius: 16px;
    }

    /* Round bottom corners of last row */
    #driversTable tbody tr:last-child td:first-child {
        border-bottom-left-radius: 16px;
    }

    #driversTable tbody tr:last-child td:last-child {
        border-bottom-right-radius: 16px;
    }
    
    /* ===============================
        Teams TABLE (Desktop Rounding)
     =============================== */
     
     #teamsTable {
         margin-bottom: 0;
         border-collapse: separate;
         border-spacing: 0;
     }
     
     #teamsTable thead th:first-child {
         border-top-left-radius: 16px;
     }
     
     #teamsTable thead th:last-child {
         border-top-right-radius: 16px;
     }
     
     #teamsTable tbody tr:last-child td:first-child {
         border-bottom-left-radius: 16px;
     }
     
     #teamsTable tbody tr:last-child td:last-child {
         border-bottom-right-radius: 16px;
     }
    
}
 
 /* Old Table Styles */
.table-wrapper{
    margin: 10px;
}

.fl-table {
    border-radius: 5px;
    font-size: 12px;
    font-weight: normal;
    border: 1px solid;
    border-collapse: collapse;
    max-width:100%;
    white-space:nowrap;
    background-color: white;
}

.fl-table td, .fl-table th {
    text-align: center;
    padding: 8px;
    
}

.fl-table td {
    font-size: 12px;
    
}

.fl-table thead th {
    color: #ffffff;
    background: #212529;
    
}

.fl-table tr:nth-child(even) {
    background: #ddd;
}
 
 /* ===============================
    MOBILE TABLE
 =============================== */
@media (max-width: 768px) {
    
    
     /* ===============================
       Drivers TABLE (CARD STYLE)
    =============================== */
    
    #driversTable thead {
        display: none;
    }

    #driversTable tr {
        display: block;
        background: #ffffff;
        margin-bottom: 18px;
        border-radius: 16px;
        box-shadow: 0 6px 18px rgba(0,0,0,0.08);
        overflow: hidden;
    }

    /* ===== Header (Driver + Team) ===== */

    #driversTable td:first-child {
        display: block;
        background: #212529;
        color: white;
        font-size: 18px;
        font-weight: 600;
        padding: 18px 18px 6px 18px;
        border-bottom: none;
    }

    #driversTable td:nth-child(2) {
        display: block;
        background: #212529;
        color: #cccccc;
        font-size: 14px;
        padding: 0 18px 18px 18px;
        border-bottom: 1px solid rgba(255,255,255,0.15);
    }

    #driversTable td:first-child::before,
    #driversTable td:nth-child(2)::before {
        content: "";
    }

    /* ===== Stat Rows (Use GRID, not flex) ===== */

    #driversTable td:nth-child(n+3) {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        padding: 14px 18px;
        border-bottom: 1px solid #f1f1f1;
        font-size: 15px;
        white-space: nowrap;
    }

    #driversTable td:nth-child(n+3)::before {
        content: attr(data-label);
        font-size: 12px;
        font-weight: 600;
        color: black;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    #driversTable td:last-child {
        border-bottom: none;
    }
    
    #driversTable,
    #driversTable tbody,
    #driversTable tr {
        max-height: none !important;
    }
    
    /* Hide extra stats initially */
    #driversTable tr:not(.expanded) .card-extra {
        display: none;
    }

    /* Make whole card clickable */
    #driversTable tr {
        cursor: pointer;
        transition: transform 0.15s ease, box-shadow 0.2s ease;
    }

    #driversTable tr:active {
        transform: scale(0.98);
    }

    /* Smooth expand animation */
    #driversTable tr .card-extra {
        animation: fadeIn 0.25s ease forwards;
    }

    @keyframes fadeIn {
        from { opacity: 0; transform: translateY(-4px); }
        to { opacity: 1; transform: translateY(0); }
    }
    
    #teamsTable,
    #teamsTable thead,
    #teamsTable tbody,
    #teamsTable tr,
    #teamsTable th,
    #teamsTable td {
        display: revert !important;
    }

     #teamsTable {
         border-collapse: separate;
         border-spacing: 0;
         border-radius: 16px;
     }
    
    #teamsTable tr {
        background: transparent !important;
        box-shadow: none !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }
    
    /* ===============================
        Teams TABLE (Mobile Rounding)
     =============================== */

     /* Round top corners */
     #teamsTable thead tr:first-child th:first-child {
         border-top-left-radius: 16px;
     }
     
     #teamsTable thead tr:first-child th:last-child {
         border-top-right-radius: 16px;
     }
     
     /* Round bottom corners */
     #teamsTable tbody tr:last-child td:first-child {
         border-bottom-left-radius: 16px;
     }
     
     #teamsTable tbody tr:last-child td:last-child {
         border-bottom-right-radius: 16px;
     }
     
    .gp-select-wrapper {
        display: flex;
        justify-content: center;
        padding: 0 16px;
    }

    .gp-select-form {
        display: flex;
        flex-direction: column;
        align-items: center;   /* 👈 THIS is what you were missing */
        width: auto;           /* 👈 remove 100% */
        gap: 10px;
    }

    .gp-select {
        width: 220px;          /* fixed compact width */
        padding: 8px 14px;
        font-size: 14px;
    }
    
    /* OLD TABLE STRUCTURE */
    .fl-table {
        display: block;
        width: 100%;
        overflow-x: auto;
    }
    .table-wrapper:before{
        content: "Scroll horizontally >";
        display: block;
        text-align: right;
        font-size: 11px;
        color: white;
        padding: 0 0 10px;
    }
    .fl-table thead, .fl-table tbody, .fl-table thead th {
        display: block;
    }
    .fl-table thead th:last-child{
        border-bottom: none;
    }
    .fl-table thead {
        float: left;
    }
    .fl-table tbody {
        width: auto;
        position: relative;
        overflow-x: auto;
    }
    .fl-table td, .fl-table th {
        padding: 20px .625em .625em .625em;
        height: 60px;
        vertical-align: middle;
        box-sizing: border-box;
        overflow-x: hidden;
        overflow-y: auto;
        width: auto;
        font-size: 13px;
        text-overflow: ellipsis;
    }
    .fl-table thead th {
        text-align: left;
    }
    .fl-table tbody tr {
        display: table-cell;
    }
    .fl-table tbody tr:nth-child(odd) {
        background: none;
    }
    .fl-table tr:nth-child(even) {
        background: transparent;
    }
    .fl-table tr td:nth-child(odd) {
        background: #F8F8F8;
    }
    .fl-table tr td:nth-child(even) {
    }
    .fl-table tbody td {
        display: block;
        text-align: center;
    }
    
}
