/* ==========================================================================
   Responsive overrides for BlueTime
   Loaded after main.css — all rules here are behind media queries
   so desktop layout is completely unchanged.
   ========================================================================== */

/* Desktop: hide mobile-only elements */
#menu-toggle,
#menu-overlay {
    display: none;
}

/* Dollar sign prefix — floats on desktop, inline on mobile */
.price-prefix {
    float: left;
    line-height: 30px;
    margin-right: 2px;
}

/* Horizontal-scroll wrapper for data tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ==========================================================================
   Tablet / Phone  (max-width: 768px)
   ========================================================================== */
@media (max-width: 768px) {

    /* --- Off-canvas sidebar --- */
    #menuwrapper {
        float: none;
        width: 270px;
        position: fixed;
        top: 0;
        left: -270px;
        height: 100%;
        z-index: 1000;
        transition: left 0.3s ease;
        overflow-y: auto;
    }

    #menuwrapper.open {
        left: 0;
    }

    /* Neutralize Waypoints sticky on mobile */
    #menuwrapper.sticky {
        position: fixed;
        left: -270px;
        top: 0;
        width: 270px;
        float: none;
    }

    #menuwrapper.sticky.open {
        left: 0;
    }

    /* --- Hamburger button --- */
    #menu-toggle {
        display: block;
        position: fixed;
        top: 10px;
        left: 10px;
        z-index: 1001;
        background: rgba(65, 65, 70, 0.9);
        color: #fff;
        border: none;
        border-radius: 4px;
        font-size: 24px;
        width: 40px;
        height: 40px;
        line-height: 40px;
        text-align: center;
        cursor: pointer;
        padding: 0;
    }

    /* --- Overlay backdrop --- */
    #menu-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    #menu-overlay.active {
        display: block;
    }

    /* --- Content area --- */
    #contentwrapper {
        float: none;
        width: 100%;
        padding: 0 10px;
        box-sizing: border-box;
    }

    #content {
        float: none;
        width: 100%;
    }

    /* --- Header --- */
    #title {
        padding-top: 80px;
        font-size: 16px;
        width: 90%;
    }

    #clockbox {
        display: none;
    }

    /* Hide decorative shadow image */
    img[src="images/shadow.png"] {
        display: none;
    }

    /* Move helpdesk button to avoid hamburger overlap */
    #helpdesk-trigger {
        right: 10px !important;
        left: auto !important;
    }

    /* --- Forms: stack labels and inputs vertically --- */
    fieldset label {
        float: none;
        display: block;
        width: 100%;
        margin-top: 10px;
        margin-bottom: 2px;
    }

    fieldset input,
    fieldset select,
    fieldset textarea {
        float: none;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Login form inputs */
    .inputbox {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Don't force full width on checkboxes, hidden inputs, or submit buttons */
    fieldset input[type="checkbox"] {
        width: auto;
        display: inline-block;
    }

    fieldset input[type="hidden"] {
        display: none !important;
    }

    fieldset input.submit,
    fieldset input.delete {
        width: 100%;
        float: none;
    }

    /* Labels already provide vertical spacing; hide <br> tags */
    fieldset br {
        display: none;
    }

    /* Description textarea */
    #descr {
        width: 100% !important;
        height: 200px;
    }

    /* Project selector inline span */
    #project_selector {
        float: none;
        display: block;
        width: 100%;
    }

    /* Dollar sign prefix — keep inline instead of float */
    .price-prefix {
        float: none !important;
        display: inline;
        vertical-align: middle;
        margin-right: 4px;
    }

    /* --- Tables --- */
    .table-responsive {
        margin-bottom: 15px;
    }

    table.data {
        min-width: 600px;
    }

    /* --- Week navigation bar --- */
    #tabletop {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        margin-bottom: 10px;
    }

    #tabletop span {
        float: none !important;
    }

    /* --- Flex layouts used in draft sections --- */
    div[style*="display:flex"][style*="gap:40px"],
    div[style*="display: flex"][style*="gap: 40px"] {
        flex-direction: column !important;
    }

    /* Draft section flex row */
    div[style*="display:flex"][style*="gap:10px"] {
        flex-wrap: wrap;
    }
}

/* ==========================================================================
   Small phone  (max-width: 480px)
   ========================================================================== */
@media (max-width: 480px) {

    #title {
        padding-top: 60px;
        font-size: 14px;
    }

    /* Smaller table text */
    table.data tr th,
    table.data tr td {
        font-size: 12px;
        padding: 3px;
        min-width: 40px;
    }

    /* Full-width buttons */
    input.submit,
    input.delete,
    button.submit {
        width: 100%;
    }

    /* Smaller headings */
    legend {
        font-size: 15px;
    }

    .page-header {
        font-size: 16px;
    }

    /* Tighter header */
    #header {
        background-size: contain;
    }
}
