﻿/* ==========================================================
   Orders.css – GLOBAL LAYOUT + SHARED WIDGET STYLES
   ----------------------------------------------------------
   • Centralises the geometry, title-strip, and data-table
     grid used by all five dashboard widgets
       1) Open Orders
       2) Prior 7 Days
       3) Next 7 Days     
       4) Month-to-Date
       5) Year-to-Date
   • Widget-specific tweaks live in their own CSS files
   ==========================================================*/

/* ---------- 1. Page shell ---------- */
.page-wrapper {
    width: 95%;
    max-width: 1600px;
    margin-inline: auto;
    padding-inline: 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

    /* consistent spacing & centring for every widget */
    .page-wrapper > .open-orders,
    .page-wrapper > #prior7Wrapper,
    .page-wrapper > #next7Wrapper, 
    .page-wrapper > #mtdWrapper,
    .page-wrapper > #ytdWrapper {
        margin-block: 1.25rem 2.5rem;
        display: flex;
        justify-content: center;
    }

/* optional inner width cap */
.open-orders,
#prior7Inner,
#next7Inner, 
#mtdInner,
#ytdInner {
    width: 100%;
    max-width: 600px;
}

/* ---------- 2. Title strip ---------- */
.toggle-header .title,
.partial-title-row .title,
.toggle-header strong {
    display: block;
    background: #707070;
    color: #fff;
    font-weight: 700;
    text-align: center;
    border-radius: .375rem;
    box-shadow: var(--shadow-sm);
    padding: 6px 8px;
    margin-bottom: .5rem;
    margin-inline: auto;
    white-space: nowrap;
}

/* ----------------------------------------------------------
   Inline “Trinity / All” toggle button
   ----------------------------------------------------------*/
.btn-toggle {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    background-color: #f0f0f0;
    border: none;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    transition: background-color 0.2s;
    cursor: pointer;
}

    .btn-toggle:hover {
        background-color: #e2e2e2;
    }

    .btn-toggle:focus {
        outline: none;
        box-shadow: 0 0 0 0.2rem rgba(13,110,253,0.25);
    }

/* ---------- 3. Data-table skeleton ---------- */
#openContent,
#priorSevenTable,
#nextSevenTable,
#mtdTable,
#ytdTable {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    border-radius: .375rem;
    overflow: hidden;
}

    #openContent th, #openContent td,
    #priorSevenTable th, #priorSevenTable td,
    #nextSevenTable th, #nextSevenTable td,
    #mtdTable th, #mtdTable td,
    #ytdTable th, #ytdTable td {
        border: 1px solid #dee2e6;
        padding: 4px 8px;
        text-align: center;
        vertical-align: middle;
    }

    #openContent thead th,
    #priorSevenTable thead th,
    #nextSevenTable thead th, 
    #mtdTable thead th,
    #ytdTable thead th {
        background: #f8f9fa;
        font-weight: 700;
    }

        /* round the four outer corners once */
        #openContent thead th:first-child,
        #priorSevenTable thead th:first-child,
        #nextSevenTable thead th:first-child, 
        #mtdTable thead th:first-child,
        #ytdTable thead th:first-child {
            border-top-left-radius: .375rem;
        }

        #openContent thead th:last-child,
        #priorSevenTable thead th:last-child,
        #nextSevenTable thead th:last-child, 
        #mtdTable thead th:last-child,
        #ytdTable thead th:last-child {
            border-top-right-radius: .375rem;
        }

    #openContent tbody tr:last-child td:first-child,
    #priorSevenTable tbody tr:last-child td:first-child,
    #nextSevenTable tbody tr:last-child td:first-child, 
    #mtdTable tbody tr:last-child td:first-child,
    #ytdTable tbody tr:last-child td:first-child {
        border-bottom-left-radius: .375rem;
    }

    #openContent tbody tr:last-child td:last-child,
    #priorSevenTable tbody tr:last-child td:last-child,
    #nextSevenTable tbody tr:last-child td:last-child, 
    #mtdTable tbody tr:last-child td:last-child,
    #ytdTable tbody tr:last-child td:last-child {
        border-bottom-right-radius: .375rem;
    }

    /* allow PriorSeven header text to wrap on small widths */
    #priorSevenTable th,
    #nextSevenTable th {
        white-space: normal !important;
        overflow-wrap: break-word;
    }

/* ---------- 4. Utilities ---------- */
@media (max-width:600px) {
    #openContent,
    #priorSevenTable,
    #nextSevenTable,
    #mtdTable,
    #ytdTable {
        font-size: 0.8rem;
    }
}

/* ----------------------------------------------------------
   Mobile tweak: remove side-padding so tables scroll fully
   ----------------------------------------------------------*/
@media (max-width:600px) {
    .page-wrapper {
        padding-inline: 0; /* kill the 8-pixel gutters */
        width: 100% !important; /* full-bleed container   */
        margin-inline: 0 !important; /* kill centred “gutter” */
    }

    /* optional: keep OpenOrders centred when there IS space,
       but prevent forced 8-px gutter when space is tight       */
    .open-orders {
        margin-inline: 0; /* override “auto” on very small widths */
    }

    .page-wrapper > .open-orders {
        margin-inline: 8px;
    }
}
