@import url('./root.css');

* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  list-style: none;
  text-decoration: none;
  font-family: "Inter", sans-serif;
  color: var(--text-color);
}

/* Labels */
label {
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
  color: var(--text-color);
  font-size: 18px;
}

/* -- Icons -- */
.icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  display: inline-block;
}

/* -- Inputs -- */
input[type="email"],
input[type="text"],
input[type="number"],
input[type="date"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 3px;
  background-color: var(--white);
  font-size: 14px;
  color: var(--text-color);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="email"]:hover,
input[type="text"]:hover,
input[type="number"]:hover,
input[type="date"]:hover,
input[type="password"]:hover,
textarea:hover,
select:hover {
  box-shadow: 0 0 0 1px rgba(165, 166, 167, 0.3);
}

input[type="email"]:focus,
input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--btn-color);
  box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.3);
}

/* -- Butons -- */
button[type="submit"] {
  width: 100%;
  padding: 10px 0;
  background-color: var(--btn-color);
  border: none;
  color: white;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  border-radius: 2px;
  transition: background-color 0.2s;
}

button[type="submit"]:hover {
  background-color: #3A7DCE;
}

input[type="date"]:disabled {
  background-color: #f3f4f6;
  color: #b0b0b0;
  border: 1px solid #e5e7eb;
  opacity: 1;
  /* Garante que o ícone não suma */
  cursor: not-allowed;
}

/* Para garantir que o ícone do calendário apareça no Chrome */
input[type="date"]:disabled::-webkit-calendar-picker-indicator {
  opacity: 1;
  filter: grayscale(1);
  cursor: not-allowed;
}

.btn-outline {
  border: 1px solid #ccc;
  background: transparent;
  padding: 0.5rem 1rem;
  cursor: pointer;
}

.btn-primary,
button.btn-primary {
  background-color: #2f80ed;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-weight: 600;
  border-radius: 2px;

  &:hover {
    background-color: #0056b3;
  }
}

.btn-ssucess,
button.btn-ssucess {
  background-color: var(--btn-ssucess-color);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-weight: 600;
  border-radius: 2px;

  &:hover {
    background-color: var(--btn-ssucess-hover-color);
  }
}

#modal-close {
  border: none;
  padding: 5px;
  cursor: pointer;
  background-color: var(--white);
}

/* -- Link “Esqueci minha senha” -- */
.forgot-password {
  display: block;
  margin-top: 12px;
  text-align: center;
  font-size: 14px;
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.2s;

  &:hover {
    color: var(--btn-hover-color);
  }
}

/* -- Menssages Error -- */
.alert-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
}

.alert-message {
  padding: 1rem 1.5rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  font-size: 14px;
  position: relative;
  overflow: visible;
  /* Permite que a barra apareça fora do conteúdo */
  min-width: 300px;
  max-width: 400px;
  min-height: 50px;
}

/* Barra de tempo do alerta */
.alert-timer-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 4px;
  background-color: var(--btn-color);
  /* Use a cor do seu projeto */
  width: 100%;
  border-radius: 0 0 4px 4px;
  animation: timerBar 4s linear forwards;
  /* Ajuste o tempo se quiser */
  z-index: 2;
}

/* Mensagem de sucesso */
.alert-message.success {
  background-color: #e6f9f0;
  color: #15803d;
  border: 1px solid #10b981;
}

/* Erros nos forms*/
/* Erros nos forms */
.error {
  color: #dc2626;
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 4px;
  font-size: 0.95rem;
  margin-top: 0.4rem;
  padding: 6px 12px;
  display: block;
  font-weight: 500;
  line-height: 1.4;
}

/* Mensagem de erro */
.alert-message.error,
.alert-message.danger {
  /* Django pode usar 'error' ou 'danger' */
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* Mensagem de aviso */
.alert-message.warning {
  background-color: #fffbe6;
  color: #b45309;
  border: 1px solid #f59e0b;
}

/* Mensagem de informação */
.alert-message.info {
  background-color: #e7f3fe;
  color: #2563eb;
  border: 1px solid #3b82f6;
}

@keyframes timerBar {
  from {
    width: 100%;
  }

  to {
    width: 0%;
  }
}

/* -- Tables -- */
table {
  color: var(--text-color);
  width: 100%;
  font-size: 1.2em;
  min-width: 400px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.15);
  background-color: var(--background-color);
  max-width: 1315px;

  .actions-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 100%;
    min-height: 40px;
    /* ajuste conforme necessário */
  }

  th,
  td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
  }

  th {
    font-weight: 600;
    background-color: var(--th-color);
  }

  tr:last-child td {
    border-bottom: none;
  }

  th:last-child,
  td:last-child {
    text-align: center !important;
  }

  td {

    .edit-user-btn,
    .delete-user-btn {
      background: none;
      border: none;
      padding: 0 6px;
      cursor: pointer;
      vertical-align: middle;
      transition: background 0.2s;
      border-radius: 4px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }

    .edit-user-btn:hover {
      background: #e0f2fe;
    }

    .delete-user-btn:hover {
      background: #fee2e2;
    }

    .edit-user-btn img,
    .delete-user-btn img {
      width: 20px;
      height: 20px;
      display: inline-block;
      vertical-align: middle;
      pointer-events: none;
    }
  }

  tbody .actions-dropdown,
  tbody .dropdown-menu {
    display: none !important;
  }
}

/* -- Container -- */
.container {
  display: flex;
  min-height: 100vh;
  background-color: var(--bg-color);
}


/* -- Sidebar -- */
.sidebar {
  min-width: 100px;
  width: 100px;
  height: 100%;
  background-color: var(--white);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  transition: width 0.3s ease;
  overflow: hidden;
  position: fixed;
  z-index: 1000;

  .logo-full,
  .sidebar-menu ul>li .sidebar a span,
  .logout-btn span {
    display: none;
  }

  .logo-full {
    height: 28px;
  }

  .logo-mini {
    display: block;
    height: 28px;
  }

  .sidebar-header {
    margin-top: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    margin-bottom: 1rem;
    background-color: var(--white);
  }

  .sidebar-menu,
  .sidebar-menu ul,
  .sidebar-menu ul>li {
    background-color: var(--white);

    a span {
      display: none;
    }
  }

  .sidebar-menu,
  .sidebar-footer {
    background-color: var(--white);

    ul {
      list-style: none;
      padding: 0;
      margin: 0;
    }

    ul {
      background-color: var(--white);
    }

    li {
      display: block;
      background-color: var(--white);
    }

    a span {
      display: none;
    }

    form {
      background-color: var(--white);
    }

    a,
    .logout-btn {
      display: flex;
      align-items: center;
      gap: 0.75rem;
      padding: 0.75rem 1.5rem;
      margin: 1rem 1rem;
      text-decoration: none;
      color: var(--text-color);
      font-size: 15px;
      width: 100%;
      background: none;
      border: none;
      transition: background-color 0.2s ease;

      &:hover {
        background-color: var(--sidebar-hover);
        color: var(--btn-color);

        img.icon {
          background-color: transparent;
          filter: brightness(0) saturate(100%) invert(24%) sepia(94%) saturate(7496%) hue-rotate(209deg) brightness(92%) contrast(101%);
        }

        svg path {
          stroke: var(--btn-color);
        }

        span {
          background-color: var(--sidebar-hover);
        }
      }
    }
  }

  .active a {
    background-color: var(--header-tabs-color);
    color: var(--btn-color);
    border-radius: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: calc(100% - 2rem);
    box-sizing: border-box;

    display: flex;
    align-items: center;
    gap: 0.75rem;

    span {
      background-color: transparent !important;
      color: var(--btn-color);
    }

    img.icon {
      background-color: transparent;
      filter: brightness(0) saturate(100%) invert(24%) sepia(94%) saturate(7496%) hue-rotate(209deg) brightness(92%) contrast(101%);
    }

    svg path {
      stroke: var(--btn-color);
    }
  }

  .sidebar-footer {
    margin-top: auto;
    padding-top: 0.5rem;
  }

  .sidebar-menu a span,
  .logout-btn span {
    display: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 0;
    opacity: 0;
    transition: max-width 0.3s ease, opacity 0.2s ease;
  }


  &:hover {
    width: 300px;

    .logo-full {
      margin-left: 1rem;
      display: block;
    }

    .sidebar-header {
      justify-content: space-between;

      .logo-mini {
        display: none;
      }
    }

    a {
      width: calc(100% - 2rem);
      border-radius: 2px;
    }

    .sidebar-menu.active ul>li a spa {
      background-color: var(--header-tabs-color);
    }

    .sidebar-menu ul>li a span,
    .logout-btn span,
    .sidebar-footer a span {
      background-color: var(--white);
      display: inline;
      max-width: 200px;
      opacity: 1;
    }
  }
}

.add-company-btn {
  display: flex;
  align-items: center;
  gap: .5rem;
  font: 12px;
  font: 600;
  height: 40px;
}

/* -- Main -- */
main {
  margin-left: 105px;
  width: calc(100% - 100px);
  padding: 2.5rem 1rem;

  /* -- main | header --*/
  .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1376px;
    width: 100%;
    margin: 2rem auto;

    .section-header-text {
      h1 {
        font-size: 36px;
        font-weight: 700;
        color: var(--text-color);
        margin-bottom: 1rem;
      }

      p {
        font-size: 14px;
        color: var(--text-color);
      }
    }
  }

  .tabs {
    display: flex;
    background-color: var(--header-tabs-color);
    border-radius: 2px;
    padding: 4px;

    a {
      padding: 8px 16px;
      border-radius: 2px;
      font-size: 14px;
      text-decoration: none;
      color: var(--text-color);
      font-weight: 500;
      transition: background 0.2s;

      &:hover {
        background-color: var(--tab-hover-color);
      }

      &.active {
        background-color: var(--btn-color);
        color: #fff;
        font-weight: 600;
      }
    }
  }

  .content {
    padding: 30px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-width: 1376px;
    width: 100%;
    color: var(--text-color);
    margin: 0 auto;

    .content-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 1rem;

      h2 {
        font-size: 24px;
        font-weight: 700;
        color: var(--text-color);
      }

      .btn-add {
        background-color: var(--btn-color);
        color: #fff;
        padding: 0.5rem 1rem;
        border: none;
        cursor: pointer;
        transition: background-color 0.2s;

        &:hover {
          background-color: var(--btn-hover-color);
        }
      }
    }
  }
}

.window-modal {
  position: fixed;
  inset: 0;
  display: flex;
  /* sempre flex */
  justify-content: center;
  align-items: center;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 1001;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease;

  &.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;

    .modal {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .modal {
    background-color: #fff;
    border-radius: 8px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    opacity: 0;
    transform: translateY(-30px);
    transition: opacity 0.5s ease, transform 0.5s ease;

    .modal-header {
      background-color: var(--white);
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .modal-content {
      background-color: var(--white);

      p {
        background-color: var(--white);
      }

      h2 {
        background-color: var(--white);
      }

      form {
        background-color: var(--white);
        display: flex;
        flex-direction: column;

        button {
          width: 50%;
          margin: 0 auto;
        }

        label {
          background-color: var(--white);
        }
      }
    }
  }
}


@media screen and (max-width: 470px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 300px;
    background-color: var(--white);
    z-index: 1100;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    display: flex;
    flex-direction: column;

    .sidebar-menu {
      ul {
        li.active a {
          border-radius: 12px !important;
          height: 48px !important;
          padding: 0 1rem !important;
        }
      }
    }
  }

  .sidebar.sidebar--active {
    transform: translateX(0);
  }

  .section-header {
    margin-top: 5rem !important;
  }

  .sidebar.sidebar--active .logo-full {
    display: block !important;
    margin-left: 1rem;
  }

  .sidebar.sidebar--active .logo-mini {
    display: none !important;
  }

  .sidebar.sidebar--active .sidebar-header {
    justify-content: flex-start !important;
  }

  .sidebar.sidebar--active .sidebar-menu ul>li a span,
  .sidebar.sidebar--active .logout-btn span,
  .sidebar.sidebar--active .sidebar-footer a span {
    display: inline !important;
    max-width: 200px !important;
    opacity: 1 !important;
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
  }

  .sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
  }


  .menu-mobile {
    position: absolute;
    top: 10px;
    /* antes era 16px, agora está mais baixo */
    left: 10px;
    padding: 15px 8px;
    z-index: 100;
    cursor: pointer;
  }

  .card {
    padding: 24px !important;

    h3 {
      font-size: 24px;
    }

    p {
      font-size: 15px !important;
    }

    img {
      width: 20px;
      height: 20px;
    }
  }

  .content {
    padding: 16px !important;
  }

  main {
    width: 100% !important;
    height: 100% !important;
    margin-left: 0 !important;
    margin-top: 0;
    padding-top: 0;
  }

  .box-login {
    width: 95%;
    border-radius: 12px;
  }

  .window-modal .modal {
    width: 90%;
  }

  .title-login {
    img {
      width: 130px;
      height: auto;
    }
  }
}


@media (max-width: 470px) {
  main {
    margin: 0 !important;
  }

  .content {
    width: 100% !important;
    padding: 10px !important;
  }
}