@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
  --primary-color: #044c8d;
  --primary-color-dark: #005a92;
  --error-color: #ff3d57;
  --success-color: #00b894;
  --warning-color: #f1c40f;
  --info-color: #3498db;
  --secondary-color: #ffffff;
  --secondary-color-light: #f5f5f5;
  --accent-color: #f5f5f5;
  --error-color: #ff3d57;
  --red: #e63241;
  --orange: #f3711a;
  --blue: #2c83cf;
  --green: #0ccf2d;
  --color-grey: #cccccc;
  --color-green: #4296f4;
  --box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);
  --box-shadow-minimal: 0 0px 1px 1px #45454517;

  --button-width: 3.5em;
  --button-height: 2em;
  --toggle-diameter: 1.5em;
  --button-toggle-offset: calc(
    (var(--button-height) - var(--toggle-diameter)) / 2
  );
  --toggle-shadow-offset: 10px;
  --toggle-wider: 3em;
}

@layer components {
  .main-container {
    @apply max-w-screen-sm mx-auto;
  }

  ::-webkit-scrollbar {
    width: 0.25rem;
    height: 0.5rem;
  }

  ::-webkit-scrollbar-thumb {
    background: #1e1e24;
  }

  ::-webkit-scrollbar-thumb {
    background: #0f5ad7;
    border-radius: 8px;
  }

  ::-webkit-scrollbar-track {
    background: #d7d7d7; /* Cor do fundo da área de rolagem */
    border-radius: 8px;
  }

  .w-calc-100vw-16 {
    width: calc(100vw - 16px);
  }

  .rounded-b-custom {
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
  }

  .btn-header {
    @apply bg-transparent text-white w-10 h-10 text-xl mr-4 flex items-center justify-center rounded transition duration-300;
  }

  .btn-header:hover {
    @apply bg-[#7c94e277] border-secundary;
  }

  #notifications.active {
    @apply flex flex-col items-center rounded-md border border-gray-800 bg-gray-900 shadow-lg overflow-hidden fixed left-0 top-0 z-10 w-calc-100vw-16 max-w-[28rem] min-h-[22.5rem];
  }

  .menu-admin-item {
    @apply flex items-center gap-4 w-full h-14 p-6 transition text-white duration-300;
  }

  .menu-admin-item:hover {
    @apply bg-secundary;
  }

  .status-success {
    @apply text-green-500 font-bold text-sm;
  }

  .status-warning {
    @apply text-yellow-500 font-bold text-sm;
  }

  .status-pending {
    @apply text-red-500 font-bold text-sm;
  }

  .modal {
    @apply hidden fixed inset-0 bg-black bg-opacity-60 backdrop-blur-[6px];
  }

  .custom-select-wrapper {
    @apply relative inline-block w-full;
  }

  .custom-select {
    @apply relative flex items-center justify-between cursor-pointer border border-[#ffffff33] rounded bg-transparent w-[200px] text-white hover:bg-white/10 md:w-[280px];
  }

  #currentCompany-select.disabled {
    @apply pointer-events-none cursor-not-allowed opacity-70;
  }

  .custom-select-trigger {
    @apply flex items-center justify-between gap-2 p-2 w-full whitespace-nowrap overflow-hidden overflow-ellipsis;
  }

  .custom-option {
    @apply flex items-center justify-start p-2 cursor-pointer;
  }

  .custom-options {
    @apply hidden absolute w-full top-full left-0 right-0 z-50 border border-t-0 rounded-s-sm bg-white shadow-md max-h-[200px] overflow-y-auto text-gray-900;
  }

  .custom-select.open .custom-options {
    @apply block;
  }

  .custom-option.search-option {
    @apply p-2 bg-[#F4F4F4] sticky top-0 z-50;
  }

  .custom-option.search-option input {
    @apply p-2 rounded-sm w-full border;
  }

  #menu-mobile.active {
    @apply block fixed top-0 left-0 translate-x-[17px] translate-y-[84px] min-w-max will-change-transform z-10;
  }

  .remove-file-button {
    @apply bg-red-500 p-2 rounded-lg w-10 h-10 text-white hover:bg-red-900;
  }

  #menu-admin.active {
    display: block;
    position: fixed;
    left: 0px;
    top: 0px;
    transform: translate(17px, 84px);
    min-width: max-content;
    will-change: transform;
    z-index: 10;
  }

  .sidebar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0.75rem;
    padding-top: 1.5rem;
    padding-bottom: 4rem;
    transition: all 0.3s;
    width: 216px;
    background-color: #0a1a2e;
  }

  .sidebar.active {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0.75rem;
    padding-top: 1.5rem;
    padding-bottom: 4rem;
    width: 76px;
    background-color: #0a1a2e;
  }

  .sidebar.active a span,
  .sidebar.active .help a span {
    position: absolute;
    left: 70px;
    top: 50%;
    transform: translateY(-50%);
    padding: 10px;
    border-radius: 4px;
    color: #fff;
    background-color: #000;
    visibility: hidden;
    transition: all 0.3s;
  }

  .sidebar.active a:hover span,
  .sidebar.active .help a:hover span {
    left: 50px;
    opacity: 1;
    visibility: visible;
  }

  .input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .input-wrapper input,
  .input-wrapper select {
    display: block;
    width: 100%;
    border-radius: 2px;
    border: 1px solid #d1d5db;
    padding: 10px;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: var(--secundary-color);
    font-weight: 500;
  }

  .input-wrapper input:focus {
    outline: 2px solid #93c5fd;
  }

  .custom-select-trigger .arrow {
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #333;
    margin-left: 10px;
  }

  .custom-select-trigger .arrow.loading {
    border: none;
    position: relative; /* Necessário para posicionar o loader */
    padding-right: 2.5rem !important; /* Deixa espaço para o loader à direita do texto */
    cursor: not-allowed;
    pointer-events: none;
  }

  .custom-select-trigger .arrow.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid var(--text-light-color); /* Cor clara */
    border-top: 2px solid var(--secundary-color); /* Cor do topo, para efeito de giro */
    border-radius: 50%;
    animation: spin 1s linear infinite; /* Animação de rotação */
  }

  .custom-select-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
  }

  .custom-select-wrapper.disabled {
    cursor: not-allowed;
    opacity: 0.7;
    pointer-events: none;
  }

  .custom-option input[type="checkbox"] {
    margin-right: 10px;
    max-width: 16px;
    max-height: 16px;
  }

  .custom-option:hover {
    background: #f4f4f4;
  }

  button.loading {
    position: relative; /* Necessário para posicionar o loader */
    padding-right: 2.5rem !important; /* Deixa espaço para o loader à direita do texto */
    cursor: not-allowed;
    pointer-events: none;
  }

  /* Bolinha */
  button.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #ccc; /* Cor clara */
    border-top: 2px solid #0f5ad7; /* Cor do topo, para efeito de giro */
    border-radius: 50%;
    animation: spin 1s linear infinite; /* Animação de rotação */
  }
  .switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
    align-self: center;
  }

  .switch input {
    opacity: 0;
    width: 0;
    height: 0;
  }

  .switch input:disabled + .slider {
    cursor: not-allowed;
  }

  .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: 0.4s;
    transition: 0.4s;
  }

  .slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    -webkit-transition: 0.4s;
    transition: 0.4s;
  }

  input:checked + .slider {
    background-color: #2196f3;
  }

  input:focus + .slider {
    box-shadow: 0 0 1px #2196f3;
  }

  input:checked + .slider:before {
    -webkit-transform: translateX(26px);
    -ms-transform: translateX(26px);
    transform: translateX(26px);
  }

  .slider.round {
    border-radius: 34px;
  }

  .slider.round:before {
    border-radius: 50%;
  }
}

select {
  display: block;
  width: 100%;
  border-radius: 2px;
  border: 1px solid #d1d5db;
  padding: 10px;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--secundary-color);
  font-weight: 500;
}

.form-perfil fieldset + fieldset {
  margin-top: 3rem;
}

.form-perfil .label {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: 16px;
  pointer-events: none;
  color: #57534e;
  transition: all 0.2s ease-in-out;
}

.form-perfil input {
  transition: all 0.2s ease-in-out;
}

.form-perfil input:hover,
.form-perfil input:focus,
.form-perfil input:not(:placeholder-shown),
.form-perfil textarea:hover,
.form-perfil textarea:focus,
.form-perfil textarea:not(:placeholder-shown) {
  border-color: #0f5ad7;
}

.form-perfil input::placeholder,
.form-perfil textarea::placeholder {
  opacity: 0;
  color: rgba(0, 0, 0, 0.5);
}

.form-perfil input:focus::placeholder,
.form-perfil textarea:focus::placeholder {
  opacity: 1;
}

.form-perfil input:focus + .label,
.form-perfil input:not(:placeholder-shown) + .label,
.form-perfil select + .label-select {
  top: -40%;
  transform: translateY(50%);
  left: 8px;
  font-size: 12px;
  padding: 0 8px;
  background-color: white;
}

.form-perfil textarea:focus + .label,
.form-perfil textarea:not(:placeholder-shown) + .label {
  top: -10%;
  transform: translateY(50%);
  left: 8px;
  font-size: 12px;
  padding: 0 8px;
  background-color: white;
}

.register-container {
  position: relative;
}

.register-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background-color: var(--primary-color);
  position: relative;
  box-sizing: border-box;
}

.form-row {
  display: flex;
  flex-direction: row;
  margin-bottom: 20px;
  gap: 3%;
}

.form-group {
  position: relative;
  margin-bottom: 20px;
  flex: 1;
}

.input-container {
  position: relative;
}

.input-icon {
  position: absolute;
  top: 50%;
  left: 10px;
  transform: translateY(-50%);
  color: #aaa;
}

.register-container {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #fafafa;
  height: 100vh;
  width: 100%;
  padding: 20px;
}

.register-container .wrapper {
  width: 100%;
  max-width: 650px;
  border-radius: 2px;
  background-color: var(--white-color);
  padding: 32px;
  box-shadow:
    rgba(0, 0, 0, 0.05) 0px 6px 24px 0px,
    rgba(0, 0, 0, 0.08) 0px 0px 0px 1px;
}

.register-container .wrapper .title {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 28px;
  margin-bottom: 48px;
}

.register-container .wrapper .title h1 {
  font-size: 1.875rem;
  font-weight: bold;
  text-align: center;
}

.checkbox-wrapper input[type="checkbox"] {
  width: auto;
}

.sapi-blue-button {
  @apply bg-transparent inline-flex items-center justify-center gap-2 h-9 font-medium text-sm px-3 border border-secundary text-secundary rounded-md transition-all duration-300 hover:text-white hover:bg-secundary;
}

.blue-button {
  @apply text-white px-4 py-3 rounded border transition-colors duration-300;
  background-color: var(--primary-color-dark);
  border-color: var(--primary-color-dark);
}

.blue-button:hover {
  @apply bg-transparent;
  color: var(--primary-color-dark);
  border-color: var(--primary-color-dark);
}

input {
  width: 100%;
  padding: 15px 10px 15px 40px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
}

.textarea-wrapper {
  display: flex;
  flex-direction: column;
}

.textarea-wrapper textarea {
  border: 1px solid #ccc;
  padding: 12px;
}

input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0px 1000px white inset !important;
  -webkit-text-fill-color: #333 !important;
}
