/* Estilos generales */
:root{
    --app-bg: #f6f8fb;
    --app-surface: #ffffff;
    --app-text: #0f172a;
    --app-muted: #64748b;
    --app-border: rgba(15, 23, 42, 0.12);
    --app-shadow: 0 10px 30px rgba(2, 8, 23, 0.10);
    --app-shadow-sm: 0 6px 14px rgba(2, 8, 23, 0.10);
    --app-primary: #0d6efd;
    --app-primary-600: #0b5ed7;
}

body {
    font-family: Arial, sans-serif;
    background-color: var(--app-bg);
    color: var(--app-text);
}

.page-loader{
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.82);
    backdrop-filter: blur(6px);
    z-index: 10000;
}
.page-loader .loader-card{
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 14px;
    box-shadow: var(--app-shadow);
    padding: 18px 18px;
    min-width: 280px;
    text-align: center;
}

.page-loader .loader-text{
    color: var(--app-muted);
    font-size: 14px;
    margin-top: 10px;
}

.auth-shell{
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
}

.auth-shell .card{
    box-shadow: var(--app-shadow);
    border: 1px solid var(--app-border);
}

.login-logo {
    width: 120px;
    height: 120px;
    margin: 0 auto 20px;
    display: block;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Navbar */
.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
    background-color: var(--app-surface) !important;
    border-bottom: 1px solid var(--app-border);
}

/* Cards */
.card {
    background: var(--app-surface);
    color: var(--app-text);
    box-shadow: var(--app-shadow-sm);
    border: none;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0,0,0,.15);
}

/* Tablas */
#categoriesTable, #filesTable {
    margin-top: 20px;
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
}

#categoriesCards {
    display: none;
}

@media (max-width: 768px) {
    #categoriesTable {
        display: none;
    }
    #categoriesCards {
        display: block;
    }
    .category-card {
        border: 1px solid var(--app-border);
        border-radius: 12px;
        background: var(--app-surface);
        box-shadow: var(--app-shadow-sm);
        padding: 12px 12px;
        margin-bottom: 10px;
    }
    .category-card .category-title {
        font-weight: 700;
        margin: 0 0 8px 0;
        font-size: 15px;
    }
    .category-card .category-actions {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }
}

/* Handsontable */
.handsontable {
    font-size: 12px; /* Fuente más pequeña estilo Excel */
}

.handsontable .htCore {
    border: 1px solid #dee2e6;
}

.handsontable th {
    background-color: #f8f9fa;
    font-weight: bold;
    color: #495057;
    text-align: center;
}

.handsontable td {
    padding: 1px 4px !important; /* Padding mínimo para filas delgadas */
    border-color: #dee2e6;
    vertical-align: middle;
    white-space: nowrap; /* Evitar que el texto crezca la fila */
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Estilo Cebra para Handsontable */
.handsontable tr:nth-child(even) td {
    background-color: #eea8a8 !important;
}

.handsontable .htDimmed {
    color: #6c757d;
}

.handsontable .btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
    padding: 2px 8px;
    font-size: 12px;
}

.handsontable .btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

.htCenter .htCore td {
    text-align: center;
}

/* Botones */
.btn-primary {
    background-color: var(--app-primary);
    border-color: var(--app-primary);
}

.btn-primary:hover {
    background-color: var(--app-primary-600);
}

.btn-xs {
    padding: 0px 3px !important;
    font-size: 10px !important;
    line-height: 1.1 !important;
    border-radius: 2px;
}

.btn-group-xs > .btn, .btn-xs {
    padding: 0px 3px !important;
    font-size: 10px !important;
    line-height: 1.1 !important;
    border-radius: 2px;
}

/* Alertas personalizadas */
.custom-alert {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    padding: 12px 20px;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s, transform 0.3s;
    z-index: 9999;
}

.custom-alert.show {
    opacity: 1;
    transform: translateY(0);
}

.custom-alert-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 12px;
}

.custom-alert-icon.success {
    background-color: #4CAF50;
    color: white;
}

.custom-alert-icon.error {
    background-color: #F44336;
    color: white;
}

.custom-alert-message {
    font-size: 14px;
    color: #333;
}

/* Estilos para la sección de categorías */
#categoriesContent .d-flex {
    margin-top: 1rem;
}

#categoriesContent #pagination {
    display: inline-block;
}

#categoriesContent #categoryPageSize {
    width: auto;
    min-width: 70px;
}

#categoriesContent .form-select-sm {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    font-size: 0.875rem;
}

#categoriesContent .d-flex.align-items-center {
    gap: 1rem;
}

/* Validación de formularios */
.invalid-tooltip {
    display: none;
    width: 100%;
    margin-top: .25rem;
    font-size: .875rem;
    color: #dc3545;
}

.was-validated .form-control:invalid ~ .invalid-tooltip,
.form-control.is-invalid ~ .invalid-tooltip {
    display: block;
}

/* Estilos para SimpleDatatables */
.dataTable-input {
    font-size: 16px;
    padding: 10px 15px;
    width: 400px;
    border: 1px solid #ced4da;
    border-radius: 4px;
}

.dataTable-top {
    padding: 15px 0;
}

.dataTable-wrapper {
    margin-top: 20px;
}

/* Estilos para el filtro de categorías */
#categoryFilterContainer {
    background-color: #ffeeee;
}

/* Estilos para la navegación */
.nav-tabs {
    border-bottom: 2px solid #dee2e6;
}

.nav-tabs .nav-link {
    border: none;
    color: #495057;
    font-weight: 500;
    padding: 10px 15px;
    transition: all 0.3s ease;
}

.nav-tabs .nav-link:hover {
    border: none;
    color: #007bff;
}

.nav-tabs .nav-link.active {
    border: none;
    color: #007bff;
    position: relative;
}
 
.nav-tabs .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #007bff;
    transition: all 0.3s ease;
}
/* Añade esto al final del archivo */

@media (max-width: 991px) {
  .navbar-brand img {
    width: 25px;
    height: 25px;
  }

  #logoutBtn {
    margin-top: 10px;
  }

  .navbar-nav {
    margin-top: 10px;
  }
}

@media (max-width: 575px) {
  .navbar-brand img {
    width: 20px;
    height: 20px;
  }

  #logoutBtn {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
  }

  .navbar-nav .nav-link {
    font-size: 0.9rem;
    padding: 0.25rem 0.5rem;
  }
}
@media screen and (max-width: 600px) {
  #filesTable table {
    border: 0;
  }

  #filesTable table caption {
    font-size: 1.3em;
  }
  
  #filesTable table thead {
    border: none;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
  }
  
  #filesTable table tr {
    border-bottom: 3px solid #ddd;
    display: block;
    margin-bottom: .625em;
  }
  
  #filesTable table td {
    border-bottom: 1px solid #ddd;
    display: block;
    font-size: .8em;
    text-align: right;
  }
  
  #filesTable table td::before {
    content: attr(data-label);
    float: left;
    font-weight: bold;
    text-transform: uppercase;
  }
  
  #filesTable table td:last-child {
    border-bottom: 0;
  }
}
@media screen and (max-width: 640px) {
  .dataTable-table {
    font-size: 14px;
  }

  .dataTable-input {
    width: 100%;
    margin-bottom: 10px;
  }

  .dataTable-dropdown {
    width: 100%;
    margin-bottom: 10px;
  }

  .dataTable-pagination {
    text-align: center;
  }

  .dataTable-pagination a {
    padding: 6px 10px;
  }

  .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
  }
}
.file-card {
  border: 1px solid #ddd;
  border-radius: 8px;
  margin-bottom: 10px;
  overflow: hidden;
}

.file-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  background-color: #f8f9fa;
  cursor: pointer;
}

.file-card-title {
  margin: 0;
  font-size: 1.1em;
}

.file-card-toggle {
  background: none;
  border: none;
  font-size: 1.5em;
  cursor: pointer;
}

.file-card-content {
  display: none;
  padding: 15px;
}

.file-card-content.active {
  display: block;
}

.file-card-buttons {
  margin-top: 10px;
}

.pagination {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

.pagination button {
  margin: 0 5px;
  padding: 5px 10px;
  border: 1px solid #ddd;
  background-color: #f8f9fa;
  cursor: pointer;
}

.pagination button:hover {
  background-color: #e9ecef;
}

@media screen and (max-width: 767px) {
  .responsive-table {
    border: 0;
  }

  .responsive-table thead {
    display: none;
  }

  .responsive-table tr {
    margin-bottom: 10px;
    display: block;
    border-bottom: 2px solid #ddd;
  }

  .responsive-table td {
    display: block;
    text-align: right;
    font-size: 13px;
    border-bottom: 1px dotted #ccc;
  }

  .responsive-table td:last-child {
    border-bottom: 0;
  }

  .responsive-table td:before {
    content: attr(data-label);
    float: left;
    text-transform: uppercase;
    font-weight: bold;
  }
}