/* Root Variables and Base Styles */
:root {
    --app-width: 412px;
    --lineheight:2em;
}

* {
    box-sizing: border-box;
    font-size: inherit;
}

html {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-size: 1.2em;
    width: 100vw;
    height: 100%;
    max-width: var(--app-width);
    position: relative;
    font-family: Arial, sans-serif;
    padding: 2px;
    margin: 0;
    display: flex;
    flex-direction: column;
}

/* Layout Components */
 main {
    width: 100%;
    flex-direction: column;
    flex-grow: 1;
    display: flex;
    overflow-x: hidden;
    overflow-y: auto;
}
hr {
    width: 100%;
}
#idTrend{    align-content: center;}
.clsLine,
header, footer {
    position: relative;
    display: inline-flex;
    flex-direction: row;
    flex-shrink: 0;
    max-height: 3em;
    min-height: 2em;
    width: 100%;
    justify-content: space-between;
}
footer {
    height:3em;
}
 

article {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
}

/* Typography */
h1 {
    font-size: large;
    font-style: italic;
    text-align: center;
    margin: 8px;
}

h2 {
    text-align: center;
    padding: 0;
    margin: 0;
}

/* Form Elements */
.clsLine label {
    min-width: 80px; /* Set a fixed minimum width for labels */
    margin-right: 10px;
    text-align: right;
    flex: none; /* Prevent label from growing */
}
input {
    flex: 1;
    max-width: 50em;
    width: inherit;
    white-space: normal;
    padding-left: 5px;
}
p {    text-align: left;}
select {width: 100%;padding: 0;text-align: left;}  

/* Footer Elements */
footer button {
    flex: 0.3 0.3 40px;
    /* display: flex; */
    /* align-items: center; */
    /* justify-content: center; */
    padding: 0 7px 0 7px;
}

footer img {
    height: 2.5em;
    width: auto;
    object-fit: contain;
}

footer a {
    display: flex;
    align-items: center;
    height: 100%;
}

/* Dialog Styles */
.dialog,
dialog {
    position: absolute;
    width: var(--app-width)!important;
    max-width: 100%!important;
    /* height: 99%!important; */
    top: 25%;
    /* margin: 0!important; */
    padding: 3px;
    border-radius: 35px;
    z-index: 5;
    overflow: clip;
    /* Dialog colors */
    background: var(--dialog-bg);
    color: var(--dialog-text);
    border-color: var(--dialog-border);
}
.dialog h3,
dialog h3 { text-align: center; }
dialog button { height: 2.5em; }
dialog main { max-height: 100%  ; }
dialog .shoplist {
    /* max-height: 6em; */
    /* overflow-y: auto; */
}
.dialog footer,
dialog footer {
    display: flex;
    justify-content: space-around;
    /* padding: 1rem 0; */
    margin-top: auto;
}

.dialog footer button,
dialog footer button {
    min-width: 80px;
    padding: 0.5rem 1rem;
}


/*  Specific elements   */
.clsLookupLinksContainer { /*flex-around*/
    display: flex;
    justify-content: space-around;
    padding: 20px;
}
/* Utility Classes */
.clsAdvanced,
.clsHidden { display: none !important; }
.clsHiddenVideo {   /*  IOS QUIRK FOR VIDEOS */
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.clsRight {
    float: right;
    flex: none;
}
 
.clsCenter {
    display: inline-block;
    justify-items: center;
     text-align: center;
}
 
.clsButton {
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    margin: 10px 0 10px 0px;
}
.clsLarge {
  font-size: 2em; /* Makes it large */
  font-weight: 900; /*  make it bolder */
  margin: 0;
  padding: 0;
  min-width: 1em;
}
.clsidPriceChange{
    text-align: center;
}
/* Button Styles */
.buttonbar {
    position: absolute;
    bottom: 5%;
    left: 5%;
    width: 90%;
    max-width: 500px;
    opacity: 0.5;
    background: none;
}

.buttonbar button {
    font-weight: bold;
    font-size: 2em;
    width: 25%;
}
.clsWideButton { 
    flex: 10;
    height: inherit;
}

 

/* Message and Notification Styles */
.clsAppMessage, .fade-out-message {
    position: absolute;
    top: 3em;
    width: 100%;
    padding: 5px;
    border-radius: 5px;
    text-align: center;
    z-index: 5;
    opacity: 1;
    transition: opacity 0.5s ease-in-out;
}

 
 
/* Default Debug Panel (desktop view) */
#idDebugPanel {
    position: fixed;
    top: 0;
    right: 0;
    width: calc(97vw - var(--app-width));
    height: 100vh;
    border-left: 2px solid #333;
    padding: 1em;
    overflow-y: auto;
    font-family: monospace;
    z-index: 18;
    opacity: 0.8;
}
.clsBottomRight {
    position: fixed;
    bottom: 0;
    right: 0;
}

 

/* Spinner Animation */
.clsSplash {
    display:block;
    position: absolute;
    top: 3em;
    width:100%;
    padding-top: 5px;
    margin: 0;
    min-height: 10vh;
    z-index: 10;
    overflow: auto;
    justify-content: center;
    align-items: center;
    background: transparent;
}

.clsSplash button { margin: auto;    display: block;}
.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #fff;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 2s linear infinite;
    margin: auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/*  DRAGn DROP */
.clsGhostDrag  {
    touch-action: none;
    background: red;
    border: solid yellow;
    position: absolute;
    pointer-events: none;
    opacity: 0.8;
    z-index: 1000;
    user-select: none;
    cursor: grabbing;
}



/* Media Queries */
/* Optional: Better display on dark themes */
@media (prefers-color-scheme: dark) {
    .clsBarcodeSvg,
    .clsBarcodeImg {
        background: #fff; /* Keep bright background for scanning accuracy */
        filter: drop-shadow(0 0 4px #aaa);
    }
}
/* Mobile override */
@media (max-width: 600px) {
    #idDebugPanel {
        max-height: 25%;        /*Dont fill essential parts*/
        position: static;
        width: auto;
    }
}
@media (min-width: 800px) {
   body {
    max-width:600px !important;
   }
}
#idYesNoDlg { width: 90%; }
#idMessage {padding: 10px;}

/* ==== Video, Image & Canvas Display Zone ==== */

.clsVideoImgBox {
    position: absolute;
    top: 0px;
    bottom: 2em;
    width: 100%;
    display: block;
    padding: 10%;
    z-index: 14;
    align-self: center;
}
.clsVideoImgBox button img {/* Resize images in buttons   */
    display: block;
    height: 2.5em;
    width: auto;
    object-fit: contain;
}
.clsVideoImgBox #idSwitchCamera {  /* Camera switch button */
    position: relative;
    font-size: 1em;
    z-index: 11;
}


.clsVideoImgElem {
    display: block;
    width: 100%;
    height: 100%;
    border: solid thick;
}

/* ==== Barcode Styles ==== */

.clsBarcodeSvg,
.clsBarcodeImg {
    display: block;
    margin: auto;
    width: 100%;
    min-height: 240px;
    padding: 17px;
    margin-bottom: 1em;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #ccc;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}


#idBarcodeBackground {
    background: white;
    align-content: center;
    width: 100%;
}



/* ==== Shoplist ==== */

#idShopList {
    /* min-height: 40%; */
    /*flex: 0.1; not filling in planning mode  */
}

section,
.clsBlockBorder {
    border: solid gray;
    border-radius: 10pt;
}

/* ==== Product Listing ==== */

.clsProdList {
    width: 100%;
    max-width: 600px;
    display: block;
    margin: 0 auto;
    position: relative;
    overflow: auto;
    flex: 1;
}

.clsProdLine {
    display: flex;
    min-height: var(--lineheight);
    width: 100%;
    height: 50px;
    position: relative;
    margin-bottom: 10px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.clsProdLine .clsProdNameContainer {
    align-content: center;
    flex: 1;
    background: inherit;
    flex: 1 1 auto;       /* take available space but allow shrinking */
    min-width: 10em;         /* important: allows flex item to shrink */
    overflow-x: auto;     /* enable horizontal scrolling */
    white-space: nowrap;  /* keep text on one line */
    margin-left: 5px;
}
.clsProdLine button,
.clsProdLine span {
    /* display: inline-block; */           /* ensure width/height applies */
    min-width: 1em;
    height: 100%;                     /* use height instead of min-height */
    line-height: 2em;                /* vertical centering */
    text-align: center;              /* horizontal centering */
    font-size: 1.4em;
    /* font-weight: 700; */
    border: solid #c6d1dc;
    cursor: pointer;
}


.clsProdLine img {
    /* position: fixed; */
    max-width: 50px;
    /* height: 50px; */
    max-height: 100%;      /* constrain to parent's height */
    object-fit: scale-down;
    border-radius: 5px;
    /* margin-right: 10px; */
    /* background: url('./assets/basket.jpg') no-repeat; */
}
.clsScan2BasketBtn {
    background:transparent;
}
.clsImgDetails {
    background: url('./assets/basket.jpg') no-repeat;
    background-size: contain;
    display: inline-block;
    text-align: center;
    width: 50%;
}

/* Stile per tutti i placeholder in tutti i browser */
*::placeholder { /* Standard */
  font-size: 0.8em;
  opacity: 1; /* Assicura che non sia trasparente per default in alcuni browser come Firefox */
}

*::-webkit-input-placeholder { /* Chrome, Safari, Edge */
  font-size: 0.8em;
}

*::-moz-placeholder { /* Firefox */
  font-size: 0.8em;
  opacity: 1;
}

*:-ms-input-placeholder { /* Internet Explorer */
  font-size: 0.8em;
}

*::-ms-input-placeholder { /* Microsoft Edge (vecchie versioni) */
  font-size: 0.8em;
}




/* ==== Paste Box (Invisible Layer to Catch Pasting) ==== */

#idHiddenPasteBox2 {
    position: absolute;
    top: 0;
    left: -20;
    width: 140%;
    height: 100%;
    opacity: 0;
    background: transparent;
    z-index: 4;
}

/* ==== Centered Children ==== */

#idVideoImgBox .center {
    position: absolute;
    margin: auto;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ==== Product View Image ==== */

.clsProdView {
    min-height: var(--lineheight);
    display: flex;
    max-height: 50%;
    width: 100%;
    position: relative;
    top: -2em;
    resize: both;
    overflow: auto;
    margin: auto;
    justify-content: center;
    /* align-items: center; */
    border: solid yellow;
}

.clsProdView img {
    width: 50%;
    min-width: 60px;
    display: block;
    object-fit: contain;
}

/* ==== Product Quantity and Emoji ==== */

.clsQty {
    max-width: 3em;
    width: 2em;
    text-align: center;
    flex: 0.1;
    padding:0;
}

.clsEmoji{
    display: inline-block;
    font-size: var(--lineheight);     /* scale with parent */
    align-content: center;
    width: 1.5em;
    margin: auto;
}

/* ==== Trait Styles ==== */

.traitGrade2 {
    display: flex;
    width: auto;
}

/*  Suggestion text for empty content editable */
div:empty:before {
    content: attr(placeholder);
    font-style: italic;
    font-size: xx-large;
}
/* ==== Page Copy Editor ==== */

#idPageCopy {
    min-height: 10%;
    resize: both;
    overflow: auto;
    border: solid yellow;
}
#idPageCopy * {
    all: revert;
    font: revert;
    color: revert;
    background: revert;
    margin: revert;
    padding: revert;
    border: revert;
    text-decoration: revert;
    text-align: revert;
    vertical-align: revert;
    white-space: revert;
    line-height: revert;
    letter-spacing: revert;
    word-spacing: revert;
    text-transform: revert;
    text-indent: revert;
    direction: revert;
    float: revert;
    clear: revert;
    display: revert;
    position: revert;
    visibility: revert;
    z-index: revert;
    overflow: revert;
    clip: revert;
    box-sizing: revert;
}

/* ==== Association Items ==== */

.idclsAssociationItem {
    display: flex;
    align-items: center;
    margin: 10px;
    padding: 10px;
    border: 1px solid #ccc;
}

.idclsProductInfo img {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

.clsMetaLine {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    padding: 8px;
    margin-bottom: 8px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    cursor: pointer;
}

 

.clsMetaNumber {
    /* width: 1em; */
    /* font-weight: bold; */
    /* text-align: center; */
    /* margin-right: 10px; */
    /* display: none; */
    /* flex-shrink: 0; */
    font-size: small;
    /* margin: auto; */
}
.clsMetaTextBlock {
    display: flex;
    flex-direction: column;   /* stack alias + info vertically */
    flex: 1;                  /* fill remaining width */
}
.clsMetaAlias {
    flex: 1;
    font-size: 1em;
    padding: 2px 4px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-bottom: 4px;
}

.clsMetaInfo {
    font-size: 0.75em;
    font-style: italic;
    color: #555;
    display: flex;
    justify-content: space-between;
}

.clsMetaOption {
 content: "âœ“";                /* checkmark */
 
  width: 24px;
  height: 24px;
  display: inline-block;
  vertical-align: middle;
  flex: none; /* remove flex width before number */
}
 
 /*Comparison table*/


.diff-cell {
    border: solid red;
}

.clsSettings {
    justify-items: center;
}
.clsSettings button{
    display: block;
    width: 80%;
    margin: 5px;
}

summary {line-height: var(--lineheight);}
.clsSpacer {
    display: inline-flex;   /* stays on the same line */
    line-height: var(--lineheight);
    width: 70%;                /* fills available space */
    justify-content: space-evenly; /* push any children to the right (optional) */
    /* align-items: center; optional vertical alignment */
    float: right;
    position: relative;
    top: -2em;
}


 /*  file:traits.css
 Unified Trait Styling - Updated to match elements.css and styles.css */
.clsTraitContainer {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;

    border-radius: 5px;
    padding: 10px;
}

.idTraitRight {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.idTraitLabel {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.clsSelectedTrait {
    border: 2px solid yellow !important;
    box-shadow: 0 0 5px rgba(255, 255, 0, 0.5);
}

.clsWeightControl {
    display: flex;
    align-items: center;
    width: 100%;
    justify-content: space-between;
    margin: 5px 0;
}

.clsTraitEntry {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 5px;
    
}

.clsTraitTitle {
    display: flex;
    align-items: center;
    gap: 5px;
}

.clsTraitLabel, .idTraitLabel {
    min-width: 60px; */
    font-weight: bold;
    flex: 1;
    margin-right: 10px;
}

.idclsEvidenceLink {
    white-space: nowrap;
}

.idclsEvidenceEdit {
    padding: 8px;
}

.clsWeightDown, .clsWeightUp {
    border-radius: 4px;
    min-height: 40px;
}

.clsTraitslider {
    width: 100%;
    height: 10px;
    margin: 10px 0;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 5px;
    outline: none;
    margin: 0 10px;
}

.clsTraitslider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 2px solid #888;
    cursor: pointer;
}

.clsTraitslider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 2px solid #888;
    cursor: pointer;
}

.clsWeightDisplay {
    min-width: 40px;
    text-align: center;
    font-weight: bold;
}

/* Match slider styling */
.clsTraitMatchSlider {
    width: 100%;
    margin: 15px 0;
    height: 10px;
    border-radius: 5px;
    background: linear-gradient(to right, purple, blue, green, yellow, red);
    -webkit-appearance: none;
    appearance: none;
}

.clsTraitMatchSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 2px solid #888;
    cursor: pointer;
}

.clsTraitMatchSlider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 2px solid #888;
    cursor: pointer;
}

/* Price input specific styling */
.clsPriceInput, .price-input {
    width: 80px;
    max-width: 6em;
    padding: 0px;
    border: 1px solid #555;
    border-radius: 3px;
   text-align: right;
}

/* Responsive adjustments */
.clsTraitEntry {
    flex-direction: column;
    align-items: stretch;
    padding: 10px;
}

.clsAddButton, .clsDelButton {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    margin-top: 15px;
}


/* Match emoji styling */
.clsMatchEmoji {
    font-size: 1.5em;
    margin: 0 10px;
}

/* List styling */
.clsTraitsList, .traits-list {
    margin-top: 2px;
    list-style: none;
    padding: 0;
}

 
#idTraitMatchSlider {
    width: 100%;
    margin: 10px 0;
    flex: 1;
}

 .clsCircular {
    border-radius: 40%;
    height: 40px;
    align-self: center;
 }
 
 