/* VERSION: 1.011 */


/* Responsive Design */
@media screen and (max-width: 1100px) {
    .sensor-data-table {
        -webkit-flex-basis: 100%;
        flex-basis: 100%;
        max-width: 100%;
    }
    .header-cell {
        height: 30px;
        line-height: 14px;
    }
}

/* Larger screens: 2-column layout for current data */
@media screen and (min-width: 1101px) {
    .current-data-row-1 { order: 1; }
    .current-data-row-2 { order: 2; }
    .current-data-row-3 { order: 3; }
    .current-data-row-4 { order: 4; }
    .current-data-row-5 { order: 5; }
    .current-data-row-6 { order: 6; }
    .current-data-row-7 { order: 7; }
    .current-data-row-8 { order: 8; }

  .current-data-right {
    display: flex;
    flex-wrap: wrap;
    gap: 20px; /* space between columns */
  }

  .current-data-row {
    margin-bottom: 7px;
    flex: 1 1 calc(50% - 20px); /* two columns with gap */
    min-width: 300px; /* prevent ultra-narrow squeezes */
  }
}

@media screen and (max-width: 825px) {
    .sensor-data-table {
        font-size: 10px;
    }
    .current-data-container {
        -webkit-flex-direction: column;
        flex-direction: column;
    }

    .current-data-left {
        margin-bottom: 20px;
    }
    
    /* Responsive Navbar Styles */
    .nav-links {
        display: none;
        -webkit-flex-direction: column;
        flex-direction: column;
        position: absolute;
        top: 100%; /* Position it right below the navbar */
        left: 0; /* Align to the left edge of the navbar */
        width: 100%; /* Full width of the navbar */
        background-color: rgba(209, 209, 209, 0.95);
        text-align: right;
        padding: 10px 10px;
        z-index: 1000;
        overflow-x: hidden;
        word-wrap: break-word;
        box-sizing: border-box; /* Include padding in the width calculation */
    }

    .nav-links.active {
        display: -webkit-flex;
        display: flex;
    }

    .nav-links li {
        margin: 10px 0;
    }

    .hamburger {
        display: block;
    }
    .header-cell {
        height: 40px;
        line-height: 14px;
    }
    
    /* Ensure wind rose is properly sized on mobile */
    #windRose {
        width: 140px;
        height: 140px;
        margin: 0 auto;
    }
    
    .RunwayNumber {
        margin-left: -68px;
        margin-top: -7.0px;
    }

    .RunwayNumberOpposite {
        margin-left: 54px;
        margin-top: -7.3px;
    }

    .stale-indicator {
        position: absolute;
        top: 18px;
        right: 5px;
        font-size: 16px;
        /* Removed background-color: white; */
        /* Removed border-radius: 50%; */
        /* Removed width and height constraints */
        text-align: center;
        /* Removed line-height: 20px; */
        /* Removed box-shadow */
        z-index: 1000;
    }
    .windrose-image-container {
        flex-direction: row;
        align-items: center;        /* Center vertically */
        justify-content: center;    /* Center horizontally */
        margin-left: 10px;
        width: 100%;
    }
    .windrose-image {
        width: 40vw;
        max-width: 120px;
        margin-left: 16px;
        margin-left: -20px;
    }

    #toggleCollapse {
        display: block;
        background-color: #dddddd;
        color: #3e6cb3;
        text-align: center;
        padding: 10px;
        cursor: pointer;
        font-size: 5px;
        user-select: none;
        width: 100vw;
        margin: 0px;
        box-sizing: border-box;
    }

    .arrow-stack {
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        margin: 0 8px;
        line-height: 1;
    }

    .arrow-symbol {
        font-size: 14px;
        color: #3e6cb3;
        line-height: 1;
        padding: 0;
        margin: -2px 0; /* Tightly packed */
    }

    .arrow-label {
        font-weight: bold;
        font-size: 12px;
        color: #3e6cb3;
    }

    .arrow-symbol.rotated {
        transform: rotate(180deg);
    }

    .collapsible-content {
        position: relative;
        max-height: 119px;
        overflow: hidden;
        transition: max-height 0.3s ease;
        margin: 0;
    }

    /* Fade-out overlay */
    .collapsible-content::after {
        content: "";
        position: absolute;
        bottom: 0;
        left: 0;
        height: 25px;
        width: 100%;
        pointer-events: none;
        background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,1));
    }

    .collapsible-content.expanded {
        max-height: 500px;
    }

    /* ========================================= */
    /* WELCOME HOME                              */
    /* ========================================= */
    /* WELCOME / FEATURE / PHOTOS                */
    /* MAX-WIDTH: 850                            */
    /* ========================================= */

    .chtx-welcome-home-row {
        flex-direction: column;
    }
    .chtx-welcome-home-column {
        flex: 1 1 100%;
    }
}

/* New media query for smartphones */
@media screen and (max-width: 480px) {
    body {
        padding: 5px;
    }
    
    .sensor-data-table {
        font-size: 9px;
        min-width: 100%;
    }
    
    .sensor-data-cell {
        padding: 4px 0px;
    }
    
    .header-cell {
        height: 40px;
        line-height: 14px;
    }
    
    /* Specific adjustments for wind rose on small screens */
    #windRose {
        width: 140px;
        height: 140px;
        position: relative;
    }
    
    .WindroseCardinalDirection {
        font-size: 10px;
    }
    
    .WindroseDegreeDirection {
        font-size: 10px;
    }
    
    #WindroseWindDirection {
        font-size: 21px; /* Size was 16px */
    }
    
    #WindroseWindspeed {
        font-size: 24px; /* Size was 20px */
    }
    
    /* Make sure cardinal directions are properly positioned */
    .WindroseCardinalDirection[style*="top: 5px"] {
        -webkit-transform: translateX(-50%) !important;
        transform: translateX(-50%) !important;
    }
    
    .WindroseCardinalDirection[style*="right: 5px"] {
        -webkit-transform: translateY(-50%) !important;
        transform: translateY(-50%) !important;
    }
    
    .WindroseCardinalDirection[style*="bottom: 5px"] {
        -webkit-transform: translateX(-50%) !important;
        transform: translateX(-50%) !important;
    }
    
    .WindroseCardinalDirection[style*="left: 5px"] {
        -webkit-transform: translateY(-50%) !important;
        transform: translateY(-50%) !important;
    }
    
    /* Fix for diagonal directions */
    .WindroseCardinalDirection[style*="top: 20%"][style*="right: 20%"] {
        -webkit-transform: translate(50%, -50%) !important;
        transform: translate(50%, -50%) !important;
    }
    
    .WindroseCardinalDirection[style*="bottom: 20%"][style*="right: 20%"] {
        -webkit-transform: translate(50%, 50%) !important;
        transform: translate(50%, 50%) !important;
    }
    
    .WindroseCardinalDirection[style*="bottom: 20%"][style*="left: 20%"] {
        -webkit-transform: translate(-50%, 50%) !important;
        transform: translate(-50%, 50%) !important;
    }
    
    .WindroseCardinalDirection[style*="top: 20%"][style*="left: 20%"] {
        -webkit-transform: translate(-50%, -50%) !important;
        transform: translate(-50%, -50%) !important;
    }
    /* Adjustment of runway and numbers on tiny screens */
    .WindroseRunway::after {
        top: 50%;
        left: 15%;
    }
    .RunwayNumber {
        margin-left: -68px;
        margin-top: -7.8px;
    }
    .RunwayNumberOpposite {
        margin-left: 55px;
        margin-top: -7.1px;
    }
    
    /* Ensure current data container is properly styled */
    .current-data-right {
        padding: 10px;
        margin-bottom: 0px;
    }
    
    .current-data-label {
        -webkit-flex: 0 0 100px;
        flex: 0 0 100px;
    }
    .form-group {
        flex-direction: column;
        align-items: stretch;
    }
    .submit-button {
        margin-left: 0;
        width: auto;
        display: inline-block;
        box-sizing: border-box;
    }

    .collapsible-content {
        max-height: 120px;
    }

    /* PRODUCTS - Label size for small screens */
    .products-label {
        font-size: 5.6pt;
    }

    /* Improve touch targets for mobile */
    @media (pointer: coarse) {
        .nav-links a {
            padding: 8px;
            display: inline-block;
        }
        
        select {
            font-size: 16px; /* Prevent iOS zoom on focus */
            height: 36px; /* Larger touch target */
        }
    }

    /* Fix for iOS Safari */
    @supports (-webkit-touch-callout: none) {
        /* CSS specific to iOS devices */
        #arrow {
            /* Ensure transform-origin works on iOS */
            -webkit-transform-origin: center bottom !important;
            transform-origin: center bottom !important;
        }
        
        /* Fix for iOS flexbox issues */
        .sensor-data-container, 
        .current-data-container {
            display: -webkit-box;
            display: -webkit-flex;
            display: flex;
        }
    }
}