/* CPS Live - Custom Theme 2026
    Based on jQuery UI 1.13.2 Framework
    Using Flexbox for forms and browses
    Structure: Config > Core Overrides > Components > Button System > Utilities > Responsive
*/

/* ==========================================================================
   1. CONFIGURATION (Variables & Base)
   ========================================================================== */

:root {
    /* --- Color Palette --- */
    --color-blue: #0f2dff;
    --color-light-blue: #38B8C8;
    --color-red: #C84838;
    --color-pink: #C83870;
    --color-beige: #C89038;
    --color-green: #45980f;
    --color-light-green: #38C848;
    --color-light-grey: #dcdcdc;
    --color-purple: #9038C8;
    --color-light-purple: #C838B8;
    --color-dark-purple: #4838C8;
    --color-black: #383838;
    --color-grey: #707070;
    --color-silver: #C8C8C8;
    --color-yellow: #FFFF00;
    --color-dark-blue-border: #3B63ED;
    --color-border-dark: #888888;
    --color-menu-main: #A2A6DA; 

    /* --- Semantic Colors --- */
    --color-primary-ui: var(--color-blue);
    --color-secondary-ui: var(--color-light-blue);
    --color-success: var(--color-green);
    --color-danger: var(--color-red);
    --color-text-default: var(--color-black);
    --color-text-light: #fff; 
    --color-text-highlight: #2A7B7B; 

    /* --- Spacing & Layout --- */
    --spacing-1x: 0.25rem;
    --spacing-2x: 0.5rem;
    --word-spacing: 1rem;
    --browse-grid-cell-padding: 1rem;
    --entry-radius: 0.5rem;
    --font-weight-bold: bold;
}

/* ==========================================================================
   2. JQUERY UI CORE OVERRIDES (Global Fixes)
   ========================================================================== */

/* Remove default jQuery UI textures globally */
.ui-widget-content, 
.ui-widget-header, 
.ui-state-default, 
.ui-state-hover, 
.ui-state-active {
    background-image: none !important;
}

/* Global Focus States */
:is(input[type="text"], input[type="password"], textarea, .ui-selectmenu-button) {
    outline: 2px solid transparent;
    outline-offset: 2px;
    transition: border-color 0.2s, box-shadow 0.2s, outline-color 0.2s;
    border: 1px solid var(--color-silver);
}     

:is(input[type="text"], input[type="password"], textarea, .ui-selectmenu-button):focus {
    border-color: var(--color-primary-ui) !important;
    outline: 2px solid var(--color-primary-ui);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(15, 45, 255, 0.2);
    background: #fff !important;
}

/* ==========================================================================
   3. JQUERY UI COMPONENTS
   ========================================================================== */

/* --- Dialogs & Overlays --- */
.ui-dialog {
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--color-silver) !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    background: #fff;
}                                                                    

.ui-widget-overlay {
    background: rgba(15, 45, 255, 0.15) !important;
    backdrop-filter: blur(4px);
    opacity: 1 !important;  
}

.ui-dialog .ui-dialog-titlebar {
    background: var(--color-primary-ui);
    color: white;
    border: none;
    border-radius: 0;
    padding: 1rem 1.5rem;
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ui-dialog .ui-dialog-title { min-height: 3.8rem; }  

.ui-dialog .ui-dialog-titlebar-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    margin: 0;
    transition: background 0.2s ease;
    inset-inline-end: 0.75rem;
    top: 0.75rem;
}

.ui-dialog .ui-dialog-titlebar-close:hover { background: var(--color-danger); }
.ui-dialog-titlebar-closehide { display: none; }   

/* --- SelectMenu Popup --- */
.ui-selectmenu-menu .ui-menu {
    background: #ffffff !important;
    border: 1px solid var(--color-silver) !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 0;
}

.ui-selectmenu-menu .ui-menu-item-wrapper {
    padding: 0.75rem 1rem;
    transition: background 0.2s;
}

.ui-selectmenu-menu .ui-menu-item-wrapper.ui-state-active {
    background: var(--color-primary-ui) !important;
    color: #fff !important;
    border: none !important;
    margin: 0 !important;
}   

/* --- Accordions & Generic Buttons --- */
.ui-accordion .ui-accordion-content { padding: 0; } 

.ui-button {
    border: 0.15rem solid var(--color-yellow) !important;
}                                                                  

/* ==========================================================================
   4. THE BUTTON SYSTEM (Modular)
   ========================================================================== */

/* --- Core Logic --- */
:is(.btn-base, .Next-button, .Quantity-button, .Post-button, 
    [class*="menu-button-"], .btn-phonebase, .holdbutton, .extramenu-button) {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    white-space: normal;
    word-break: break-word;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    text-decoration: none;
    font-family: inherit;
    border: none;
    gap: 0.5rem;
    transition: transform 0.1s ease, filter 0.2s, background 0.2s;
    min-width: 2.75rem; 
    min-height: 2.75rem;
    border-radius: var(--radius-full, 2rem);

    &:active {
        transform: scale(0.96);
        filter: brightness(0.9);
    }
    &:focus-visible {
        outline: 4px solid var(--color-blue);
        outline-offset: 2px;
    }
}          

/* --- Semantic Variants --- */
.Next-button { background: var(--color-primary-ui); color: #fff; flex-grow: 1; max-width: 12rem; padding: 0.8rem 1rem; }
.Post-button { background: var(--color-success); color: white; font-weight: bold; flex-grow: 1; max-width: 18.75rem; padding: 1rem; }
.holdbutton  { background: var(--color-danger); color: white; flex-grow: 1; max-width: 10rem; font-size: 1.25rem; }
.Quantity-button { background: var(--color-secondary-ui); color: var(--color-black); width: 9.4rem; padding: 1rem 1.5rem; }

/* --- Menu Navigation --- */
.menu-button-large { background: var(--color-dark-purple); width: 12rem; min-height: 6rem; font-size: 1.4rem; font-weight: 300; line-height: 1.2; color: #fff; }
:is(.menu-button-small, .menu-button-xsmall) { background: var(--color-primary-ui); color: #fff; width: 100%; padding: 1rem 1.5rem; margin-bottom: 0.5rem; }
:is(.cps-mobilemenu-button, .cps-menu-button) { width: 98% !important; min-height: 3rem; background: var(--color-primary-ui); color: white; padding-inline-start: 1.5rem; border-radius: 1rem; font-weight: 300; }

/* --- Radio/Checkbox as Buttons --- */
.ui-checkboxradio-icon { display: none !important; }

.ui-checkboxradio-label.ui-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    background: var(--color-light-grey) !important;
    border: 1px solid var(--color-silver) !important;
    color: var(--color-black);
    padding: 0.5rem 1.5rem;   
    min-height: auto; 
    border-radius: var(--entry-radius);
    font-weight: 500;
}

.ui-checkboxradio-label.ui-button:hover { background: #f0f0f0 !important; border-color: var(--color-primary-ui) !important; }
.ui-checkboxradio-label.ui-checkboxradio-checked.ui-state-active {
    background: var(--color-primary-ui) !important;
    color: #fff !important;
    border-color: var(--color-dark-blue-border) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* --- Mobile Specific Buttons --- */
.btn-phonebase { background: var(--color-silver); color: white; flex-shrink: 0; }
.btn-phone      { width: 9rem; height: 6rem; font-size: 0.75rem !important; }
.btn-phonesmall { width: 8rem; height: 4.5rem; font-size: 0.65rem !important; }
.btn-phoneextrasmall, .extramenu-button { width: 6rem; height: 3.5rem; font-size: 0.85rem; font-weight: 300; background: var(--color-primary-ui); color: white; }

/* ==========================================================================
   5. LAYOUT & STRUCTURAL COMPONENTS
   ========================================================================== */

/* ==========================================================================
   5. LAYOUT & STRUCTURAL COMPONENTS
   ========================================================================== */

.cps-site-header {  
    display: flex !important;
    justify-content: space-between; /* Logo left, Logout right */
    align-items: center;            /* Vertical centering */
    padding-inline: 1.5rem;
    width: 100%;
    height: 4.5rem;
    background: rgb(0 0 0 / 20%);
    box-sizing: border-box;
    position: relative;
}

.nt-responsive-stack { display: flex; flex-direction: column; gap: var(--spacing-2x); }                                     

.nt-responsive-flex-grid {
  display: flex;
  flex-wrap: wrap; 
  gap: 1rem;
  padding: var(--browse-grid-cell-padding);
}

.nt-responsive-flex-grid > * {
  flex: 1 1 150px; 
  max-width: 100%; 
}                                            

.nt-radio-div-buttons-hor { display: flex; flex-direction: row; border: none; }
/* Table & Scroll Wrappers */
.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 1.5rem; border-radius: var(--entry-radius); }
.PackingBrowseTable { width: 100%; border-collapse: collapse; font-size: clamp(1rem, 2vw, 2rem); }      
.RestockBrowseTable { font-size: 1.75rem; }
.scroll-container { width: 100%; max-width: 22rem; height: 12.5rem; overflow-y: auto; scroll-behavior: smooth; border: 1px solid var(--color-silver); }

/* ==========================================================================
   6. REDACTOR / CKEDITOR (Self-Contained)
   ========================================================================== */

.redactor-box.redactor-styles-on .redactor-in { background: #ffffff; }    
.hideredactortools .redactor-toolbar a.re-button-icon { display: none; }

@media (min-width: 961px) {
    .setredactorbig > .redactor-box.redactor-styles-on .redactor-in {
        width: 50rem; height: 21.25rem; font-size: clamp(0.9rem, 1vw, 1.1rem); padding: 1.5rem; border-radius: 4px;
    }
}

@media (max-width: 960px) and (min-width: 481px) {
    .setredactorbig > .redactor-box.redactor-styles-on .redactor-in,
    .setredactorsmall > .redactor-box.redactor-styles-on .redactor-in { width: 90vw; height: 15rem; font-size: 0.9rem; }
}

@media (max-width: 480px) {
    .setredactorsmall > .redactor-box.redactor-styles-on .redactor-in { width: 100%; max-width: 100vw; height: 12rem; font-size: clamp(0.75rem, 4vw, 0.85rem); padding: 0.8rem; }
    .redactor-toolbar { background: var(--color-light-grey); padding: 2px !important; }
}   

/* ==========================================================================
   7. BRANDING & IDENTITY
   ========================================================================== */

.logo-image { 
    width: 48px; 
    height: 48px; 
    object-fit: contain; 
    margin-inline-end: 0.5rem; 
}

.logo-name, .logo-wpname { 
    font-size: 1.25rem; 
    font-weight: var(--font-weight-bold); 
}

.logo-name { color: var(--color-blue); }
.logo-wpname { color: var(--color-black); }
                                                                 
/* Ensure the logo and text stay side-by-side */
.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    gap: 0.5rem;
}

.logout-btn { 
    background: var(--color-danger); 
    color: #fff !important;
    padding: 0.6rem 1.25rem; 
    border-radius: 2rem;
    cursor: pointer;
    font-size: 0.9rem; /* Slightly smaller for better fit */
    text-decoration: none;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    border: none;
    transition: all 0.2s ease;
}

.logout-btn:hover { 
    background: #c9302c; 
    transform: translateY(-1px); /* Subtle lift on hover */
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* ==========================================================================
   8. FEATURE SPECIFIC COMPONENTS (DropPart, Forms, Multimedia)
   ========================================================================== */

/* --- DropPart Custom Dropdown System --- */
:is(.cpsdroppart-dropdown, .cpsdroppart-dropdownsmall, .cpsdroppart-dropdownwide, .cpsentrypart-dropdown) {
    background: var(--color-light-grey) !important;
    text-align: start;
    white-space: nowrap;
    border: 1px solid var(--color-silver);
    overflow-y: auto; overflow-x: hidden;
    padding: 0; box-sizing: border-box;
}

:is(.cpsdroppart-dropdown, .cpsdroppart-dropdownsmall, .cpsdroppart-dropdownwide, .cpsentrypart-dropdown) > * {
    display: block; padding: 0.75rem 1.25rem; text-decoration: none; color: var(--color-text-default);
}

:is(.cpsdroppart-dropdown, .cpsdroppart-dropdownsmall, .cpsdroppart-dropdownwide, .cpsentrypart-dropdown) > *:hover {
    background: var(--color-silver); color: var(--color-blue);
}

.cpsdroppart-dropdown     { max-height: 30rem; min-width: 100%; }
.cpsdroppart-dropdownsmall { min-height: 20rem; max-width: 100%; }
.cpsdroppart-dropdownwide  { min-height: 30rem; width: 100%; max-width: 30rem; }

/* --- Special Component Buttons --- */
.ui-selectmenu-button.ui-button { display: inline-flex; align-items: center; justify-content: space-between; }      
.ui-selectmenu-button.ui-button:hover { background: #f0f0f0 !important; border-color: var(--color-primary-ui); } 

:is(.orderentryqty, .allocatependingpayment, .entrydroplist) > .ui-selectmenu-button.ui-button {
    background: var(--color-light-grey) !important; border: 1px solid var(--color-silver);
}

.orderentryqty > .ui-selectmenu-button.ui-button { width: 9rem; flex-direction: row; color: var(--color-primary-ui); padding-inline-end: 1rem; }
.allocatependingpayment > .ui-selectmenu-button.ui-button { width: 6.25rem; text-align: right; }

.cpspasswordbutton { position: relative; right: 6rem; background: var(--color-secondary-ui); min-width: 0.5rem; padding-inline-start: 1rem; }

/* --- Forms & Entry Styles --- */
.EntryBoxOption { display: inline-flex; align-items: center; padding: 0 1rem; min-height: 3.5rem; background: var(--color-light-grey); color: var(--color-blue); border-radius: var(--entry-radius); font-weight: 500; }
.browseentry { display: block; width: 100%; padding: 1rem; min-height: 6rem; text-align: center; background: #fff; border: 1px solid var(--color-silver); color: var(--color-text-highlight); font-weight: 700; font-size: clamp(0.85rem, 1.2vw, 1.1rem); word-break: break-word; overflow-wrap: anywhere; }   
.orderqtyentry { max-width: 5.5rem; background: var(--color-light-grey); color: var(--color-primary-ui); text-align: center; font-weight: bold; }

/* --- Multimedia --- */
.cpsyoutube { width: 100%; max-width: 43.75rem; min-height: 25rem; aspect-ratio: 16 / 9; border-radius: var(--entry-radius); } 
.cpsperformance { background: var(--color-primary-ui); color: var(--color-text-light); text-align: right; padding: 0.5rem 1rem; font-weight: var(--font-weight-bold); }
.cpsemoji { margin-inline-end: 0; padding: 0.25rem 0 0 0; }

/* ==========================================================================
   9. UTILITY CLASSES (Refactored)
   ========================================================================== */

/* --- Color Backgrounds --- */
.colourblue    { background: var(--color-blue); color: white; }
.colourpink    { background: var(--color-pink); color: white; }
.colourgrey    { background: var(--color-grey); color: white; }
.coloursuccess { background: var(--color-success); color: white; }
.colourbeige   { background: var(--color-beige); color: white; }
.colourpurple  { background: var(--color-purple); color: white; }      

/* --- Typography & Text --- */
.cpstextgreen { color: var(--color-blue); font-weight: bold; }
.cpshighlight  { background: var(--color-primary-ui); color: white; }
.cps-messageby { font-size: 0.75rem; opacity: 0.8; }
.cpsemailfont { font-size: 0.8rem; }
.Reset-button { color: var(--color-text-highlight); }

/* --- Fluid Sizes --- */
.noofitemstext   { font-size: clamp(2.5rem, 5vw, 4rem); color: var(--color-primary-ui); font-weight: 900; }  
.TrackingNumber  { font-size: clamp(1.25rem, 5vw, 2rem); font-weight: bold; }
.pendingamount   { background: var(--color-primary-ui); color: white; min-height: 3.5rem; padding: 0.5rem 1rem; display: flex; align-items: center; font-size: clamp(1.5rem, 4vw, 2.5rem); }
.MOBBrowseEntry  { font-size: clamp(1.5rem, 4vw, 2.5rem); }

/* --- Micro Utilities --- */
.cpssmallbutton       { width: 2rem; padding: 0; margin: 0 0.25rem; }
.cpssmallmenubutton   { width: 6rem; font-size: 0.6rem; }
.phoneplannerbutton   { width: 5rem; font-size: 0.5rem; }  
.cpswidth5em   { width: 5rem !important; }
.cpswidth10em  { width: 10rem !important; }
.cpsphotowidth { width: 100%; max-width: 25rem !important; }

/* --- Alignment Helpers --- */
:is(.cps-layout-tight, .cps-layout-flush) { display: flex; flex-wrap: wrap; align-items: center; & > * { margin: 0 !important; } }
.cps-layout-tight { gap: 0.1rem; }
.cps-layout-flush { gap: 0; }

.cps-smallform-cell {
    display: flex;
    flex-wrap: wrap; /* Critical for small mobile screens */
    align-items: center;
    gap: var(--spacing-2x);
}

.cps-smallform-prompt {
    flex: 0 0 8rem; /* Labels stay a fixed width */
    max-width: 100%;
}

.cps-smallform-cell > :not(.cps-smallform-prompt) {
    flex: 1 1 10rem; /* Inputs grow to fill remaining space */
}

/* ==========================================================================
   10. GLOBAL RESPONSIVE & ANIMATIONS (Cleaned & Consolidated)
   ========================================================================== */

.cps-loader {
    width: 3rem; height: 3rem;
    border: 0.3rem solid var(--color-silver); border-bottom-color: var(--color-blue); border-radius: 50%;
    display: inline-block; animation: rotation 1s linear infinite;
}

@keyframes rotation { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.nt-hide-desktop { display: block; }
.nt-button-mobile-full { width: 100%; margin-bottom: 0.5rem; }         
.cpsmobileform, .cpsplusmenu { width: 100%; margin: 0; padding: 0; }

/* Mobile Default (Up to 600px) */
@media (max-width: 600px) {   
    html { font-size: clamp(0.6rem, 1vw + 0.5rem, 0.8rem) !important; }   
    
    /* Hide names but keep the Logout button accessible */
    .logo-name, .logo-wpname { display: none; }
    
    .logout-btn { 
        padding: 0.5rem 1rem; 
        font-size: 0.85rem; 
    }
}

/* Ultra Small Screens (Up to 400px) */
@media (max-width: 400px) {
    .cps-site-header { padding-inline: 0.75rem; }
    .logo-image { 
        width: 38px; 
        height: 38px; 
    }
}
  
/* Tablet / Desktop Transition */ 
@media (min-width: 601px) {
    html { font-size: clamp(0.6rem, 1vw + 0.5rem, 0.85rem) !important; }
}  

/* Standard iPad Portrait */
@media (min-width: 768px) {   
    html { font-size: clamp(0.6rem, 1vw + 0.5rem, 0.85rem) !important; }  
    .nt-responsive-stack { flex-direction: row; gap: 1.5rem; }
    .menu-button-small { max-width: 40rem; }
    .menu-button-xsmall { max-width: 25rem; }
}

/* Large Tablet / Small Laptop */
@media (min-width: 961px) {   
     html { font-size: clamp(0.6rem, 1vw + 0.5rem, 0.85rem) !important; }  
     .nt-hide-desktop { display: none !important; }
}

/* Large Screens */
@media (min-width: 1601px) {
    html { font-size: clamp(0.6rem, 1vw + 0.5rem, 0.9rem) !important; }      
}