/*
 * Object.css
 */
:root {
  --input-background: rgba(222, 222, 222, .2);
}

a {
  color: unset;
  cursor: pointer;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

form{
  padding: 0;
  margin: 0;
}

/* For neu and edit, to darken the margins */
form >obj {
  box-shadow: 0px 0px 1000px 1000px rgba(1, 1, 1, .1) !important; 
  border: 1px solid silver !important;
}

obj {
  display: block;
  border: 0;
  padding: 4;
  overflow: visible;
  text-align: left;
  position: relative;
  //border: 1px solid #ddd;
}


obj[mode=neu],
obj[mode=edit],
obj[mode=view],
obj[mode=list] {
  //border-bottom: 10px solid gray;
  //border-image-source: linear-gradient(to right, rgba(0,0,0,0), rgba(0,0,0,.2), rgba(0,0,0,0));
  //border-image-slice: 1;
  box-shadow: var(--box-shadow);

  //padding: 5 0 0 0;
  margin-bottom: 20;
}


obj[mode=tile] {
  width: 300;
  height: 300;
  display: inline-block !important;
  margin: 15 5;
  overflow: hidden;
  border: 0;
}
obj[mode=tile] attr{
  display: inline-block;
  padding: 0;
  margin: 0;
}

obj attr {
  position: relative;
  display: block;
  margin-bottom: 5;
  word-break: break-word;
}

/*
obj[mode=view] attr {
  max-width: calc(100% - 30px);
}
*/

obj attr >label {
  white-space: nowrap;
  padding: 0 8 0 0;
}
/* checkbox also use label, so only first label */
obj attr >label:first-child {
  display: block;
  text-transform: uppercase;
  font-size: small;
  padding: 9 0 0 0;
  opacity: .4!important;
}
obj attr >label >hint{
  text-transform: none;
  opacity: .8!important;
}

obj attr value{
  display: block;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}

obj attr input{
  display: inline-block;
  border: 0;
  border-bottom: 1px solid rgba(222, 222, 222, .5);
  font: unset;
  background: var(--input-background);
}
obj attr [required]{
  border-color: orange !important;
}

obj attr video.preview,
obj attr img.preview {
    //display: inline-block;
    display: block;
    overflow: hidden;
    width: 100%;
    //height: 100%;
    height: inherit;
    object-fit: cover;
    object-position: center;
}

obj attr img.preview[src=''],
obj attr video.preview[src='']{
  display: none;
}

/* show file name */
obj[mode=edit] attr file[file]:after {
  content: attr(file);
  opacity: .6;
  color: white;
  background: silver;
  position: absolute;
  bottom: 0; left: 0; right: 0;
  margin: auto;
  text-align: center;
}

obj attr a img{
  height: 20;
}


obj attr input[type=password],
obj attr input[type=email],
obj attr input[type=text] {
  width: 100%;
}
obj attr input[type=checkbox] {
  margin-right: 5px;
}

obj attr textarea{
  height: auto;
  overflow-y: hidden;
  resize: none;
  background: var(--input-background);
}

obj attr [contenteditable] {
  white-space: pre-wrap;
  text-align: left;
  border: 0;
  border-bottom: 1px solid rgba(222,222,222, .5);
  background: var(--input-background);
  display: block;
  //min-height: 3em;
  padding: 2;
}

obj attr [contenteditable]:empty:before {
  content: attr(placeholder);
  color: var(--color);
  opacity: .6;
}

obj attr [contenteditable] ::selection {
  background-color: silver;
  color: unset;  /* to show style color */
}

obj >attr >editor{
  display: flex;  /* to remove gaps between buttons */
  justify-content: flex-end;
}
obj >attr >editor >*{
  box-shadow: unset;
  font-family: serif;
  font-size: large;
}
obj >attr >editor >*:hover{
  box-shadow: var(--box-shadow);
}

obj attr rotate,
obj attr input[type=file],
obj attr img.camera {
    position: absolute;
    display: inline-block;

    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: auto;

    width: 35;
    height: 30;

    opacity: .5;
    background: white;
    padding: 2;
    cursor: pointer;

    z-index: 1; /* in case image is empty */
}

/* prevent double clicking */
obj attr img.camera[open] {
  pointer-events: none; 
  opacity: .2;
}

obj attr rotate {
    font-size: x-large;
    right: unset;
    bottom: unset;
    width: 33;
    height: 23;
    text-align: center;
    display: none;
}
obj file[type=image] rotate {
    display: unset;
}

obj attr input[type=file]{
    opacity: 0;
}

obj buttons {
  display: block;
  text-align: center;
  padding: 0;
  margin: 10 0;
}
obj buttons button {
  margin: 2;
}

obj buttons img {
  float: right;
  height: 15;
  cursor: pointer;
}

obj buttons tab{
  color: unset;
  background: unset;
  margin: 4;
  padding: 0;
  border: 3px solid transparent;
  text-transform: uppercase;
}
obj buttons tab[open]{
  border-top: 3px solid transparent;
  border-bottom: 3px solid var(--color-bg);
}

table {
  //table-layout: fixed;
  border-collapse: collapse;
  border-spacing: 1px;
  width: 100%;
}

table th{
  text-align: left;
  opacity: .6;
  background: rgba(1,1,1,.2);
  padding: 3;

  border: 1px solid transparent;
  font: unset;
  font-size: small;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
}
table th[index]{
  cursor: unset; 
}
table th[name]{
}
table th[order],
table th[name]:hover{
  color: white;
  background: var(--color);
}

table th[name=button]{
  width:15;
}

table obj {
  display: table-row;
  padding: 3;
  cursor: pointer;
  border: 0;
}

/* forget about hovering, overrated, not for mobile.
obj[mode=list]:hover,
obj[mode=table]:hover {
  //background: rgba(222,222,222,.2);
  filter: brightness(.7);
}
*/

/*
 * reverse color/background
 */
obj[klass][mode=list][open],
table obj[klass][open] {
  color: var(--background-color);
  background-color: var(--color);
}

table obj[klass] >attr[name=_index] {
  text-align: right;
  color: #efefef;
}

table obj[klass] >attr[name] {
  display: table-cell;
  vertical-align: top;
  //padding: 3;
  white-space: nowrap;
  overflow: hidden;
}

table >obj >attr >value{
  padding: 5;
  white-space: nowrap;
}

table attr.button img{
  padding: 3;
}
table attr img {
  width: 17;
  height: 17;
  cursor: pointer;
}

table >obj[klass] >attr[name] file{
  width: 40;
  height: 20;
  padding:1;
}

tiles {
  display: grid;
  grid-gap: 0px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  clear: both;
}
tiles >obj[klass]{
  border: 0;
  background: var(--background);
}

obj >omenu {
  position: absolute; 
  top: 0; right: 0;

  text-decoration: none;
  //width: 26;
  padding: 0;
  display: inline-block;
  z-index: 1;
  direction: rtl;
  text-align: right;
  //border-radius: 1em;
}

obj >omenu:hover{
  z-index: 3;
}

obj > omenu >mi{
  text-align: right;
  font-size: 16;
  display: block;
  color: var(--color);
}

obj >omenu img{
  cursor: pointer;
  height: 18;
  padding:  4;
  font-size: 12;
  border-radius: 1em;
  vertical-align: middle;
  box-shadow: unset;
}

/* options image */
obj >omenu:hover >img{
  //padding: 9;
}

/* dialog window */
window {
  position: fixed;
  //top: 0;
  right: 0;
  bottom: 0;
  min-width: 320;
  //max-width: 620;
  max-height: 99vh;
  width: 50%;

  background: var(--background);
  border: 1px solid rgba(222,222,222, .5);
  box-shadow: 0px 0px 1000px 1000px rgba(1,1,1,.3); //: darkens the margin;
  z-index: 10;
  overflow: auto;
  margin: 3;
  
  /* hide scrollbar */
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}
window::-webkit-scrollbar {
  /* hide scrollbar for chrome, safari, opera */
  display: none;
}

window >buttons{
  display: block;
  padding: 2;
  background: var(--color);
  opacity: .6;
  text-align: right;
  margin: 0;
}
window >buttons >img{
  float: unset;
  padding: 6;
  border-radius: 50%;
  height: 24;
}
window >buttons img:hover {
  background: rgba(222,222,222,.2);
}
window omenu img.delete{
  display: none;
}
window obj {
  /* removed to focus on mail reply object in window together with original message */
  //box-shadow: unset !important;
  margin: 0 !important;
}

/* put embed to a specific ratio 16:9 */
embeder{
  position: relative;
  width: 100%;
  padding-top: 57%;
  display: block;
}
embeder embed{
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* 5 stars rating
 * <attr><input><label>
 */
attr.stars input {
  //display: none;
  //: allow to be form validated;
  position:absolute;
  opacity: 0;
  z-index: -1;
}

attr.stars .clear {
  float: none;
  clear: both;
}

attr.stars > label[for] {
    //float: right;
    display: inline;
    padding: 0;
    margin: 0;
    position: relative;
    width: 14;
    color: gold;
    font-size: unset;
}
attr.stars > input ~ label[for]{
    cursor: pointer;
}

attr.stars > label[for][checked],
attr.stars > input:checked ~ label[for] {
    color: silver;
}
attr.stars > input:required ~ label[for]{
  border-top: 1px solid orange;
}

attr >file {
  position: relative;
  display: block;
  //border: 1px solid #efefef;
}
attr >file[type=''] {
    display: none;
}

attr >file img.delete {
    position: absolute;
    top: 4; right: 4;
    cursor: pointer;
    width: 18; 
    height: 18;
}

annotation {
  color: gray;
  background: ivory;
  font-size: small;
  position: absolute;
  bottom: 0;
  margin: 1;
  text-align: left;
}

/* use tabs to control list attributes */
tabs {
  display: block;
  clear: both;
  text-align: right;
}
tabs buttons,
tabs tabo {
  display: block;
  margin: 10 0 5 0;
}

tabs >obj[klass]{
  border: 0;
  margin-bottom: 10;
}

/* 
 * To zoom an image or slideshow within browser viewport instead of fullscreen.
 * Avoiding cutting off of overflow region in fullscreen.
 */
obj attr video[zoom=true],
obj attr img[zoom=true],
[zoom=true] {
  position: fixed;
  top:0; left:0; right:0; bottom: unset;
  margin: auto;
  z-index: 20;
  //box-shadow: 0px 0px 1000px 1000px rgba(1, 1, 1, .1) !important; 
  background: silver;
  cursor: zoom-out;

  /* cannot change in later css
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  */
  width: 100%;
  height: 100%;
  object-fit: contain;
}
[zoom=false]{
  cursor: zoom-in;
}
