/* =========================================================
   SOFTWARE.CSS
   Módulos:
   1. Utilidades base
   2. Archivos adjuntos / Dropzone
   3. Formulario de software / edición
   4. Asignación de licencias a computador
   5. Tablas, badges y estados
   6. Botones y acciones
   7. Select2 / selector de software
   8. Responsive
========================================================= */


/* =========================================================
   1. UTILIDADES BASE
========================================================= */

.text-red {
  color: #dc3545;
}

.software-muted {
  color: #6c757d;
  font-size: 13px;
}




/* =========================================================
   3. FORMULARIO DE SOFTWARE / EDICIÓN
========================================================= */

.form-control {
  min-height: 38px;
  border: 1px solid #ced4da;
  border-radius: 6px;
  box-shadow: none;
}

.form-control:focus {
  border-color: #80bdff;
  box-shadow: none;
}

.software-form-panel {
  background: #fff;
}

.software-form-panel .form-group label {
  margin-bottom: 6px;
  font-weight: 600;
  color: #343a40;
}


/* =========================================================
   4. ASIGNACIÓN DE LICENCIAS A COMPUTADOR
========================================================= */

.software-box {
  background: #fff;
}

.software-box-body {
  padding: 18px;
}

.software-box-footer {
  padding: 16px 18px;
  background: #fafafa;
  border-top: 1px solid #e9ecef;
}

/* Resumen superior */
.software-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.software-summary-card {
  padding: 14px;
  background: #fcfcfc;
  border: 1px solid #e9ecef;
  border-radius: 8px;
}

.software-summary-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.software-summary-value {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.1;
  color: #212529;
}

/* Paneles */
.software-panel {
  margin-bottom: 18px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 8px;
}

.software-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 15px;
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
}

.software-panel-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #212529;
}

.software-panel-subtitle {
  font-size: 13px;
  color: #6c757d;
}

.software-panel-body {
  padding: 15px;
}

/* Tarjetas de información */
.software-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.software-info-card {
  min-height: 76px;
  padding: 12px;
  background: #fbfcfd;
  border: 1px solid #e9ecef;
  border-radius: 8px;
}

.software-info-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.software-info-value {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  color: #212529;
  word-break: break-word;
}

/* Caja de ayuda */
.software-help-box {
  margin-top: 12px;
  padding: 10px 12px;
  font-size: 13px;
  color: #6c757d;
  background: #fbfcfd;
  border: 1px dashed #d6dbe1;
  border-radius: 8px;
}


/* =========================================================
   5. TABLAS, BADGES Y ESTADOS
========================================================= */

.software-table-wrap {
  width: 100%;
  overflow-x: visible; /* antes: auto */
}

.software-table {
  width: 100% !important;
  min-width: 0; /* antes: 860px */
  margin-bottom: 0;
  background: #fff;
}

.software-table thead th {
  font-size: 13px;
  font-weight: 600;
  color: #343a40;
  white-space: nowrap;
  vertical-align: middle;
  background: #f8f9fa;
}

.software-table tbody td {
  font-size: 14px;
  vertical-align: middle;
}

.software-desc-cell {
  max-width: 280px;
  word-break: break-word;
  white-space: normal;
}

/* Estado vacío */
.fila-vacia td {
  padding: 22px !important;
  color: #6c757d;
}

.software-empty-title {
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 600;
  color: #495057;
}

.software-empty-text {
  font-size: 13px;
  color: #6c757d;
}

/* Contenedor responsive */
.table-responsive-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}


/* En móvil */
@media (max-width: 768px) {
  .software-table {
    font-size: 13px;
    min-width: 600px;
  }

  .software-table th,
  .software-table td {
    padding: 0.45rem 0.5rem;
  }
}

/* =========================================================
   BADGES DE ESTADO
========================================================= */

.badge-soft {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.38rem 0.7rem;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge-permanente {
  color: #155724;
  background-color: #d4edda;
  border-color: #c3e6cb;
}

.badge-suscripcion {
  color: #0c5460;
  background-color: #d1ecf1;
  border-color: #bee5eb;
}

.badge-vigente {
  color: #155724;
  background-color: #d4edda;
  border-color: #c3e6cb;
}

.badge-vencida {
  color: #721c24;
  background-color: #f8d7da;
  border-color: #f5c6cb;
}

.badge-proxima {
  color: #856404;
  background-color: #fff3cd;
  border-color: #ffeeba;
}

.badge-deshabilitado {
  color: #383d41;
  background-color: #e2e3e5;
  border-color: #d6d8db;
}

.badge-disponibles {
  color: #fff;
  background-color: #4086f5;
  border-color: #4086f5;
}
.software-table td .badge-soft {
  max-width: 100%;
}
@media (max-width: 768px) {
  .badge-soft {
    font-size: 11px;
    padding: 0.32rem 0.6rem;
  }
}

.software-info-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 991.98px) {
  .software-info-grid-4 {
    grid-template-columns: 1fr;
  }
}

.fila-vacia-asignadas td {
  padding: 22px !important;
  color: #6c757d;
}

.acciones-tabla {
  display: flex;
  justify-content: center;
  align-items: center;
}


/* =========================================================
   6. BOTONES Y ACCIONES
========================================================= */

.btn {
  min-height: 38px;
  font-weight: 500;
  border-radius: 6px;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
}

/* Footer editar.php */
.card-footer .acciones-formulario {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Footer software.php */
.software-footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}


/* =========================================================
   7. SELECT2 / SELECTOR DE SOFTWARE
========================================================= */

/* El select original lo reemplaza Select2 */
#softwareSelect {
  display: none;
}

.select2-container {
  width: 100% !important;
}

/* Select2 base general */
.select2-container--default .select2-selection--single {
  display: flex !important;
  align-items: center !important;
  height: 44px !important;
  padding: 0 14px !important;
  font-size: 14px;
  font-weight: 900;
  color: #212529;
  background: #fff !important;
  border: 1px solid #007bff !important;
  border-radius: 8px !important;
  transition: all 0.2s ease;
}

.select2-container--default .select2-selection--single:hover {
  border-color: #6c757d !important;
}

.select2-container--default.select2-container--focus .select2-selection--single {
  border-color: #007bff !important;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

/* Texto */
.select2-container--default .select2-selection--single .select2-selection__rendered {
  padding-left: 26px !important;
  line-height: normal !important;
  color: #212529 !important;
}

/* Flecha */
.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 44px !important;
}

/* Ícono decorativo */
.select2-container--default .select2-selection--single {
  position: relative;
}

.select2-container--default .select2-selection--single::before {
  position: absolute;
  left: 12px;
  font-size: 13px;
  font-weight: 900;
  color: #6c757d;
  /* content: "\f121"; */
  /* font-family: "Font Awesome 5 Free"; */
}

/* Dropdown */
.select2-dropdown {
  border: 1px solid #d9dee3;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

/* Opciones */
.select2-results__option {
  padding: 10px 12px;
  font-size: 14px;
}

.select2-results__option--highlighted {
  color: #212529 !important;
  background: #f1f4f7 !important;
}

.select2-results__option[aria-disabled="true"] {
  color: #adb5bd !important;
  background: #fafafa;
}


/* =========================================================
   8. RESPONSIVE
========================================================= */

@media (max-width: 991.98px) {
  .software-summary,
  .software-info-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767.98px) {
  /* Archivos */
  .archivo-item {
    display: block;
    height: auto;
    min-height: auto;
  }

  .archivo-info {
    margin-bottom: 10px;
  }

  .archivo-actions {
    flex-direction: row;
    gap: 8px;
    margin-top: 8px;
  }

  .archivo-actions .btn {
    width: 42px;
    min-width: 42px;
  }

  .dropzone {
    min-height: 120px;
    padding: 12px;
  }

  /* Editar software */
  .card-footer .acciones-formulario {
    flex-direction: column;
  }

  .card-footer .acciones-formulario .btn,
  .card-footer .acciones-formulario a {
    width: 100%;
  }

  /* Asignación */
  .software-box-body,
  .software-box-footer {
    padding-left: 14px;
    padding-right: 14px;
  }

  .software-panel-body {
    padding: 12px;
  }

  .software-footer-actions {
    flex-direction: column;
  }

  .software-footer-actions .btn,
  .software-footer-actions a {
    width: 100%;
  }
}