/*
 * Copyright (c) 2016-2017. Matias Iglesias <miglesias@guanacosoftware.com.ar>
 *
 *
 *  Permission is hereby granted, free of charge, to any person obtaining a copy of this software
 *  and associated documentation files (the "Software"), to deal in the Software without restriction,
 *  including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
 *  and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
 *  subject to the following conditions:
 *
 *  The above copyright notice and this permission notice shall be included in all copies or substantial
 *  portions of the Software.
 *
 *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 *  LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
 *  NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 *  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 *  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

@import url(https://fonts.googleapis.com/css?family=Cairo:400,600);

body {
  padding-top: 70px;
  padding-bottom: 40px;
  font-family: "Cairo", sans-serif;
}

.input-error {
  border: 1px solid red;
}

div.container a.navbar-brand > img {
  display: inline;
  margin-right: 4px;
  margin-top: -2px;
}

.label-becado,
tr.becado td,
tr.becado th {
  background-color: lightblue;
}

/* Chosen look & feel - Bootstrap Integration */
.chosen-container {
  min-width: 120px !important;
  width: 100% !important;
}

/* Bootstrap 5 Integration for Chosen */
.chosen-container-single .chosen-single {
  height: 38px;
  line-height: 1.5;
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
  background: #fff;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.075);
  transition:
    border-color 0.15s ease-in-out,
    box-shadow 0.15s ease-in-out;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  font-weight: 400;
  color: #212529;
  display: flex;
  align-items: center;
}

.chosen-container-single .chosen-single:hover {
  border-color: #b0b8c1;
}

.chosen-container-single .chosen-single:focus,
.chosen-container-active.chosen-container-single .chosen-single {
  border-color: #86b7fe;
  outline: 0;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.chosen-container-multi .chosen-choices {
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
  background: #fff;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.075);
  min-height: 38px;
  transition:
    border-color 0.15s ease-in-out,
    box-shadow 0.15s ease-in-out;
  padding: 0.25rem 0.375rem;
  font-size: 1rem;
  color: #212529;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.chosen-container-multi .chosen-choices:hover {
  border-color: #b0b8c1;
}

.chosen-container-multi.chosen-container-active .chosen-choices {
  border-color: #86b7fe;
  outline: 0;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.chosen-container-multi .chosen-choices li.search-choice {
  background: #0d6efd;
  border: 1px solid #0d6efd;
  border-radius: 0.25rem;
  color: #fff;
  padding: 3px 8px 3px 22px;
  margin: 3px 5px 3px 0;
  position: relative;
}

.chosen-container-multi .chosen-choices li.search-choice .search-choice-close {
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="white" d="M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z"/></svg>')
    no-repeat center;
  background-size: 12px;
  width: 16px;
  height: 16px;
  position: absolute;
  right: 4px;
  top: 4px;
}

.chosen-container .chosen-drop {
  border: 1px solid #ced4da;
  border-top: 0;
  border-radius: 0 0 0.375rem 0.375rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.chosen-container .chosen-results li.highlighted {
  background-color: #0d6efd;
  color: #fff;
}

/* Texto placeholder y alineación */
.chosen-container-single .chosen-single span {
  margin-right: 26px;
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 1rem;
  color: #212529;
  line-height: 1.5;
  flex: 1;
}

.chosen-container-single .chosen-default {
  color: #6c757d !important;
}

.chosen-container-multi .chosen-choices li.search-field input[type="text"] {
  height: 30px;
  margin: 1px 0;
  padding: 4px 8px;
  font-size: 1rem;
  color: #212529;
  border: 0 !important;
  background: transparent !important;
  outline: 0;
}

/* Flecha del dropdown */
.chosen-container-single .chosen-single div {
  width: 18px;
  height: 100%;
  right: 12px;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chosen-container-single .chosen-single div b {
  background-position: center;
  width: 12px;
  height: 12px;
}

.ui-autocomplete {
  z-index: 2147483647;
}

table.tablesorter thead tr .tablesorter-header {
  cursor: pointer;
}

.link-como-texto {
  color: inherit;
  text-decoration: none;
}

@media print {
  .navbar-form,
  ul.breadcrumb {
    visibility: hidden !important;
    display: none !important;
  }

  a[href]:after {
    content: none !important;
  }
}

/* Contenedor principal */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 81vh;
  background: #f4f6f8;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

/* Wrapper del login */
.login-wrapper {
  max-width: 400px;
  width: 100%;
  padding: 5px 10px;
}

/* Header */
.login-header {
  text-align: center;
  margin-bottom: 20px;
}

.logo-icon {
  width: 50px;
  height: 50px;
  color: #2563eb;
}

.login-title {
  font-size: 1.5rem;
  font-weight: bold;
  color: #111827;
}

.login-subtitle {
  font-size: 0.9rem;
  color: #6b7280;
}

/* Card del login */
.login-card {
  background: white;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);
}

/* Formularios */
.form-group {
  margin-bottom: 15px;
}

.form-label {
  display: block;
  font-weight: 500;
  margin-bottom: 5px;
  color: #374151;
}

.input-container {
  display: flex;
  align-items: center;
  position: relative;
}

.input-icon {
  position: absolute;
  left: 10px;
  color: #9ca3af;
}

.input-icon svg {
  width: 20px;
  height: 20px;
}

.form-input {
  width: 100%;
  padding: 10px 10px 10px 38px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: border-color 0.3s;
}

.form-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

/* Botón mostrar/ocultar contraseña */
.password-toggle {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #9ca3af;
}

.password-toggle svg {
  width: 20px;
  height: 20px;
}

/* Opciones */
.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  margin: 10px 0;
}

.remember-container {
  display: flex;
  align-items: center;
  gap: 5px;
}

.checkbox-label {
  color: #374151;
}

.forgot-password {
  text-decoration: none;
  color: #2563eb;
}

.forgot-password:hover {
  text-decoration: underline;
}

/* Botón de login */
.login-button {
  width: 100%;
  background-color: #2563eb;
  color: white;
  padding: 10px;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.login-button:hover {
  background-color: #1e4fd6;
}

.button-icon {
  width: 18px;
  height: 18px;
}

/* Nota de seguridad */
.security-notice {
  margin-top: 15px;
  font-size: 0.85rem;
  text-align: center;
}

.security-content {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  color: #059669;
}

.security-icon {
  width: 18px;
  height: 18px;
}

.security-text {
  color: #065f46;
}

/* Footer */
.login-footer {
  text-align: center;
  margin-top: 15px;
  font-size: 0.8rem;
  color: #6b7280;
}

/* Enlace de registro */
.register-link {
  margin-top: 15px;
  text-align: center;
  font-size: 0.9rem;
  color: #374151;
}

.register-link span {
  margin-right: 5px;
}

.register-button {
  background-color: #f3f4f6;
  padding: 6px 12px;
  border-radius: 6px;
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
  transition: background-color 0.3s;
}

.register-button:hover {
  background-color: #e5e7eb;
}

.logo-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 1rem;
  margin-bottom: 10px;
}

.logo-img {
  max-width: 120px;
  height: auto;
}

.card {
  transition: transform 0.3s ease;
  transform-origin: center;
  backface-visibility: hidden;
  will-change: transform;
  transform-style: preserve-3d;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.zammad-chat {
  bottom: 130px !important;
}

.navbar.fixed-top {
  z-index: 1035;
}

.navbar .dropdown-menu {
  z-index: 1045;
}

.navbar-search-form {
  width: 100%;
}

.navbar-search-form .input-group {
  width: 100%;
}

footer.fixed-bottom {
  z-index: 1025;
}

.footer-spacer {
  height: 130px;
}

.footer-social {
  width: 100%;
}

@media screen and (max-width: 768px) {
  .zammad-chat {
    height: 70% !important;
    bottom: 150px !important;
  }
}

/* Hacer scrolleable los dropdowns del navbar en dispositivos móviles */
@media (max-width: 991.98px) {
  .app-footer.fixed-bottom {
    position: static !important;
  }

  .footer-spacer {
    display: none;
  }

  .navbar-search-form {
    padding: 0.5rem 0;
  }

  /* Permitir que el navbar-collapse use toda la altura disponible */
  .navbar-collapse {
    max-height: calc(100vh - 56px) !important;
    overflow-y: auto;
  }

  .navbar-collapse.show {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1036;
    background-color: var(--bs-light, #f8f9fa);
    padding: 0 1rem 8rem;
  }

  .navbar-collapse .dropdown-menu.show {
    max-height: calc(100vh - 200px);
    overflow-y: auto !important;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    position: relative !important;
    transform: none !important;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
  }

  /* Asegurar que cada item del dropdown tenga padding adecuado */
  .navbar-collapse .dropdown-menu .dropdown-item {
    white-space: normal;
    padding: 0.5rem 1rem;
  }
}

/* Para tablets en landscape */
@media (min-width: 576px) and (max-width: 991.98px) {
  .navbar-collapse .dropdown-menu.show {
    max-height: calc(100vh - 180px);
  }
}

/* Para desktop mantener comportamiento normal pero con límite */
@media (min-width: 992px) {
  .app-footer-content {
    display: grid !important;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
    width: 100%;
  }

  .footer-left {
    justify-self: start;
    align-items: flex-start !important;
    text-align: left !important;
  }

  .footer-center {
    justify-self: center;
  }

  .footer-logo {
    justify-self: end;
    margin-left: auto;
  }

  .footer-social {
    width: min(360px, 100%);
    justify-content: space-evenly !important;
  }

  .navbar-search-form {
    min-width: 260px;
    max-width: 420px;
  }

  .dropdown-menu {
    max-height: 80vh;
    overflow-y: auto;
  }
}
