* {
  box-sizing: border-box;
  font-family: "Sinkin Sans", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue",
    sans-serif;
}
body {
  margin: 0;
  box-sizing: border-box;
  /* Use dynamic viewport height for better iPhone support */
  height: 100vh;
  height: 100dvh; /* This is the key fix for iPhone */
  overflow: hidden;
  width: 100%;
  
  --color-light-blue-100: #e0f2fe;
  --color-light-blue-200: #bae6fd;
  --color-light-blue-600: #0284c7;
  --color-light-blue-900: #0c4a6e;
  --color-cool-grey-100: #f3f4f6;
  --color-cool-grey-300: #d1d5db;
  --color-cool-grey-400: #9ca3af;
  --color-cool-grey-900: #111827;
  --sb-track-color: white;
  --sb-thumb-color: #7dd3fc;
  --sb-size: 10px;
  
  /* Apply safe area to body instead of container for better iPhone support */
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  /* Don't add bottom padding to body as footer will handle it */
  
  /* Legacy webkit support */
  padding-top: constant(safe-area-inset-top);
  padding-left: constant(safe-area-inset-left);
  padding-right: constant(safe-area-inset-right);
}
.container {
    width: 100vw !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex;
    /* SIMPLIFY: Remove calc() */
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* PWA Footer Fix for your structure.css */




.action:has(.logonForm) {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 20vh;
}

div#NextButton {
  width: 100%;
  display: flex;
}

.a_options {
  width: 100%;
  overflow-y: auto; /* CHANGE: was 'scroll' */
  overflow-x: hidden; /* ADD: prevent horizontal scroll */
  padding: 20px 10px 20px 20px;
  display: flex;
  flex-direction: column;
  flex: 1; /* KEEP: this is correct */
  gap: 8px;
  /* REMOVE: scrollbar-width: 0px; */
  scrollbar-width: thin; /* ADD: make scrollbar visible for debugging */
  /* ADD: iOS momentum scrolling */
  -webkit-overflow-scrolling: touch;
  max-height: 100%; /* ADD: ensure it doesn't exceed bounds */
}

footer {
  width: 100%;
  padding: 5px 10px;
  background-color: white;
  border-top: 3px solid var(--color-light-blue-900);
  font-size: 10px;
}

.ftrInfo {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #666;
     line-height: 1.2;
}

.upload-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.upload-icon {
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.upload-icon:hover {
    background-color: #e0e0e0;
}

.upload-icon i {
    font-size: 18px;
    color: #4a90e2;
}

.upload-icon:hover i {
    color: #357abd;
}
        

#Footer {
    /* CHANGE: Remove position and bottom properties */
    flex: 0 0 auto; /* ADD: Don't grow or shrink */
    width: 100%;
    padding: 3px 8px;
    background-color: white;
    border-top: 3px solid var(--color-light-blue-900);
    font-size: 9px;
    
    /* Safe area padding - KEEP these */
    padding-left: max(8px, env(safe-area-inset-left));
    padding-right: max(8px, env(safe-area-inset-right));
    padding-bottom: max(6px, env(safe-area-inset-bottom));
    
    /* Legacy webkit support - KEEP these */
    padding-left: max(8px, constant(safe-area-inset-left));
    padding-right: max(8px, constant(safe-area-inset-right));
    padding-bottom: max(6px, constant(safe-area-inset-bottom));
    
    /* REMOVE: position: relative; bottom: 0; */
    z-index: 100;
    margin: 0;
}

/* Landscape specific adjustments */
@media screen and (orientation: landscape) {
    #Footer {
        /* In landscape, safe areas are usually on the sides */
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }
}


.ftrToolbar {
  display: none;
}

@media only screen and (max-width: 500px) {
  footer {
    width: 100%;
    padding: 0px;
    border-top: 1px solid black;
    background-color: var(--color-cool-grey-100);
  }
  .ftrToolbar {
    width: 100%;
    padding: 10px 20px;
    background-color: white;
    display: flex;
    justify-content: center;
    gap: 32px;
    border-top: 3px solid var(--color-light-blue-900);
  }
  .btnToolbar {
    width: 32px;
    height: 32px;
    border: none;
    background-color: white;
    padding: 0px;
    color: var(--color-cool-grey-300);
  }
  .btnToolbar > * {
    width: 32px;
    height: 32px;
  }
  .btnToolbarActive {
    color: var(--color-light-blue-600);
  }
  .ftrInfo {
    width: 100%;
    padding: 5px 10px;
    font-size: 10px;
  }
}

main {
  width: 100%;
  height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: -5px 0px 20px rgba(0, 0, 0, 0.1);
}

@media only screen and (max-width: 500px) {
  main {
    display: none;
  }
}

.sa {
  /* this makes it take up rest of available vertical space */
  flex: 1;
  overflow-y: scroll;
  scrollbar-width: 0px;
  border-top: 10px solid white;
}

.saDivider {
  height: 21px;
  border-left: 15px solid white;
  border-right: 15px solid white;
  border-top: 10px solid white;
  border-bottom: 10px solid white;
  background-color: var(--color-light-blue-200);
}

#Details {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start; /* Align to top */
    box-sizing: border-box;
    padding: 0;
    margin: 0;
}

.details {
  height: 30%;
  /* overflow-y: scroll; */
  overflow-y: scroll;
  padding: 0px 5px 0px 5px;
}


.gdActions {
    width: 25%;
    min-width: 300px;
    height: 100%;
    padding: 3px;
    display: flex;
    flex-direction: column; /* CHANGE: This was missing proper flex direction */
     background-color: var(--color-light-blue-100);
    /* REMOVE: justify-content: center; align-items: center; text-align: center; */
}



.vertical-resizer {
    width: 8px;
    background: linear-gradient(to right, rgba(255,255,255,0.1), rgba(255,255,255,0.2), rgba(255,255,255,0.1));
    cursor: col-resize;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    user-select: none;
}

.vertical-resizer:hover { background: linear-gradient(to right, rgba(255,255,255,0.2), rgba(255,255,255,0.4), rgba(255,255,255,0.2)); }

.vertical-resizer::before {
    content: '';
    position: absolute;
    width: 3px;
    height: 40px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 2px;
    box-shadow: 0 0 4px rgba(0,0,0,0.3);
}

.display-container {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    min-width: 0;
    /* Ensure it respects safe area */
    overflow: hidden;
}

.sa-panel {
    width : 100%;
    height: calc(66.667% - 4px);
    color: black;
    padding: 1px;
    display: flex;
    flex-direction: column;
    justify-content: left;
    align-items: left;
    text-align: center;
    position: relative;
    min-height: 100px;
   
}

.sa-menu-button {
    position: absolute;
    top: 5px;
    right: 1px;
    width: 28px;
    height: 28px;
    background: rgba(6, 6, 6, 0.3);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    transition: all 0.3s ease;
    z-index: 20;
    -webkit-tap-highlight-color: transparent;
}

.sa-menu-button span {
    width: 20px;
    height: 2px;
    background: white;
    border-radius: 1px;
    transition: all 0.3s ease;
}

.sa-menu-button.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.sa-menu-button.active span:nth-child(2) { opacity: 0; }
.sa-menu-button.active span:nth-child(3) { transform: rotate(-45deg) translate(7px, -6px); }

.horizontal-resizer {
    height: 8px;
    background: linear-gradient(to bottom, rgba(255,255,255,0.1), rgba(255,255,255,0.2), rgba(255,255,255,0.1));
    cursor: row-resize;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    user-select: none;
}

.horizontal-resizer::before {
    content: '';
    position: absolute;
    width: 40px;
    height: 3px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 2px;
    box-shadow: 0 0 4px rgba(0,0,0,0.3);
}

.details-panel {
    height: calc(33.333% - 4px);
    width : 100%;
    color: blakc;
    padding: 1px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    min-height: 80px;
}

.details-menu-button {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 30px;
    height: 30px;
    background: rgba(6, 6, 6, 0.3);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.details-menu-button span {
    width: 20px;
    height: 2px;
    background: white;
    border-radius: 1px;
    transition: all 0.3s ease;
}

.details-menu-button.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.details-menu-button.active span:nth-child(2) { opacity: 0; }
.details-menu-button.active span:nth-child(3) { transform: rotate(-45deg) translate(7px, -6px); }

.sa-menu-overlay {
    position: absolute;
    top: 0;
    right: -50%;
    width: 300px;
    height: 66.667%;
    background: rgba(6, 6, 6, 0.3);
    backdrop-filter: blur(10px);
    color: white;
    padding: 20px 15px;
    transition: right 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    border-radius: 0 0 0 12px;
    overflow: hidden;
}

.sa-menu-overlay.open { right: 0; }

.sa-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.sa-menu-title { font-size: 1.1rem; font-weight: 600; color: white; }

.sa-close-button {
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.sa-menu-items {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
}

.sa-menu-item {
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.details-menu-overlay {
    position: absolute;
    bottom: 0;
    right: -50%;
    width: 300px;
    height: 100%;
    background: rgba(6, 6, 6, 0.3);
    backdrop-filter: blur(10px);
    color: white;
    padding: 15px;
    transition: right 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    border-radius: 12px 0 0 0;
    overflow: hidden;
}

.details-menu-overlay.open { right: 0; }

.details-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.details-menu-title { font-size: 1rem; font-weight: 600; color: white; }

.details-close-button {
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.details-menu-items {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.details-menu-item {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: white;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: 36px;
    display: flex;
    align-items: center;
}

/* Mobile Portrait - Show only Actions panel */
@media screen and (max-width: 480px) and (orientation: portrait) {
    body {
        /* KEEP existing safe area */
        padding-top: env(safe-area-inset-top);
        padding-bottom: 0; /* Let footer handle bottom safe area */
    }
    
     #Footer {
        /* Even smaller on mobile */
        padding: 2px 6px;
        font-size: 8px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
    
    .ftrInfo {
        font-size: 10px;
        line-height: 1.1;
    }

    .container { 
        flex-direction: column;
        height: 100vh;
        height: 100dvh;
    }
    
    .gdActions { 
        width: 100%; 
        height: 100%;
        display: flex;
        flex-direction: column; /* ENSURE proper column layout */
        padding: 3px;
    }
    
    .vertical-resizer { 
        display: none; 
    }
    
    .display-container { 
        display: none; 
    }
    
    /* ADD: Ensure footer is visible on mobile */
    #Footer {
        flex: 0 0 auto;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
    
    /* ADD: Ensure proper touch targets on mobile */
    .Option, .Option_End {
       
        padding: 15px 10px;
    }
}

/* Mobile Landscape - Show only SA and Details panels */
@media screen and (max-height: 480px) and (orientation: landscape) {
    body {
        /* In landscape, safe area is usually on sides */
        padding-top: env(safe-area-inset-top);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    
    .container { 
        flex-direction: row;
        height: calc(100vh - env(safe-area-inset-top));
        height: calc(100dvh - env(safe-area-inset-top));
    }
    
    .gdActions { 
        display: none; 
    }
    
    .vertical-resizer { 
        display: none; 
    }
    
    .display-container { 
        width: 100%; 
        height: 100%;
        display: flex; 
        flex-direction: column; 
    }
}



.processing-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgb(0 0 0 / 10%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.processing-overlay.active {
    opacity: 1;
    visibility: visible;
}

.processing-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    min-width: 200px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f0f0f0;
    border-top: 4px solid #333333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.processing-text {
    color: #333;
    font-size: 16px;
    font-weight: 500;
    margin: 0;
 }

 @supports (padding: max(0px)) and (-webkit-appearance: none) {
    .container {
        /* SIMPLIFY */
        height: 100vh;
        height: 100dvh;
    }
    
    #Footer {
        padding-bottom: max(16px, env(safe-area-inset-bottom));
        margin-bottom: 0;
    }
}

.sa-panel, .details-panel {
    -webkit-overflow-scrolling: touch;
    overflow-scrolling: touch;
     overflow-x: hidden; /* Hide horizontal scrollbar */
    overflow-y: auto;   /* Allow vertical scrolling */
}

/* 14. Ensure proper touch targets for iPhone */
.sa-menu-button, .details-menu-button,
.btnToolbar, .upload-icon {
    min-height: 30px; /* Apple's recommended minimum touch target */
    min-width: 30px;
    -webkit-tap-highlight-color: transparent; /* Remove blue highlight on tap */
}

@supports (-webkit-touch-callout: none) {
    .container {
        height: 100vh;
        height: 100dvh;
        min-height: 100vh;
        min-height: 100dvh;
    }
}

/* PWA Footer Fix for iPhone Rounded Corners */

@media (display-mode: standalone) {
    #Footer {
        /* Keep reasonable padding but MUCH more bottom spacing */
        padding: 12px 16px;
        font-size: 12px; /* Reasonable size */
        
        /* The key fix: MUCH more bottom padding to clear rounded corners */
        padding-bottom: max(40px, env(safe-area-inset-bottom));
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
        
        /* Legacy support with even more aggressive bottom padding */
        padding-bottom: max(40px, constant(safe-area-inset-bottom));
        padding-left: max(16px, constant(safe-area-inset-left));
        padding-right: max(16px, constant(safe-area-inset-right));
        
        /* CRITICAL: Much larger minimum height to push content up from rounded corners */
        min-height: calc(70px + env(safe-area-inset-bottom));
        min-height: calc(70px + constant(safe-area-inset-bottom));
        
        /* Visual styling */
        border-top: 2px solid var(--color-light-blue-900);
        background-color: #ffffff;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
        
        /* Ensure it's positioned correctly */
        z-index: 1000;
        position: relative;
        
        /* Extra safety: Add margin to push content up further */
        margin-bottom: 0;
        
        /* Flex properties to center content away from edges */
        display: flex;
        align-items: flex-start; /* Align content to top of footer */
        justify-content: center;
        flex-direction: column;
        
        /* Add internal spacing to push text up */
        padding-top: 16px; /* More top padding */
    }
    
    /* Adjust text positioning within footer */
    .ftrInfo {
        font-size: 10px;
        line-height: 1.1;
        color: #333;
        
        
        /* Push text towards top of footer area */
        margin-bottom: auto;
        width: 100%;
        
        /* Add some top margin to move text up from bottom edge */
        margin-top: 0;
        padding-top: 0;
    }
    
    /* Portrait mode - even more aggressive bottom spacing */
    @media (orientation: portrait) {
        #Footer {
            /* EXTRA bottom padding for portrait rounded corners */
            padding-bottom: max(50px, env(safe-area-inset-bottom));
            padding-bottom: max(50px, constant(safe-area-inset-bottom));
            
            min-height: calc(80px + env(safe-area-inset-bottom));
            min-height: calc(80px + constant(safe-area-inset-bottom));
            
            /* More internal top padding */
            padding-top: 20px;
        }
    }
    
    /* Landscape mode - still needs good spacing but less extreme */
    @media (orientation: landscape) {
        #Footer {
            padding-bottom: max(35px, env(safe-area-inset-bottom));
            padding-bottom: max(35px, constant(safe-area-inset-bottom));
            
            min-height: calc(60px + env(safe-area-inset-bottom));
            min-height: calc(60px + constant(safe-area-inset-bottom));
            
            padding-top: 9px;
        }
    }
    
    /* Adjust container to account for larger footer */
    .container {
        /* Account for the increased footer height */
        height: calc(100vh - max(20px, env(safe-area-inset-top)) - 90px);
        height: calc(100dvh - max(20px, env(safe-area-inset-top)) - 90px);
    }
    
    /* Ensure scrolling area doesn't overlap */
    .a_options {
        margin-bottom: 8px;
        /* Reduce max-height to ensure footer space */
        max-height: calc(100% - 150px);
    }
}


/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal-header {
    margin-bottom: 15px;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.close:hover {
    color: #000;
}

#commentText {
    width: 100%;
    min-height: 120px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    box-sizing: border-box;
}

.modal-footer {
    margin-top: 15px;
    text-align: right;
}

.modal-footer button {
    padding: 10px 20px;
    margin-left: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.btn-cancel {
    background-color: #f0f0f0;
    color: #333;
}

.btn-cancel:hover {
    background-color: #e0e0e0;
}

.btn-save {
    background-color: #007bff;
    color: white;
}

.btn-save:hover {
    background-color: #0056b3;
}


body.kiosk-mode .sa-panel,
body.kiosk-mode .details-panel,
body.kiosk-mode #HorizontalResizer,
body.kiosk-mode #VerticleResizer {
  display: none !important;
}