﻿/***************************************************************************************
 * Ontario TECK VBA Developers
 * New Connections Ministries
 * License - 2023/2026
 * Filename : paincontrol.css
 *
 * Date Created: 2026-03-30
 *
 * Main features
 *   Correct flexbox rules for scrollable regions
 *   Full-height layout behavior for body panels
 *   Grid-table responsiveness + sticky headers
 *   Mobile-friendly stacked layout
 *
 ***************************************************************************************/

/** Lookup cards */
#lookupsection {
    height: 100%;
    overflow-y: auto;
}

.lookup-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #fff;
    padding-bottom: 6px;
    border-bottom: 1px solid #ddd;
}

.lookup-results {
    max-height: 400px;
    overflow-y: auto;
    margin-top: 15px;
}

.lookup-card {
    border: 2px solid #3f51ff;
    padding: 6px;
    margin-bottom: 12px;
    border-radius: 4px;
}

.lookup-title {
    font-weight: bold;
    color: #3f51ff;
}

/* Filter Bar */
.apply-filter-block {
    display: flex;
    align-items: center;
    margin-left: auto; /* pushes button to the far right */
}

.apply-filter-btn {
    padding: 10px 18px;
    font-weight: 600;
}

/* Grid Table Layout */
/* Hover highlight for rows */
.grid-row:hover {
    background-color: #e9f3ff; /* soft blue */
    cursor: pointer;
}

/* Optional: highlight selected row */
.grid-row.selected {
    background-color: #c7e0ff !important;
    border-left: 4px solid #0078d4;
}

.grid-table {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    /* GRID STRUCTURE */
    display: grid;
    grid-template-columns: 150px 2fr 130px 130px;
    gap: 6px;
    padding: 0
}

.grid-header {
    position: sticky;
    top: 0;
    background: #f2f2f2;
    z-index: 5;
    padding: 6px 4px;
    border-bottom: 1px solid #ccc;
}

.grid-row {
    border-bottom: 1px solid #e0e0e0;
    padding: 6px 4px;
}

/* Mobile Stacked “Card” View */
@media (max-width: 768px) {
    .grid-table {
        grid-template-columns: 1fr !important;
        overflow-y: visible !important;
        max-height: none !important;
    }

    .grid-header {
        display: none !important;
    }

    .grid-row {
        border: 1px solid #e0e0e0;
        padding: 8px;
        margin-bottom: 8px;
        border-radius: 4px;
    }

    .grid-cell-label {
        font-weight: 600;
        color: #555;
    }
}

/* Pain Working Area (Two-column layout) */
.painworking-wrapper {
    height: 100%;
    min-height: calc(100vh - 160px); /* preserve original design */
    /* Scroll fix patch */
    min-height: 0 !important;
    display: flex;
    flex-direction: column;
}

.painworking-body,
.flex-nowrap {
    display: flex;
    flex-wrap: nowrap;
    height: 100%;
    min-height: 0 !important; /* CRITICAL for scroll to work */
}

.left-col,
.right-col {
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0 !important; /* allows children to shrink */
}

.left-col {
    flex: 0 0 66.666%;
}

.right-col {
    flex: 0 0 33.333%;
    border-left: 1px solid #ccc;
}

/* Options Bar / Filter Bar */
.options-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 30px;
    flex-wrap: nowrap;
}

.weekend-block {
    display: flex;
    align-items: center;
}

.date-range-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.date-box {
    width: 170px;
}

.date-separator {
    margin-top: 10px;
    font-weight: 600;
}

.source-block {
    display: flex;
    align-items: center;
}

.source-type-box {
    border: 1px solid #777;
    padding: 12px 20px;
    border-radius: 6px;
    background: #fff7ec;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 360px;
}

.source-type-legend {
    font-size: 0.8rem;
    padding: 0 6px;
    margin-left: -12px !important;
    margin-top: -35px !important;
}

.source-content {
    display: flex;
    align-items: center;
    gap: 25px;
    padding-top: 5px;
}

.source-item {
    font-weight: 500;
}

.date-range-block {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Main Pain Control Page Sections */
.paincontrol-container {
    width: 100%;
    margin: auto;
    min-height: 0;
}

.pcm-section {
    padding: 16px;
    margin-bottom: 5px;
    border: 1px solid #ccc;
    border-radius: 6px;
}

.pcm-body {
    background: #f4fff4;
    min-height: 0 !important;
    display: flex;
    flex-direction: column;
}

.pcm-info {
    background: #f8f8f8;
}

.pcm-options {
    background: #fff7ec;
}

.option-block label {
    margin-right: 8px;
    font-weight: 600;
}

.placeholder-text {
    color: #666;
    font-style: italic;
}

/* Reset Utility Classes */

.no-gap {
    padding: 0 !important;
    margin: 0 !important;
}
/* Phone Device Responsiveness rules */
/* Hide Info section on small devices */
@media (max-width: 767.98px) {
    #info-section,
    .weekend-block,
    .lookup-option,
    .source-block {
        display: none;
    }
}
/* Mobile layout for Options / Filters */
@media (max-width: 767.98px) {

    #options-pane .options-row {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    #options-pane .date-range-wrapper,
    #options-pane,
    #options-pane .apply-filter-block {
        width: 100%;
    }
}

@media (max-width: 767.98px) {

    #options-pane .date-range-wrapper {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

        #options-pane .date-range-wrapper .date-to-separator {
            display: none; /* hide the "to" text if you use one */
        }
}

@media (max-width: 767.98px) {

    #options-pane .apply-filter-block {
        display: flex;
        justify-content: center;
    }

    #options-pane .apply-filter-btn {
        width: auto; /* or remove if you set width earlier */
    }
}