* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    padding: 20px;
    max-width: 500px;
    margin: 0 auto;
    background: #f5f5f5;
    -webkit-tap-highlight-color: transparent;
    -webkit-overflow-scrolling: touch; /* Safari smooth scroll */
}

h2, h3 {
    text-align: center;
    color: #333;
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.input-group {
    margin-bottom: 15px;
}



input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    -webkit-border-radius: 8px; /* Safari */
    font-size: 16px; /* Prevents iOS zoom */
    transition: border-color 0.3s;
    -webkit-appearance: none; /* Reset Safari styling */
    -moz-appearance: none;
    appearance: none;
}


input:focus, select:focus {
    border-color: #007bff;
    outline: none;
}

#productDescription {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: inherit;
    resize: vertical; /* Allows vertical resizing only */
    min-height: 60px;
}


select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    -webkit-border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
    background-color: white;
    cursor: pointer;
    
    /* Required for Safari padding */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    
    /* Custom arrow */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
}











.language-toggle {
    /*position: fixed;*/
    top: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
    z-index: 1000;
    background: white;
    padding: 5px;
    /*border-radius: 8px;*/
    /*box-shadow: 0 2px 5px rgba(0,0,0,0.2);*/
}

.lang-btn {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: #f5f5f5;
    cursor: pointer;
    border-radius: 4px;
    font-weight: bold;
    height: 38px;
    width: 50px;
}

.lang-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

#openTranslationBtn {
    background: #6c757d;
    color: white;
    border-color: #6c757d;
    margin-left: 12px;
}

































.buttons {
    display: flex;
    gap: 10px;
    margin: 20px 0;
}



/* Admin Login Connection Status */
.connection-status {
    color: #dc3545;
    font-size: 14px;
    margin-top: -20px;
    text-align: center;
}


/* Admin buttons */
.admin-btn{
    flex: 1;
    padding: 14px;
    border: 2px solid #6c757d;
    border-radius: 8px;
    -webkit-border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    min-height: 44px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: white;
    color: #333;
}

.admin-btn:hover{
    background: #f8f9fa;
}


/* Clear button */
.clear-btn {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 8px;
    -webkit-border-radius: 8px; /* Safari */
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    min-height: 44px; /* iOS minimum touch target */
    -webkit-appearance: none; /* Reset Safari styling */
    -moz-appearance: none;
    appearance: none;
    background: linear-gradient(135deg, #6c757d, #545b62);
    color: white;
}



.result-box {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-top: 25px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-left: 5px solid #007bff;
}

.result-item {
    display: flex;
    justify-content: space-between;
    margin: 15px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.result-value {
    font-weight: 700;
    font-size: 18px;
    color: #007bff;
}

.block-footer {
    display: flex;
    flex-direction: column;
    padding: 15px;
    background-color: #f9f9f9;
    border-top: 1px solid #ddd;
}

.block-footer .admin-btn {
    width: 100%;
    margin: 0 0 8px 0;  /* bottom margin creates spacing between buttons */
}

.block-footer .admin-btn:last-child {
    margin-bottom: 0;  /* Remove bottom margin from last button */
}

.admin-btn.delete-btn {
    margin-top: 15px;
    background-color: #fff3f3;  /* Light pink background */
    border-color: #dc3545;       /* Red border */
    color: #dc3545;              /* Red text */
    font-weight: bold;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    transition: none;            /* Remove any transition */
}

.admin-btn.delete-btn:active {
    background-color: #dc3545;   /* Solid red only while clicking */
    color: white;                 /* White text while clicking */
}

/* Style just the trash can emoji */
.admin-btn.delete-btn::before {
    color: #dc3545;  /* Makes the trash can red */
}

.admin-btn.delete-btn:hover::before {
    color: white;  /* Turns white on hover */
}


/* Remove spinner arrows from number inputs */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    -moz-appearance: none;
    margin: 0;
}

/* For Firefox */
input[type="number"] {
    -moz-appearance: textfield;
}

/* Optional: Keep the input looking consistent */
input[type="number"] {
    appearance: textfield;
}       

.title-wrapper {
    position: relative;
}

.tap-area {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    background: transparent;
    z-index: 10;
}

select option {
    padding: 8px;
}

#formMode {
    font-weight: bold;
    font-size: 1.2em;
    border: none;
    background: transparent;
    width: 100%;
    text-align: center;
    margin-bottom: 15px;
    color: #333;
}


/* Product List Container */
.select-list {
    max-height: 350px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px 10px 10px 10px;
    margin: 10px 0 10px 0;
    background-color: #f9f9f9;
}

/* Product Items Container */
#productItemsContainer {
    padding-right: 8px;  /* Add space between items and scrollbar */
}

/* Product Items Container */
#productItemsContainer div {
    padding: 10px;
    margin-bottom: 5px;
    background-color: white;
    border: 1px solid #eee;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.2s;
}

#productItemsContainer div:hover {
    background-color: #f0f0f0;
    border-color: #007bff;
}

/* Product List Header */
.select-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    background: transparent;
    pointer-events: none;
}

.select-list-header h4 {
    margin: 0;
    pointer-events: none;
}

/* X Close Button */
.close-x-btn {
    background: none;
    border: none;
    font-size: 20px;
    padding: 0 5px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    pointer-events: auto;
}

.close-x-btn:hover {
    color: #ff0000;
}


/* Product Form Container */
#AdminProductForm {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    margin: 10px 0;
    background-color: #f9f9f9;
}


.product-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    margin-bottom: 5px;
    background-color: white;
    border: 1px solid #eee;
    border-radius: 3px;
}

.product-name {
    cursor: pointer;
    flex: 1;
}


.copy-icon{
    
}

.trash-icon {
    cursor: pointer;
    margin-left: 10px;
    font-size: 1.1em;
}


/*Images section */


.add-images-form .admin-btn{
    width: 100%;
}

#imageGallery {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    gap: 15px;
    padding: 10px;
    margin-bottom: 10px;
}

#imageGallery img {
    max-height: 175px;
    width: auto;
    object-fit: contain;
    border-radius: 4px;
    cursor: pointer;
}

.image-delete-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 40px;
    height: 40px;
    background-color: #b5aeae;
    color: white;
    font-size: 20px !important;
    border: none;
    border-radius: 4%;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-delete-btn:hover {
    background-color: #cc0000;
}


.marked-for-deletion {
    opacity: 0.8;
}

.delete-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.5);
    color: black;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    text-align: center;
    border-radius: 4px;
    z-index: 1;
    cursor: pointer;
    line-height: 1.4;
}

.delete-overlay hr {
    width: 90%;
    margin: 8px 0;
    border: none;
    border-top: 3px solid #999;
}





.add-block-form {
    margin: 15px -10px 0px -10px;  /* Negative margin to extend beyond padding */
    border-top: 4px solid #ccc;
    padding: 15px 10px 0 10px;    /* Restore padding for content */
}

.add-block-form .admin-btn{
    width: 100%;
}


.block-item {
    display: flex;
    justify-content: space-between;
    flex-direction: column;
    margin: 15px 0 25px 0;    
    border: 2px solid #6d6969;
    border-radius: 4px;
    background-color: white;
}


/* Minimized state - hide fields and footer */
.block-item.minimized .fields-container,
.block-item.minimized .block-footer {
    display: none;
}

.block-item.minimized .roi-formula-section {
    display: none !important;
}


/* Optional: hide description too when minimized for cleaner look */
.block-item.minimized .block-description {
    display: none;
}

/* Style for minimize button */
.minimize-btn {
    font-size: 16px;
}




/*ADD*/




.block-toolbar {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 15px;
}

.block-toolbar .toolbar-btn {
    margin-right: 8px;  /* Space between buttons */
    flex: 1;  /* Make all buttons equal width */
}

.block-toolbar .toolbar-btn:last-child {
    margin-right: 0;  /* Remove margin from last button */
}

.block-title-section {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.block-label-input {
    width: 100%;
    padding: 12px;
    border: 2px solid transparent;  /* No border by default */
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    text-align: center;
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    margin-bottom: 10px;
    background-color: transparent;  /* Match background */
    cursor: default;  /* Show it's not editable */
    pointer-events: none;  /* Prevents any mouse interaction */
    transition: all 0.2s;
}

.block-label-input.editable {
    border: 2px solid #ddd;  /* Border appears when editable */
    background-color: white;
    cursor: text;
    pointer-events: auto;  /* Re-enable interaction when editable */
}

.block-label-input.editable:focus {
    border-color: #007bff;
    outline: none;
}

.block-description {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    resize: vertical;
    box-sizing: border-box;
    font-family: inherit;
    min-height: 78px;
    background-color: white;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.block-description:focus {
    border-color: #007bff;
    outline: none;
}

.toolbar-btn {
    padding: 14px 0;  /* Tall padding for thumb tapping */
    border: 2px solid #ccc;
    background-color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;  /* Larger icons */
    transition: all 0.2s;
    min-height: 50px;  /* Minimum tap target size */
    text-align: center;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    -webkit-touch-callout: none;  /* Prevents callout on long-press */
}

.toolbar-btn:hover {
    background-color: #e0e0e0;
}

.toolbar-btn.move-up:hover { 
    background-color: #4CAF50; 
    color: white; 
    border-color: #4CAF50; 
}

.toolbar-btn.move-down:hover { 
    background-color: #FF9800; 
    color: white; 
    border-color: #FF9800; 
}

.toolbar-btn.edit-btn:hover { 
    background-color: #2196F3; 
    color: white; 
    border-color: #2196F3; 
}

.toolbar-btn.edit-btn.active {
    background-color: #cccccc;  /* Grey background when active */
    border-color: #999999;
    color: #666666;
}



.toolbar-btn.copy-btn:hover { 
    background-color: #9C27B0; 
    color: white; 
    border-color: #9C27B0; 
}



.delete-block-btn {
    background-color: #fff3f3;
    border-color: #dc3545;
    color: #dc3545;
    font-weight: bold;
    margin-top: 8px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.delete-block-btn:hover {
    background-color: #dc3545;
    color: white;
}


.block-label {
    font-weight: 500;    
    font-size: 1.2em;    
      
}

.block-remove {
    cursor: pointer;
    font-size: 1.2em;
    color: #999;
    transition: color 0.2s;
    font-family: "Segoe UI", "Arial", sans-serif;
}

.block-remove:hover {
    color: #dc3545;
}


.block-header {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 5px 12px 12px 12px;  /* top:5px, right:12px, bottom:12px, left:12px */
    background-color: #f5f5f5;
    border-bottom: 1px solid #ddd;
    border-radius: 4px 4px 0 0;
    box-sizing: border-box;
}


.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    z-index: 1000;
    min-width: 300px;
    width: 95%;
    max-width: 500px;
    box-sizing: border-box;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}


.modal input {
    width: 100%;
    margin: 10px 0;
    box-sizing: border-box;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
}

.modal-header .close {
    cursor: pointer;
    font-size: 36px;
}

.modal-footer {
    margin-top: 10px;
    text-align: right;
}


#fieldLabelMultiple {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    -webkit-border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    resize: vertical;
    min-height: 78px;
    font-family: inherit;
}

#fieldLabelMultiple:focus {
    border-color: #007bff;
    outline: none;
}


/* Fields container */
.fields-container {
    margin: 10px 0;
}


.field-item {
    display: block;    
    margin-bottom: 15px;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background-color: #fafafa;
}


.field-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding: 4px 0;
}

.field-actions {
    display: flex;
    align-items: center;
}


.field-actions .move-btn:last-child {
    margin-right: 15px;
}

#agentCheckboxContainer input[type="checkbox"] {
    margin-right: 8px;
    display: inline-block;
    pointer-events: auto;
    width: 20px;
    height: 20px;
    opacity: 1;
    appearance: checkbox;
    -webkit-appearance: checkbox;
}



#agentCheckboxContainer {
    margin: 10px 0;
    padding: 5px;
    /* NO display: none here - that stays in HTML */
}

#agentCheckboxContainer label {
    display: block;  /* THIS STAYS - makes each checkbox on its own line */
    margin-bottom: 8px;
}

#agentCheckboxContainer label:last-child {
    margin-bottom: 0;  /* Removes bottom margin from last checkbox */
}

.move-btn {
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    background-color: #e9ecef;
    color: #495057;
    font-size: 20px;
    font-weight: bold;
    user-select: none;
    transition: background-color 0.2s;
    min-width: 44px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-right: 10px;
}

.move-btn:hover {
    background-color: #007bff;
    color: white;
}

.move-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* END ADD */



.field-header span {
    font-weight: bold;
}


.field-menu {
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 6px;
    background-color: #e9ecef;
    color: #495057;
    font-size: 24px;
    font-weight: bold;
    user-select: none;
    transition: background-color 0.2s;
    min-width: 44px;
    text-align: center;
    line-height: 1;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-left: 5px;
}

.field-menu:hover {
    background-color: #6c757d;
    color: white;
}

.field-menu:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}


.field-item span {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
}



/*FORMULA BLOCK STYLES*/
/* ROI Formula Section - Inline version */
.roi-formula-section {
    background: white;
    padding: 20px 0 20px 0;
    border: 1px solid #28a745;
    border-radius: 4px;
    margin: 15px 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.roi-formula-section h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    text-align: center;
}

.roi-formula-section .field-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px;
    margin-bottom: 15px;
}

.roi-formula-section .field-item {
    padding: 8px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    width: 100%;
    font-size: 20px;
    background: white;
    border: none;
    text-align: left;
}

.roi-formula-section .field-item:hover {
    background-color: #f0f0f0;
}

.roi-formula-section .field-item:last-child {
    border-bottom: none;
}

.roi-formula-section label{
    text-align: center;
}

.roi-formula-section textarea {
    width: 100%;
    padding: 10px;
    font-family: monospace;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    min-height: 80px;
    margin-bottom: 15px;
    box-sizing: border-box;
}

.roi-formula-section .operator-pad {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 15px;
    justify-content: center;
}

.roi-formula-section .operator-btn {
    width: 50px;
    height: 50px;
    font-size: 18px;
    font-weight: bold;
    padding: 0;
}

.roi-formula-section .result-box {
    padding: 12px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 16px;
    border: 1px solid #e9ecef;
}

.roi-formula-section .result-value {
    font-size: 18px;
    font-weight: bold;
    color: #28a745;
    margin-left: 10px;
}

.roi-formula-section .modal-footer {
    text-align: right;
    margin-top: 10px;
}

/* Keep .roi-block-btn as is - it's for the toggle button */
.roi-block-btn {
    margin-top: 8px;
    background-color: #28a745;
    width: 100%;
    color: white;
    border: none;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.roi-block-btn:hover {
    background-color: #218838;
}

/* These styles don't need .roi-formula-section prefix */
.formula-section {
    margin-bottom: 15px;
}

.formula-editor {
    width: 100%;
    min-height: 180px;
    border: 1px solid #ccc;
    padding: 8px;
    margin-bottom: 10px;
    font-family: monospace;
    border-radius: 4px;
    background: white;
}

.hidden-formula {
    width: 100%;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 8px;
    font-family: monospace;
}

.formula-chip {
    display: inline-block;
    background: #e0e0e0;
    border: 1px solid #999;
    border-radius: 4px;
    padding: 2px 6px;
    margin: 2px;
    font-size: 14px;
}

.save-formula-container {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 10px;
    margin-bottom: 15px;
}

.save-formula-btn {
    width: 100%;
    padding: 12px;
}

.save-formula-container button:first-child {
    padding: 4px 8px;
    width: auto;
    max-width: fit-content;
}

/* Note styles - update #roiFormula to .formula-editor */
.formula-editor .note-bracket,
.formula-editor .note-text {
    color: #0066cc;
}

.formula-editor .note-placeholder {
    color: #0066cc;
    opacity: 0.7;
}




/* Salesperson section styles */
.sales-btn {
    width: 100%;
    padding: 14px;
    background: white;
    border: 2px solid #6c757d;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    min-height: 44px;
    margin-bottom: 15px;
}

.sales-btn:hover {
    background: #f8f9fa;
}



.sales-list {
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.sales-product {
    margin-bottom: 12px;
    padding: 10px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
}

.sales-product b {
    display: block;
    margin-bottom: 5px;
    color: #333;
    font-size: 20px;
}

.sales-block {
    padding: 8px 10px;
    margin: 5px 0 5px 15px;
    background: white;
    border: 1px solid #eee;
    border-radius: 4px;
    color: #495057;
    font-size: 20px;
    cursor: pointer;
    font-weight: 500;
}

.sales-block:hover {
    background: #f0f0f0;
}

.sales-block-display {
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-top: 15px;
    text-align: center;
    color: #666;
}


/* ROI selection checkboxes - matching working checkbox style */
.roi-select {
    width: 30px;
    height: 30px;
    margin-left: 10px;
    opacity: 1;
    appearance: checkbox;
    -webkit-appearance: checkbox;
    display: inline-block;
    pointer-events: auto;
}





#roiBlocksContainer {
    margin-top: 20px;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 10px 0;
    -webkit-overflow-scrolling: touch;
    -webkit-scroll-snap-type: x mandatory;
    -ms-scroll-snap-type: x mandatory;
    scroll-snap-type: x mandatory;
    -webkit-scroll-behavior: smooth;
    scroll-behavior: smooth;
}

#roiBlocksContainer .roi-block {
    margin-right: 15px;
    -webkit-scroll-snap-align: start;
    -ms-scroll-snap-align: start;
    scroll-snap-align: start;
    flex-shrink: 0;
    width: 90%;
    max-width: 400px;
}

#roiBlocksContainer .roi-block:last-child {
    margin-right: 0;
}

/* Single item - no scroll, full width */
#roiBlocksContainer:only-child {
    overflow-x: visible;
    display: block;
    -webkit-scroll-snap-type: none;
    -ms-scroll-snap-type: none;
    scroll-snap-type: none;
    -webkit-scroll-behavior: auto;
    scroll-behavior: auto;
}

#roiBlocksContainer:only-child .roi-block {
    margin-right: 0;
    width: 100%;
    -webkit-scroll-snap-align: none;
    -ms-scroll-snap-align: none;
    scroll-snap-align: none;
}

















.roi-block {
    min-width: 100%;
    width: 100%;
    min-height: 150px;
    height: auto;
    background: #f0f0f0;
    border: 2px solid #007bff;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    font-weight: bold;
    flex-shrink: 0;
    padding: 10px;
    box-sizing: border-box;
}

.roi-block > div {
    width: 100%;
    margin-bottom: 10px;
}

.roi-block input {
    width: 100%;
    box-sizing: border-box;
}


.roi-block.combined {
    background: #e6f0ff;
    border-color: #0056b3;
}


/* Update Toast Notification */
.update-toast {
    position: fixed;
    width: 90%;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #2c3e50;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 10000;
    font-family: Arial, sans-serif;
    animation: slideUp 0.3s ease-out;
}

.update-toast span {
    font-size: 14px;
}

.update-toast button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 6px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
}

.update-toast button:hover {
    background-color: #45a049;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}















/* Image Enlarger Modal Styles */
.image-enlarger-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #d3d3d3;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
}

.image-enlarger-container {
    width: 100%;
    height: 85%;
    overflow: auto;
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    cursor: grab;
    -webkit-overflow-scrolling: touch;
}

.image-enlarger-wrapper {
    transform-origin: 0 0;
    display: inline-block;
}

.image-enlarger-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    user-select: none;
    -webkit-user-select: none;
}

.image-enlarger-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 4px;
    font-size: 24px;
    cursor: pointer;
    z-index: 100001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}



.image-enlarger-close-btn:active {
    background-color: rgba(0, 0, 0, 0.9);
}

.image-enlarger-zoom-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    z-index: 100000;
    background-color: #2a2727;
    padding: 8px 12px;
    border-radius: 4px;
    width: auto;
    max-width: 90%;
}

.image-enlarger-zoom-out-btn,
.image-enlarger-zoom-in-btn,
.image-enlarger-reset-btn,
.image-enlarger-download-btn {
    background-color: #333;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
    height: 36px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.image-enlarger-zoom-out-btn:active,
.image-enlarger-zoom-in-btn:active,
.image-enlarger-reset-btn:active,
.image-enlarger-download-btn:active {
    background-color: #555;
}

.image-enlarger-zoom-out-btn {
    font-size: 20px;
    padding: 8px 12px;
}

.image-enlarger-zoom-in-btn {
    font-size: 20px;
    padding: 8px 12px;
}

.image-enlarger-reset-btn {
    background-color: #4CAF50;
}

.image-enlarger-reset-btn:active {
    background-color: #45a049;
}

.image-enlarger-download-btn {
    background-color: #2196F3;
}

.image-enlarger-download-btn:active {
    background-color: #0b7dda;
}

.image-enlarger-zoom-percent {
    color: white;
    font-size: 14px;
    font-weight: bold;
    min-width: 50px;
    text-align: center;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* iPad and larger screens */
@media (min-width: 768px) {
    .image-enlarger-container {
        height: 90%;
    }
    
    .image-enlarger-zoom-bar {
        padding: 10px 16px;
        gap: 10px;
    }
    
    .image-enlarger-zoom-out-btn,
    .image-enlarger-zoom-in-btn,
    .image-enlarger-reset-btn,
    .image-enlarger-download-btn {
        padding: 8px 18px;
        font-size: 14px;
        height: 38px;
    }
    
    .image-enlarger-zoom-out-btn,
    .image-enlarger-zoom-in-btn {
        font-size: 20px;
        padding: 8px 14px;
    }
    
    .image-enlarger-zoom-percent {
        font-size: 14px;
        min-width: 55px;
        height: 38px;
    }
}

/* Small screens (mobile) */
@media (max-width: 480px) {
    .image-enlarger-zoom-bar {
        padding: 6px 10px;
        gap: 10px;
        border-radius: 4px;
    }
    
    .image-enlarger-zoom-out-btn,
    .image-enlarger-zoom-in-btn,
    .image-enlarger-reset-btn,
    .image-enlarger-download-btn {
        padding: 6px 12px;
        font-size: 12px;
        height: 32px;
    }
    
    .image-enlarger-zoom-out-btn,
    .image-enlarger-zoom-in-btn {
        font-size: 18px;
        padding: 6px 10px;
    }
    
    .image-enlarger-zoom-percent {
        font-size: 12px;
        min-width: 45px;
        height: 32px;
    }
}











/* ROI Block - Salesperson View */
.roi-block-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.roi-block-toolbar .toolbar-btn {
    flex: 1;
    padding: 14px 0;
    border: 2px solid #ccc;
    background-color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
    min-height: 50px;
    text-align: center;
}

.roi-block-title {
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 15px;
    padding: 10px;
    background-color: #e8f4f8;
    border-radius: 4px;
}

/* Formula container (hidden) */
.roi-formula-container {
    margin-top: 10px;
    margin-bottom: 10px;
    padding: 8px;
    background-color: #f5f5f5;
    border-radius: 4px;
    border: 1px solid #ddd;
    display: none;
}

.roi-formula-container .formula-text {
    font-family: monospace;
    font-size: 12px;
    word-break: break-all;
    margin-bottom: 5px;
}

.roi-active-formula-note {
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

/* Result display */
.roi-result-display {
    margin-top: 15px;
    padding: 10px;
    border: 1px solid #ccc;
    background-color: #f9f9f9;
}

.roi-result-display div {
    margin: 5px 0;
}

/* Field containers */
.roi-field-container {
    margin-bottom: 15px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.roi-field-label {
    font-weight: bold;
    margin-bottom: 5px;
}

.roi-field-input {
    width: 100%;
    padding: 5px;
    margin-bottom: 5px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 14px;
    box-sizing: border-box;
}

.roi-calc-label {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    margin-bottom: 3px;
}

.roi-calc-input {
    width: 100%;
    padding: 5px;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 12px;
    font-family: monospace;
    box-sizing: border-box;
}

.roi-field-divider {
    margin: 10px 0;
    border: none;
    border-top: 1px solid #eee;
}


/* Generate Image - Report Container */
.roi-report-container {
    background-color: white;
    padding: 20px;
    width: 400px;
    font-family: Arial, sans-serif;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.roi-report-header {
    text-align: center;
    margin-bottom: 20px;
}

.roi-report-title {
    margin: 0;
    color: #333;
}

.roi-report-date {
    font-size: 12px;
    color: #666;
}

.roi-report-individual-section {
    margin-bottom: 20px;
}

.roi-report-individual-title {
    margin: 0 0 10px 0;
    font-size: 16px;
}

.roi-report-individual-list {
    background: #f9f9f9;
    padding: 10px;
    border-radius: 4px;
}

.roi-report-individual-item {
    margin: 5px 0;
    padding: 5px;
    border-bottom: 1px solid #eee;
}

.roi-report-combined {
    background: #e8f4f8;
    padding: 15px;
    border-radius: 4px;
    text-align: center;
}

.roi-report-combined-label {
    font-size: 18px;
    font-weight: bold;
}

.roi-report-combined-value {
    font-size: 24px;
    font-weight: bold;
    color: #2c7a4d;
    margin-top: 5px;
}

.roi-report-footer {
    margin-top: 20px;
    text-align: center;
    font-size: 10px;
    color: #999;
}



/* Share to LINE - Overlay Container */
.share-overlay-container {
    position: relative;
    display: inline-block;
    width: 100%;
}

.share-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(76, 175, 80, 0.95);
    color: white;
    padding: 20px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    line-height: 1.5;
}


/* Sales List Container */
.sales-list-container {
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

/* Sales Product */
.sales-product {
    margin-bottom: 12px;
    padding: 10px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
}

.sales-product-title {
    display: block;
    margin-bottom: 5px;
    color: #333;
    font-size: 20px;
    font-weight: bold;
}

/* Sales Block */
.sales-block {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.sales-block-label {
    margin-left: 15px;
}

/* Sales Buttons Container */
.sales-buttons-container {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}

.sales-clear-btn {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    min-height: 44px;
    background: #6c757d;
    color: white;
}

.sales-ok-btn {
    flex: 2;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    min-height: 44px;
    background: #6c757d;
    color: white;
}

/* ROI Select Checkbox */
.roi-select {
    width: 30px;
    height: 30px;
    margin-left: 10px;
    opacity: 1;
    appearance: checkbox;
    -webkit-appearance: checkbox;
    display: inline-block;
    pointer-events: auto;
}



/* Update Combined Block - Individual ROIs */
.roi-individual-container {
    margin-bottom: 15px;
}

.roi-individual-title {
    font-weight: bold;
}

.roi-individual-list {
    margin-top: 5px;
}

.roi-individual-item {
    margin: 5px 0;
}

.roi-empty-message {
    color: #999;
}

/* Combined ROI Container */
.roi-combined-container {
    margin: 10px 0;
    padding: 10px;
    background: #e8f4f8;
    border-radius: 4px;
}

.roi-combined-label {
    font-weight: bold;
}

.roi-combined-value {
    font-weight: bold;
    color: #2c7a4d;
}



/* Image Modal */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.image-modal-main-img {
    max-width: 90%;
    max-height: 80%;
    object-fit: contain;
}

.image-modal-close-btn {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 40px;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    z-index: 10001;
}

.image-modal-prev-btn,
.image-modal-next-btn {
    position: absolute;
    font-size: 50px;
    background: rgba(0,0,0,0.5);
    border: none;
    color: white;
    cursor: pointer;
    padding: 20px;
    border-radius: 50%;
    z-index: 10001;
}

.image-modal-prev-btn {
    left: 20px;
}

.image-modal-next-btn {
    right: 20px;
}

.image-modal-counter {
    position: absolute;
    bottom: 20px;
    color: white;
    font-size: 16px;
    background-color: rgba(0,0,0,0.6);
    padding: 5px 15px;
    border-radius: 20px;
}




/* Temp Image Container */
.temp-image-container {
    position: relative;
    display: inline-block;
}

.temp-image {
    cursor: pointer;
}


.server-image-container {
    position: relative;
    display: inline-block;
}

.server-image {
    cursor: pointer;
}


/* TOP BAR - NEW */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: white;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.top-bar-left, .top-bar-right {
    flex: 1;
}

.top-bar-left { display: flex; justify-content: flex-start; }
.top-bar-right { display: flex; justify-content: flex-end; }

.install-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    height: 38px;
}

/* MODIFY existing .language-toggle - remove fixed positioning */
.language-toggle {
    display: flex;
    gap: 5px;
    /* remove: position, top, right, background, padding, box-shadow */
}

body {
    padding-top: 60px; /* ADD THIS to existing body */
}


/* Translation Section - pushes content down */
.translation-section {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    background: white;
    display: none;
    flex-direction: column;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-top: 10px;
    margin-bottom: 10px;
    overflow: hidden;
}

.translation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #007bff;
    color: white;
}

.translation-header h3 {
    margin: 0;
    color: white;
}

.close-translation-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0 10px;
}

.translation-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    max-height: 400px;
}

.translation-footer {
    padding: 15px 20px;
    border-top: 1px solid #ddd;
    display: flex;
    gap: 10px;
}

.translation-product {
    margin-bottom: 25px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fafafa;
}

.translation-product-header {
    font-size: 18px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #007bff;
}

.translation-subheader {
    font-size: 16px;
    font-weight: bold;
    margin: 15px 0 10px 0;
    color: #555;
}

.translation-block {
    margin: 15px 0 20px 15px;
    padding: 12px;
    border-left: 3px solid #28a745;
    background: #fff;
}

.translation-block-header {
    font-weight: bold;
    margin-bottom: 10px;
    color: #28a745;
}

.translation-fields {
    margin: 10px 0 0 15px;
}

.translation-field {
    margin: 10px 0;
    padding: 10px;
    border-left: 3px solid #ffc107;
    background: #fff9e6;
}

.translation-field-header {
    font-weight: bold;
    margin-bottom: 8px;
    color: #ff9800;
}

.translation-item {
    margin-bottom: 12px;
}

.translation-item label {
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 3px;
    color: #666;
    display: block;
}

.translation-input,
.translation-input-th {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.translation-textarea,
.translation-textarea-th {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
}

.translation-input-th,
.translation-textarea-th {
    background-color: #f0f8ff;
    border-color: #87ceeb;
}

.error-message {
    color: #dc3545;
    text-align: center;
    padding: 20px;
}