/**
 * Base styling for TARE
 * License: MIT 
 *
 * Inspired by (and heavily references): https://owickstrom.github.io/the-monospace-web/
**/

@font-face {
  font-family: "Commit Mono";
  src:
    url("/assets/fonts/CommitMonoV1-450-Regular.otf");
}

@font-face {
  font-family: "Commit Mono";
  src:
    url("/assets/fonts/CommitMonoV1-700-Regular.otf");
  font-weight: bold;
}

:root {
  --font-family: "Commit Mono", monospace;
  --line-height: 1.20rem;
  --border-thickness: 2px;
  --text-color: #111;
  --text-color-alt: #666;
  --background-color: #fbfbfb;
  --background-color-alt: #eee;
  --background-color-weak: #eaeaea;
  --border-color: #cccccc;
  --border-color-strong: #222;
  --border-color-alt: #cccccc;
  --border-color-alt-strong: #fff;
  --section-width-empty: 20px;

  font-family: var(--font-family);
  font-optical-sizing: auto;
  font-weight: normal;
  font-style: normal;
  font-variant-numeric: tabular-nums lining-nums;
  font-size: 14px;
}


html {
  display: flex;
  width: 100%;
  margin: 0;
  padding: 0;
  flex-direction: column;
  align-items: center;
  background: var(--background-color);
  color: var(--text-color);
}


body {
  width: 100%;
  max-width: calc(min(100ch, round(down, 100%, 1ch)));
  line-height: var(--line-height);
  overflow-x: hidden;
  padding: var(--line-height) 2ch calc(var(--line-height)) 2ch;
}

h1,h2,h3,h4,h5,h6 {
  font-weight: bold;
  margin: calc(var(--line-height)) 0 calc(2* var(--line-height));
  line-height: var(--line-height);
}

h1 {
  font-size: 2.5rem;
  line-height: calc(2 * var(--line-height));
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.25rem;
  margin: calc(var(--line-height)) 0 calc(1.25* var(--line-height));
}

form {
  margin-top: 1rem;
}

textarea {
  resize: vertical;
  height: 10em;
  width: 100%;
}


input, textarea {
  padding: 3px;
  box-shadow: none;
  border: 1px solid var(--border-color-strong);
  box-sizing: border-box;
}



button, input::file-selector-button {
  border: solid #0000007a;
  background: none;
  box-shadow: 1px 1px #000900;
  border-width: 2px;
  border-radius: 5px;
  width: auto;
  padding-top: 3px;
  padding-left: 5px;
  padding-bottom: 3px;
  padding-right: 5px;
  margin-right: 5px;
  margin-top: 4px;
  cursor: pointer;
}

input[type="file"] {
  border: none;
  box-shadow: none;
  padding: 0;
  margin: 0;
}

.big-button {
  border-width: 3px;
  border-radius: 5px;
  font-size: 1.5rem;
  padding: 0.5rem 10% 0.5rem 10%;
  display: block;
  margin: auto;
  margin-top: 3rem;
  margin-bottom: 1rem;
}

button:hover, input::file-selector-button:hover {
  background-color: #beefed; 
}

.big-button:hover {
  background-color: #beefed; 
}


button:active, input::file-selector-button:active {
  transform: translateY(2px);
  box-shadow: none; 
}


button:disabled {
  opacity: 0.5; 
  cursor: not-allowed;
  background-color: #cccccc; 
  color: #666666;
}


/* Optional: Ensure hover effects don't apply when disabled */
button:disabled:hover {
  background-color: #cccccc; 
  color: #666666;
}

strong {
  font-weight: bold;
}

i {
  font-style: italic;
}

.croppie-container .cr-boundary {
  margin: 0;
  text-align: left;
}

.croppie-container .cr-slider-wrap {
  text-align: left;
  margin: 0;


  .cr-slider {
    border: none;
    box-shadow: none;
    margin: 0;
  }
}


.section {
  position: relative;
  width: 100%;
  margin: var(--line-height) 0 0 0;
  border: var(--border-thickness) solid var(--border-color);
  border-radius: 1px;
  box-shadow: 3px 3px 1px #999999;
  padding: var(--line-height) 10% calc(2*var(--line-height)) 10%;
  box-sizing: border-box;
  
}

/* .section > * { */
  /* margin-left: 10%; */
  /* margin-right: 10%; */
/* } */

#navbar {
  margin-top: calc(var(--line-height)*0.5);
  
  display: flex;
  align-items: flex-end;
  
  width: 100%;
  gap: 1.5ch;

  font-size: 16px;

  .links-left,
  .links-right {
    flex: 1;
    display: flex;
    gap: inherit;
    align-items: center;
    font-size: 1em;
    color: black;
  }

  .links-left {
    justify-content: right;
  }
  .links-right{
    justify-content: left;

    /* Slight nudge up to make it more in line with the search bar */
    padding-bottom: 0.5ch;
  }

  .links-left *,
  .links-right * {
    color: black;
  }

  .logo {
    width: 50px; 
    height: 55px;
    flex-shrink: 0;
  }
  
  .logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  #search-form {
    margin-bottom: 0;
    padding-bottom: 0;
    display: flex;
    flex-wrap: nowrap;
    border: solid;
    border-width: var(--border-thickness);
    padding: 4px;
    border-color: var(--border-color-strong);
    border-radius: 1px;
    
    #search-term {
      font-size: 14px;
      border: none;
      outline: none;
      padding-left: 0.5ch;
      box-shadow: none;
    }
    
    select {
      font-size: 14px;
      border: none;
      border-right: solid;
      background: inherit;
      border-color: var(--border-color);
      outline: none;
      margin-left: 1ch;
    }
  }
 
}

#search-results  {
  background-color: #ffa;
  box-shadow: 3px 3px 3px #c0b742;
  border-color: #ffd34d;

  ul {
    display: flex;
    flex-wrap: wrap;

    li {
      width: 15vw;
      flex: 0 0 100%;
      margin: 0.5rem;
    }
  }


  @media (min-width: 320px) {
    ul li {
      flex: 0 0 calc(45% - 10px);
    }

  }

  @media (min-width: 940px) {
    ul li {
      flex: 0 0 calc(33.333% - 14px);
    }
  }
}

.grid {
  --grid-cells: 0;
  
  display: flex;
  gap: 1ch;
  width: calc(round(down, 100%, (1ch * var(--grid-cells)) - (1ch * var(--grid-cells) - 1)));
  max-width: inherit;
  padding-bottom: calc(0.5*var(--line-height));
  padding-top: calc(0.5*var(--line-height));

  button {
    height: fit-content;
  }

  .left-grid-column {
    text-align: right;
    padding-right: 0.5rem;
    > * {
      margin-bottom: 0.5rem;
    }
    /* flex-grow:1; TODO: this seems to mess up the user profile pic. Man i suck at css */
  }
  .right-grid-column {
    text-align: left;
    padding-left: 0.5rem;
    > * {
      margin-bottom: 0.5rem;
    }

    flex-grow:1;
  }

  .grid-user-profile-image img {
    width: 200px;
    height: 200px;
    aspect-ratio: 1/1;
    border: 2px solid var(--border-color-strong);
  }

  .user-blurb {
    padding-bottom: 1em;
    font-style: italic;
  }

  .user-trust-actions {
    padding-top: 1em;
  }


  .grid-user-info {
    max-width: 40%; /* Set this a bit smaller than half to there's still space between the section edges. Hacky. TODO*/
  }

  
}
.grid > *,
.grid > input {
  flex: 0 0 calc(round(down, (100% - (1ch * (var(--grid-cells) - 1))) / var(--grid-cells), 1ch));
}
.grid:has(> :last-child:nth-child(1)) { --grid-cells: 1; }
.grid:has(> :last-child:nth-child(2)) { --grid-cells: 2; }
.grid:has(> :last-child:nth-child(3)) { --grid-cells: 3; }
.grid:has(> :last-child:nth-child(4)) { --grid-cells: 4; }
.grid:has(> :last-child:nth-child(5)) { --grid-cells: 5; }
.grid:has(> :last-child:nth-child(6)) { --grid-cells: 6; }
.grid:has(> :last-child:nth-child(7)) { --grid-cells: 7; }
.grid:has(> :last-child:nth-child(8)) { --grid-cells: 8; }
.grid:has(> :last-child:nth-child(9)) { --grid-cells: 9; }


.title, .subtitle {
  text-align: center;
}

.subtitle-left {
  text-align: left;
}


.subtitle {
    margin-bottom: var(--line-height);
}

.user-free-text {
  width: 100%;
  white-space: pre-wrap;
  word-wrap: anywhere;

}

.form-component {

  .left-grid-column {
    max-width: 35%;
  }
  
  label:after {
    content: "\a";
    white-space: pre;
  }
  
}

.validation-error {
  color: red;
}

.validation-error:empty {
  margin: 0;
}
  
.form-submit-component {
  margin: auto;
}

.form-submit-response {
  text-align: center;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.general-form {
  display: flex;
  flex-direction: column;
  gap: 10px;

}

.edit-review-form,
.new-review-form {

  legend {
    background-color: black;
    color: white;
    padding: 3px 18px;
  }

  input {
    margin: 0.3rem;
  }
}

.user-trust-section {
  margin-top: 5%;

  .trust-list{  
    .trust-row{
      min-height: 2rem;
      padding: 0.5rem;
    }
  }
  
  li:nth-child(even) { 
    background-color: var(--background-color-weak);
  }
}


.user-trust-grid {
   display: grid;
   grid-template-columns: 2fr 1fr;
}

.trust-list,
.review-list {
  margin-top: 2rem;
  list-style-type: none;
}

.grid-user-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.inline-trust-chain, .user-trust-chain {
  /* padding: 0 0 0 1em; */
  display: flex;
  margin: 0;
  gap: 0.5em;

  ul.trusted-by {
    display: block;
    list-style: none;
    margin: 0;
    padding: 0;
  }

  ul.trusted-by li {
    display: inline;
  }

  ul.trusted-by li:not(:last-child)::after {
    content: ", ";
  }
}

.next-page-button {
  text-align: center;
}

.review-list {

  li:nth-child(even) { 
    background-color: var(--background-color-weak);
    /* background-image: radial-gradient( */
        /* circle at center, */
        /* var(--border-color) 2px, */
        /* transparent 0 */
      /* ), radial-gradient(circle at center, var(--border-color) 2px, transparent 0); */
    /* background-size: 8px 8px; */
    /* background-position: 0 0, 4px 4px; */
  
  }


  .review-row {
    display: flex;
    gap: 1em;
    padding: 15px;
    margin-bottom: 10px;

    .rating-icon {
      font-size: 32px;
    }

    .review-row-body {

      flex-grow: 1;

      .entity-address{
        font-style: italic;
      }

      .review-notes {
        margin-top: 1rem;
      }

      .review-row-title {

        display: flex;
        justify-content: space-between;
        font-style: italic;

        .reviewer,
        .entity-name {
          padding: 0 0 0 0;
          font-size: 1.1em;
        }

        .review-time {
          text-align: right;
        }
      }

      .review-row-actions {
        padding-top: 1ch;
      }

    }
  }
}


.review-image-grid {

  display: grid;
  gap: 10px;
  margin-top: 1em;
  margin-bottom: 1em;
  width: 100%;
  
  @media (min-width: 320px) {
    grid-template-columns: repeat(2, 1fr);
  }

  @media (min-width: 640px) {
    grid-template-columns: repeat(4, 1fr);
  }
}


.review-image-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 1 / 1;
  display: block;
  border: 2px solid var(--border-color-strong);
}

.image-upload-part {

  #imageInput {
    display: none;
  }

  #selectBtn {
    margin-bottom: 5px;
    cursor: pointer;
  }

  #selectBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  .preview-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 10px;
    margin-bottom: 10px;
  }

  .preview-item {
    position: relative;
    aspect-ratio: 1;
  }

  .preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 2px solid var(--border-color-strong);
  }

  .remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: white;
    border: 1px solid #ccc;
    cursor: pointer;
    padding: 2px 8px;
  }

}

.notification:not(:empty) {
  border: solid var(--border-color);
  border-radius: 2px;
  padding: 1rem;
  background-color: var(--background-color-weak);
}
