*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #ff990034;
    margin: 0;
}

a {
    text-decoration: none;
    touch-action: manipulation;
}

/* Global Button & Input Styles */
button,
select {
    padding: 8px 12px;
    border: 1px solid #97c1ff;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
}

button:not(.dontHover):hover {
    color: #724605;
    border: 1px solid #97c1ff !important;
    box-shadow: 0 0 12px #97c1ff;
}

textarea:focus,
input:focus {
    box-shadow: 0px 0px 8px 1px #97c1ff;
}

/* Header */
#header {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px 15px 40px;
    background-color: #ffffff;
    border-bottom: 2px solid #d1d1d1;
    box-shadow: 0 4px 10px 1px #97c1ff8f;
}

#siteLogo {
    display: flex;
    align-items: center;
    gap: 15px;
}

#headerText {
    display: flex;
    flex-direction: column;
    font-size: 13px;
}

#headerText h1 {
    margin: 0;
}

#main {
    padding-top: 1.5rem;
    padding-bottom: 2.75rem;
}

/* Tabs (Top of Main) */
#btnsDiv {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-left: 1em;
    padding-right: 2em;
}

#tabBtns {
    display: flex;
    gap: 10px;
    margin-left: 2%;
}

.tabs {
    color: #000000 !important;
    background-color: #ffffff !important;
}

.tabs:hover {
    color: #000000 !important;
    background-color: #dfdfdf !important;
}

/* Tables Layout & Header */
.tables {
    width: min(90%, 95%);
    margin: 20px auto;
    padding: 24px 20px 20px;
    background: #ffffff;
    border: 1px solid #97c1ff;
    border-radius: 20px;
    box-shadow: 0 4px 6px -1px #97c1ff8f;
}

.tableHeader {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.tables h1 {
    margin: 0;
    margin-right: auto;
}

#funcButtons {
    display: flex;
    gap: 10px;
    order: 2;
}

#newOrderBtn:hover,
#simulateBtn:hover,
#createOrderBtn:hover {
    color: #000000 !important;
    background-color: #ffd390e0 !important;
    border-color: #97c1ff !important;
}

#newOrderBtn {
    color: #000000;
    background-color: #ffd390e0;
    border-color: #91682ce0;
}

#simulateBtn {
    background-color: #ffeacb;
    border-color: #91682ce0;
}

#clearDataBtn {
    margin-left: 5%;
    background-color: #ffffff;
    border-color: #97c1ff;
}

#clearDataBtn:hover {
    background-color: #dfdfdf;
}

#providerFilter {
    margin-left: auto;
    order: 1;
    border-color: #97c1ff;
}

#cancelledTable,
#completedTable {
    display: none;
}

/* Orders Table Structure */
.ordersTableWrapper {
    overflow: auto;
    border-radius: 12px;
}

.ordersTable {
    text-align: left;
    width: 100%;
    table-layout: fixed;
    font-size: 13.6px;
    border-collapse: collapse;
}

.ordersTable th,
.ordersTable td {
    padding: 10px 15px 10px 10px;
    white-space: nowrap;
    overflow: hidden;
    border-bottom: 1px solid #e0e0e0;
}

.ordersTableColor {
    background-color: #e6e6e6;
}

.thOrderDetails {
    width: 35px;
    min-width: 35px;
}

/* Status pill */
.statusPill {
    display: inline-block;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 50px;
}

.statusPending {
    color: #856404;
    background-color: #ffeeba;
}

#statusAccepted {
    color: #004085;
    background-color: #cce5ff;
}

#statusCancelled {
    color: #721c24;
    background-color: #f8d7da;
}

#statusCompleted {
    color: #155724;
    background-color: #d4edda;
}

/* Action and contact buttons */
.btn {
    width: 40px;
    height: 40px;
    padding: 0;
    margin-left: 4px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btnAccept {
    color: #000000;
    background-color: #ffeeba;
    border-color: #856404;
}

.btnCancel {
    color: #ff0000;
    background-color: #f8d7da;
    border-color: #991b28;
}

.btnComplete {
    color: #000000;
    background-color: #d4edda;
    border-color: #155724;
}

#callBtn,
#textBtn {
    border: 1px solid #969696;
}

.btnMore {
    font-weight: 600;
    background-color: transparent;
    border-color: transparent;
    display: inline-block;
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.btnMore.orderUnzipped {
    transform: rotate(90deg);
}

/* Popup modal */
#popup {
    display: none;
}

#popupContent {
    margin: 0 auto;
    width: min(60%, 50em);
    max-height: 80vh;
    padding: 1.5rem;
    overflow-y: auto;
    background: #ffffff;
    border-radius: 20px;
}

#popupContent h2 {
    margin: 0 auto;
    text-align: center;
}

#closeBtn {
    position: relative;
    padding-left: 95%;
    font-size: 22px;
    cursor: pointer;
}

#popupContent input,
#popupContent textarea,
#popupContent select {
    box-sizing: border-box;
    padding: 10px;
    border: 1px solid #97c1ff50;
    ;
    border-radius: 10px;
    resize: vertical;
}

.orderInput {
    width: 100%;
}
#phoneSel {
    width:15%;
}
#phoneInput {
    width:80%;
}
.inputLabel {
    font-size: 0.9rem;
}

#orderButton {
    display: block;
    margin-left: auto;
    background-color: #7af57a;
}

/* Order Details */
.orderDetailsRow td {
    background-color: #f8f8f8;
    padding: 20px;
    white-space: normal;
    overflow: hidden;
}

.detailsWrapper {
    position: relative;
    width: 100%;
}

.detailsCardsGrid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 15px;
}

.detailCard {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 4px #97c1ff50;
    ;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.detailLabel {
    font-size: 0.75rem;
    font-weight: 700;
    color: #c18b03;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detailContent {
    font-size: 0.9rem;
    color: #333;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.customerName {
    font-weight: 600;
    font-size: 1rem;
}

.cardActions {
    display: flex;
    gap: 10px;
    margin-top: 5px;
}

.cardActionBtn {
    font-size: 1.2rem;
    text-decoration: none;
    transition: transform 0.2s;
    display: inline-block;
}

.cardActionBtn:hover {
    transform: scale(1.1);
}

.detailsNotesBox {
    background-color: #fff8dc;
    border: 1px solid #97c1ff50;
    border-radius: 12px;
    padding: 15px;
    font-size: 0.9rem;
    color: #5a5a5a;
    display: flex;
    align-items: center;
    gap: 10px;
}

.noteLabel {
    font-weight: 700;
    color: #d48806;
}

#closeDetails {
    position: absolute;
    top: -15px;
    right: -10px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Popup modal */
#popup {
    display: none;
}

#popupContent {
    margin: 0 auto;
    width: min(60%, 50em);
    max-height: 80vh;
    padding: 1.5rem;
    overflow-y: auto;
    background: #ffffff;
    border-radius: 20px;
}

#popupContent h2 {
    margin: 0 auto;
    text-align: center;
}

#closeBtn {
    position: relative;
    padding-left: 95%;
    font-size: 22px;
    cursor: pointer;
}

#popupContent input,
#popupContent textarea,
#popupContent select {
    box-sizing: border-box;
    padding: 10px;
    border: 1px solid #cccccc;
    border-radius: 10px;
    resize: vertical;
}

.orderInput {
    width: 100%;
}

.inputLabel {
    font-size: 0.9rem;
}

#createOrderBtn {
    display: block;
    margin-left: auto;
    background-color: #ffd390e0;
}

/* Animations */
.fade-in {
    opacity: 1;
    animation: fadeInOpacity 0.2s ease-in;
}

@keyframes fadeInOpacity {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

#btnsDiv {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-left: 1em;
    padding-right: 2em;
}

#tabBtns {
    display: flex;
    gap: 10px;
    margin-left: 2%;
}

.tabs:hover {
    color: #000000 !important;
    background-color: #dfdfdf !important;

}


/* ############################################ TABLES #######################*/
#cancelledTable,
#completedTable {
    display: none;
}

#completedTable th:nth-child(7),
#completedTable td:nth-child(7),
#cancelledTable th:nth-child(7),
#cancelledTable td:nth-child(7) {
    display: none;
}


/* ###################################### Mobile responsive ########################### */
@media (max-width: 800px) {

    /* Header */
    #header {
        gap: 10px;
        padding: 15px 20px;
    }

    #headerText {
        font-size: 11px;
    }

    #headerText h1 {
        font-size: 1.3rem;
    }

    /* Tables */
    .tables {
        min-width: 95%;
        padding: 15px 10px;
    }

    .tables h1 {
        font-size: 1.2rem;
    }

    .tableHeader {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    #providerFilter {
        width: 100%;
        margin-left: 0;
        order: 1;
    }

    #funcButtons {
        display: flex;
        gap: 8px;
        order: 2;
        width: 100%;
    }

    #newOrderBtn,
    #simulateBtn {
        flex: 1;
        padding: 10px 12px;
        font-size: 12px;
    }

    .ordersTable {
        font-size: 11px;
    }

    /* Reduce Time column width */
    .ordersTable th:nth-child(2),
    .ordersTable td:nth-child(2) {
        width: 40px;
    }

    .ordersTable th,
    .ordersTable td {
        padding: 8px 5px;
    }

    /* Buttons */
    #btnsDiv {
        flex-direction: column;
        gap: 10px;
        padding: 0 10px;
    }

    #tabBtns {
        margin-left: 0;
        flex-wrap: wrap;
        justify-content: center;
    }

    .tabs {
        padding: 6px 10px;
        font-size: 12px;
        border-color: #97c1ff;
        color: #000000;
        background-color: #ffffff;
    }

    .btn,
    .btnAccept,
    .btnCancel,
    .btnComplete {
        width: 28px;
        height: 28px;
        margin-left: 2px;
    }

    /* Status pill */
    .statusPill {
        padding: 4px 8px;
        font-size: 10px;
    }

    /* Popup */
    #popupContent {
        width: 95%;
        padding: 1rem;
    }

    /* Order details */
    .orderDetailsGrid {
        grid-template-columns: 1fr;
    }

    .orderDetailsPop {
        width: 10%;
    }

    .filterSelect {
        padding: 6px 10px;
        font-size: 12px;
    }

    .btnMore {
        font-size: 0.5rem;
        padding: 4px 6px;
    }

    /* Details cards */
    .detailsCardsGrid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 475px) {

    /* Hide Provider column on mobile */
    .ordersTable th:nth-child(3),
    .ordersTable td:nth-child(3) {
        display: none;
    }

    /* Hide Contact column on very small screens */
    .ordersTable th:nth-child(6),
    .ordersTable td:nth-child(6) {
        display: none;
    }

    /* Details cards */
    .detailsCardsGrid {
        grid-template-columns: 1fr;
    }

    .orderDetailsRow td {
        padding: 10px;
    }
}