/* ──────────────────────────────── Global Layout ──────────────────────────────── */
* {
  box-sizing: border-box;
  overscroll-behavior: none !important;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
}

:root {
  --theme-color: #318dff;
  --theme-color-dark: #318dff;
  --theme-font-color: #fff;
  --theme-font-color-dark: #fff;
  --bgcolor: #2a2a2a;
  --input: #3c3c3c;
  --fontColor: #fff;
  --evenRow: #3c3c3c;
  --oddRow: #2a2a2a;
  --height: 0px;
  --width: 0px;
  --innerHeight: 0px;
  --innerWidth: 0px;
  --iOSPadding: 60px;
  --text-shadow: 1px 1px 3px rgb(0 0 0 / 75%);
  --form: #333;
  --dialog: #333;
  --dialog-header: #2a2a2a;
  --dialog-info: #444;
  --dialog-vertical: #222;
  --scrollbar: #555 #333;
  --setting-panel: #333;
  --border: 1px solid #3a3a3a;
  --font: 'Poppins', sans-serif;
  --complimentary: #000;
}

body {
  font-family: Arial, sans-serif;
  font-family: var(--font);
  background-color: var(--bgcolor);
  color: var(--fontColor);
  margin: 0;
  height: 100%;
  padding: 0;
  overflow: hidden;
  scrollbar-color: var(--scrollbar);
  visibility: hidden;
  /* padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); */
}

.page-content {
  margin: auto;
  padding: 0 20px;
  overflow: auto;
  height: calc(var(--height) - var(--iOSPadding) - 60px);
}

.setting-tabcontent {
  display: flex;
  flex-wrap: wrap;
  flex-direction: column;
  align-items: flex-start;
  max-width: 500px;
  padding: 0;
  border-radius: 12px;
  background: none;
  gap: 20px;
}

h1 {
  text-align: center;
  align-self: center;
}

.setting-module>h1 {
  margin: 0 0 15px;
}

#page2,
#page3 {
  display: none;
}

#page2 {
  max-width: 100%;
}

#page3 {
  padding-top: 20px;
}

.hide {
  display: none;
}

::-webkit-scrollbar-corner {
  background: none;
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* ──────────────────────────────── Form Elements ──────────────────────────────── */
.form-group {
  margin-bottom: 15px;
}

input,
select,
textarea {
  background-color: var(--input);
  color: var(--fontColor);
  border: 1px solid #777;
  width: 100%;
  padding: 10px 0;
  font-size: 1rem;
  border-radius: 8px;
  text-indent: 15px;
}

textarea:focus {
  height: 300px
}

label {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 5px;
  text-align: center;
}

label span {
  background-color: #dc3545;
  color: #fff;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-right: 15px;
  font-size: 14px;
  font-weight: bold;
  text-shadow: var(--text-shadow);
}

input#history_search {
  border-radius: 32px;
  text-align: center;
  max-width: 100%;
  transition: max-width 0.3s ease;
}

#history_search::placeholder {
  opacity: 0.5;
  color: var(--fontColor);
  font-style: italic;
}

.extension {
  font-style: italic;
}

input[type="color"] {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid #222;
  width: 32px;
  padding: 0;
  margin: 3px;
  height: 32px;
  cursor: pointer;
  border-radius: 50%;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: none;
}

#frmCSVImport {
  width: 100%;
}

/* ──────────────────────────────── Buttons ──────────────────────────────── */
.btn {
  background: var(--theme-color);
  color: var(--theme-font-color);
  border: none;
  cursor: pointer;
  border-radius: 5px;
  display: inline-block;
  padding: 10px 15px;
  margin-top: 12px;
  text-decoration: none;
  width: 100%;
  font-size: 1rem;
  border-radius: 8px;
  /* text-shadow: var(--text-shadow); */
}

.btn:hover {
  background: var(--theme-color-dark);
}

.download-btn {
  background: #777;
  width: 50%;
}

/* ──────────────────────────────── Table Styling ──────────────────────────────── */

#table_target {
  background: var(--bgcolor);
  overflow: hidden;
  height: auto;
  border-radius: 12px;
  border: 1px solid #111;
  border: 1px solid #222;
  transition: max-height 0.3s ease;
}

table {
  width: 100%;
  font-size: 1rem;
  border-collapse: collapse;
  background-color: var(--input);
  color: var(--fontColor);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
  overflow: auto;
  display: table;
}

table::-webkit-scrollbar {
  display: none;
}

table th,
table td {
  padding: 5px 10px;
  text-align: center;
  border: 1px solid #111;
}

table th {
  color: var(--theme-font-color);
  background: var(--theme-color);
  background-clip: padding-box
}

table tr:hover {
  background-color: var(--theme-color);
  color: var(--theme-font-color);
}

tr:first-child td,
tr:first-child th {
  border-top: 0;
}

tr td:first-child,
tr th:first-child {
  border-left: 0;
}

tr td:last-child,
tr th:last-child {
  border-right: 0;
  border-left: 0;
}

table tr:last-of-type td {
  border-bottom: 0;
}

.full-table {
  display: block;
  width: 100%;
  max-height: calc(var(--height) - var(--iOSPadding) - 160px);
  border: 0;
  border-radius: 10px;
  overflow: overlay;
}

td.red {
  color: #fff;
  background: rgba(255, 0, 0, 0.9);
}

tr:nth-child(even) {
  background-color: var(--evenRow);
}

tr:nth-child(odd) {
  background-color: var(--oddRow);
}

#history-table thead {
  position: sticky;
  top: 0;
  cursor: pointer;
}

/* ──────────────────────────────── Images ──────────────────────────────── */
img {
  display: block;
  margin: 10px auto;
  border-radius: 8px;
  max-width: 100%;
  aspect-ratio: 1/1;
  width: 512px;
}

img#nothere {
  display: block;
  margin: 100px auto 60px;
  border-radius: 12px;
  max-width: 100%;
  aspect-ratio: unset;
  width: unset;
  background: var(--theme-color);
}


/* ──────────────────────────────── Navigation Bar ──────────────────────────────── */

.navbar {
  position: sticky;
  display: flex;
  top: 0;
  height: calc(60px + var(--iOSPadding));
  overflow: hidden;
  background-color: var(--theme-color);
  color: var(--theme-font-color);
  justify-content: flex-start;
  flex-direction: row;
  align-items: flex-end;
  z-index: 1;
}

.navbar a {
  position: relative;
  display: block;
  bottom: 0;
  color: var(--theme-font-color);
  text-align: center;
  padding: 12px 20px;
  text-decoration: none;
  font-size: 17px;
  margin-left: 8px;
  border-radius: 6px 6px 0 0;
  background: rgb(0 0 0 / 15%);
}

.navbar a:hover {
  background-color: #ddd;
  border-radius: 6px 6px 0 0;
  color: black;
  cursor: pointer;
}

.navbar a.active {
  background-color: var(--bgcolor);
  color: var(--fontColor);
  text-shadow: var(--text-shadow);
  border-radius: 6px 6px 0 0;
}

.navbar .icon {
  display: none;
}

#eye,
#help {
  background: var(--theme-font-color);
  mask-image: url(../assets/ui/eye.svg);
  width: 30px;
  height: 30px;
}

#help {
  width: 30px;
  height: 30px;
}

#help:hover,
#help:focus {
  background: #dc3545;
  color: #000;
}

#eye.active {
  background: var(--complimentary);
}

#navbar-menu {
  display: none;
  flex-direction: column;
  height: 0;
  background: #555;
  transition: height .3s allow-discrete;
  position: relative;
  z-index: 1
}

#navbar-menu.show {
  display: flex;
  height: 120px;
  transition: all .3s allow-discrete;
}

#navbar-menu button {
  height: 100%;
  border: none;
  color: var(--fontColor);
  border: 1px solid #333;
  background: var(--input);
  cursor: pointer;
}

#current-page {
  display: flex;
  background-color: #dc3545;
  height: 50px;
  width: auto;
  color: var(--fontColor);
  text-shadow: var(--text-shadow);
  padding: 0 15px;
  align-items: center;
  justify-content: center;
  border-top-right-radius: 5px;
}

#help-pop {
  position: absolute;
  top: calc(100% * (-0.5));
  border-radius: 10px;
  border: 1px solid #555;
  box-shadow: 1px 2px 3px rgba(0, 0, 0, 0.25);
  background: #222;
  color: var(--fontColor);
  text-align: center;
  text-shadow: var(--text-shadow);
  opacity: .95;
  max-width: 75%;
}

#help-pop hr {
  color: #dc3545
}

/* ──────────────────────────────── Modals ──────────────────────────────── */

dialog {
  position: relative;
  width: 85%;
  max-width: 900px;
  padding: 0;
  border-radius: 10px;
  text-align: center;
  border: none;
  box-shadow: 0px 0px 5px 2px rgb(0 0 0 / 20%);
  flex-direction: column;
  justify-content: center;
  align-content: center;
  align-items: center;
  transform: translate3d(0, 0, 0);
  font-family: var(--font);
  transition: margin-top 0.3s linear, height 0.3s linear, max-width 0.3s linear;
  background: var(--form);
  margin: auto;
  outline: none;
}

#history_pop,
#history_edit {
  display: none;
  top: var(--iOSPadding);
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: 0;
  z-index: -1;
  border: none;
  outline: none;
  overflow: hidden;
}

#history_edit {
  max-width: 600px;
}

#edit_form {
  position: relative;
  padding: 20px;
  width: 100%;
  overflow: auto;
  max-height: calc(var(--height) - 210px);
  outline: none;
  color: var(--fontColor);
}

#history_pop_title_bar,
#edit_title {
  display: flex;
  position: sticky;
  justify-content: space-between;
  align-items: center;
  top: 0;
  width: 100%;
  height: 70px;
  font-size: 1.25rem;
  background: #2a2a2a;
  color: #fff;
}

#history_pop.light>#history_pop_title_bar,
#history_edit.light>#edit_title {
  background: var(--theme-color);
  color: var(--theme-font-color);
}

.title_button,
.nav_button {
  display: flex;
  position: relative;
  right: 10px;
  text-indent: 5px;
  width: auto;
  color: #fff;
  height: 32px;
  gap: 0 6px;
  padding: 0 6px;
  font-weight: bold;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: flex-start;
  background: #444;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  z-index: 2;
}

.nav_button {
  position: fixed;
  top: calc(var(--iOSPadding) + 20px);
  justify-self: end;
  background: var(--theme-color-dark);

}

#history_pop.light>div>.title_button,
#history_edit.light>div>.title_button {
  color: var(--theme-font-color-dark);
  background: var(--theme-color-dark);
}

.title_button:nth-of-type(1) {
  background: transparent;
  left: 10px;
}

#history_container {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

#history_pop section {
  display: flex;
  align-content: center;
  align-items: center;
  justify-content: flex-start;
  padding: 10px;
  width: 100%;
  height: auto;
  max-height: 540px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  color: var(--fontColor);

}

#custom_images {
  flex-direction: row;
  gap: 20px;
}

#history_pop section#info-block {
  align-items: flex-start;
  flex-direction: column;
  background: var(--dialog-info);
}

#history_pop section img {
  display: block;
  border-radius: 12px;
  max-width: 65%;
  aspect-ratio: unset;
  border: 1px solid #222;
}

#info-block h1 {
  display: block;
  align-self: center;
  color: var(--fontColor);
  text-underline-offset: 4px;
  text-shadow: var(--text-shadow);
  margin: 0;
}

#info-block ul {
  list-style: none;
  text-align: left;
  margin-left: -12px
}

#info-block ul li {
  text-indent: 12px;
  padding: 5px 0;
}

#info-block ul li strong {
  color: var(--theme-color)
}

li::before {
  content: "";
  position: relative;
  background: var(--fontColor);
  margin-right: 8px;
  display: inline-block;
  width: 10px;
  border-radius: 50%;
  border: 0;
  height: 10px;
  margin-left: -2rem;
}

#close_properties,
#edit_row,
#close_edit {
  height: 16px;
  width: 16px;
  background: #fff;
}

#history_pop.light>div>button>#close_properties,
#history_pop.light>div>button>#edit_row,
#history_edit.light>div>button>#close_edit {
  background: var(--theme-font-color-dark);
  color: var(--theme-font-color-dark);
}

#close_properties,
#close_edit {
  transform: rotate(0deg);
  transition: transform 0.3s ease;
  mask-image: url(../assets/ui/cross.svg);
  -webkit-mask-image: url(../assets/ui/cross.svg);
}

#edit_row {
  mask-image: url(../assets/ui/pencil.svg);
  -webkit-mask-image: url(../assets/ui/pencil.svg);
}

#info-display {
  /* padding: 16px; */
  mask-image: url(../assets/ui/help.svg);
  -webkit-mask-image: url(../assets/ui/help.svg);
}

#info-share {
  mask-image: url(../assets/ui/share.svg);
  -webkit-mask-image: url(../assets/ui/share.svg);
}

#cs_properties img {
  width: 100%;
  filter: none;
  aspect-ratio: auto;
  border: var(--border);
  border-radius: 20px;
  margin: auto 30px;
  box-shadow: 0px 0px 10px 0px rgb(0 0 0 /10%);
  display: inline-block;
  scroll-snap-align: start;
}


.svg {
  mask-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;
  mask-size: contain;
  -webkit-mask-size: contain;
  cursor: pointer;
}

.search-container {
  display: flex;
  position: relative;
  flex-direction: column;
  align-items: center;
}

.search-glass {
  position: absolute;
  display: block;
  align-self: baseline;
  left: 20px;
  top: 12px;
  height: 18px;
  width: 18px;
  background: var(--fontColor);
  mask-image: url(../assets/ui/search.svg);
  -webkit-mask-image: url(../assets/ui/search.svg);
}

.status {
  background: var(--fontColor);
  width: 16px;
  height: 16px;
  margin-bottom: -16px;
  position: relative;
  mask-image: url(../assets/ui/unlock.png);
  -webkit-mask-image: url(../assets/ui/unlock.png);
}

.locked {
  mask-image: url(../assets/ui/lock.png);
  -webkit-mask-image: url(../assets/ui/lock.png);
}

dialog[open] {
  animation: animatezoom .3s ease forwards;
}


dialog::backdrop {
  background: rgb(0 0 0 / 50%);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: open 0.3s ease forwards;
  height: 100%;
}

#fileToUpload,
#image_path,
#edit_image_path,
#multiImgForm,
#filesToEdit {
  display: none;
}

/* ──────────────────────────────── Switches ──────────────────────────────── */

.setting-module {
  display: flex;
  width: 100%;
  flex-direction: column;
  align-items: flex-end;
  padding: 10px 20px 20px;
  border-radius: 12px;
  background: var(--setting-panel);
  /* box-shadow: 1px 2px 3px rgb(0 0 0 / 15%); */
  box-shadow: 0px 5px 20px rgb(0 0 0 / 15%);
  border: var(--border);
}

h4 {
  display: flex;
  align-items: center;
  margin: 5px 0;
  width: 100%;
  font-size: 1rem;
  font-weight: normal;
  text-shadow: none;
  padding: 2px 0;
  justify-content: space-between;
}

.toggle-switch {
  position: relative;
  display: flex;
  align-items: flex-start;
  width: 48px;
  height: 24px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--dialog-vertical);
  border: none;
  border-radius: 15px;
  cursor: pointer;
  font-family: inherit;
  transition: 0.4s;
  padding: 0;
  /* box-shadow: 1px 2px 3px rgb(0 0 0 /10%); */
}

.toggle-switch:hover {
  background: var(--theme-color);
}

.toggle-switch:checked {
  background: var(--theme-color-dark);
}

.toggle-switch::before {
  content: '';
  position: absolute;
  transform: translate(2px, 2px);
  width: 20px;
  height: 20px;
  background: var(--bgcolor);
  border-radius: 50%;
  transition: 0.4s;
}

.toggle-switch:checked::before {
  transform: translate(26px, 2px);
  background: var(--theme-color);
}

.toggle-switch:checked::before {
  background: var(--theme-color);
}


/* ──────────────────────────────── Animations ──────────────────────────────── */

@keyframes animatezoom {
  from {
    transform: scale(0);
  }

  to {
    transform: scale(1);
  }
}

@keyframes open {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@media screen and (max-width: 600px) {
  .navbar.responsive .icon {
    position: absolute;
    right: 0;
    top: 0;
  }

  .navbar.responsive a {
    float: none;
    display: block;
    text-align: left;
  }

  #history_pop section#info-block {
    width: calc(100% - 20px);
    border-radius: 10px;
    background: var(--dialog-vertical);
  }

  #history_pop section#custom_images {
    border-radius: 10px;
    background: var(--dialog-vertical);
    margin-top: 8px;
    width: calc(100% - 20px);
  }

  #custom-images {
    flex-direction: row;
    gap: 0 20px;
    margin: auto;
  }

  #history_container {
    padding: 10px 0;
  }
}

@media screen and (min-width: 600px) {
  #magazine-form {
    max-width: 800px;
    margin: auto;
    padding: 20px;
    height: auto;
    background: var(--form);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #777;
  }

  #current-page {
    display: none;
  }

  #help {
    padding: 20px;
    top: calc(var(--iOSPadding) + 15px);
    width: 30px;
    height: 30px;
  }

  #eye {
    top: calc(var(--iOSPadding) + 15px);
    width: 30px;
    height: 30px;
  }

  #help-pop {
    max-width: 35%;
  }

  #history_container {
    flex-direction: row;
    align-items: normal;
  }

  #custom_images {
    flex-direction: column;
  }

  .search-container {
    position: absolute;
    top: calc(10px + var(--iOSPadding));
    right: 25px;
    z-index: 1;
    max-width: 250px;
    border: 0;
  }

  input#history_search {
    border: none;
  }

  .full-table {
    max-height: calc(var(--height) - 100px);
  }

  #history_search:focus,
  #history_search:hover {
    outline: none;
  }

  :root {
    --iOSPadding: 10px;
  }

  .setting-tabcontent {
    flex-direction: row;
    min-width: 100%;
  }

  .setting-module {
    max-width: calc(var(--innerWidth) / 2 - 30px);
  }
}

@media screen and (min-width: 680px) {
  input#history_search {
    max-width: 350px;
  }
}


@media screen and (max-height: 500px) {
  #help-pop {
    max-width: 50%;
    top: 0;
  }
}


@font-face {
  font-family: 'Poppins';
  src: url(../fonts/Poppins.woff);
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  font-kerning: normal;
}

@supports not (-webkit-touch-callout: none) {
  :root {
    --iOSPadding: 0px;
  }
}

@supports (-webkit-touch-callout: none) {
  * {
    --font: ui-sans-serif !important;
  }
}