/* ============================================================
   BACK NAVIGATION LINK
   ============================================================ */
.page-back-link {
  width:           40px;
  height:          40px;
  border-radius:   var(--radius-md);
  background:      var(--color-accent-light);
  color:           var(--color-accent);
  display:         flex;
  align-items:     center;
  justify-content: center;
  font-size:       1rem;
  flex-shrink:     0;
  text-decoration: none;
  transition:      background 0.15s ease, color 0.15s ease;
}

.page-back-link:hover {
  background: rgba(63, 81, 181, 0.18);
  color:      var(--color-accent-dark);
}

/* ============================================================
   CARDS
   ============================================================ */
.surface-card {
  background:    var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow:    var(--shadow-card);
  padding:       var(--space-5);
  border:        1px solid var(--color-border);
}

.table-card {
  padding: var(--space-5);
}

.result-card {
  margin-top: var(--space-5);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary-pill,
.btn-primary {
  background:    var(--color-accent);
  color:         var(--color-accent-text);
  border-radius: var(--radius-pill);
  padding:       var(--space-2) var(--space-5);
  font-weight:   var(--font-weight-medium);
  font-size:     var(--font-size-base);
  border:        none;
  cursor:        pointer;
  transition:    background 0.2s ease;
  display:       inline-flex;
  align-items:   center;
  gap:           var(--space-2);
}

.btn-primary-pill:hover,
.btn-primary:hover {
  background: var(--color-accent-dark);
  color:      var(--color-accent-text);
}

.btn-secondary-pill {
  background:    var(--color-background);
  color:         var(--color-text-primary);
  border-radius: var(--radius-pill);
  padding:       var(--space-2) var(--space-5);
  font-weight:   var(--font-weight-medium);
  font-size:     var(--font-size-base);
  border:        1px solid var(--color-border);
  cursor:        pointer;
  transition:    background 0.2s ease, border-color 0.2s ease;
  display:       inline-flex;
  align-items:   center;
  gap:           var(--space-2);
}

.btn-secondary-pill:hover {
  background:    var(--color-border);
  border-color:  var(--color-text-muted);
  color:         var(--color-text-primary);
}

.btn-outline-pill,
.btn-outline {
  background:    transparent;
  border:        1px solid var(--color-border);
  border-radius: var(--radius-pill);
  color:         var(--color-text-primary);
  padding:       var(--space-2) var(--space-5);
  font-size:     var(--font-size-base);
  cursor:        pointer;
  transition:    border-color 0.2s ease, color 0.2s ease;
  display:       inline-flex;
  align-items:   center;
  gap:           var(--space-2);
}

.btn-outline-pill:hover,
.btn-outline:hover {
  border-color: var(--color-accent);
  color:        var(--color-accent);
}

/* ============================================================
   TABLES
   ============================================================ */
.grid-table {
  width:           100%;
  border-collapse: collapse;
  margin-bottom:   0;
}

.grid-table thead tr {
  background:     var(--color-background);
  border-bottom:  2px solid var(--color-border);
  font-size:      var(--font-size-sm);
  font-weight:    var(--font-weight-semibold);
  color:          var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.grid-table thead th {
  padding:        var(--space-3) var(--space-4);
  vertical-align: middle;
  text-align:     center;
  border-bottom:  2px solid var(--color-border);
}

.grid-table tbody tr {
  border-bottom: 1px solid var(--color-border);
  transition:    background 0.15s ease;
}

.grid-table tbody tr:hover {
  background: var(--color-accent-light);
}

.grid-table tbody td {
  padding:        var(--space-3) var(--space-4);
  font-size:      var(--font-size-base);
  vertical-align: middle;
  color:          var(--color-text-primary);
  font-weight:    var(--font-weight-medium);
  text-align:     center;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  padding:       var(--space-1) var(--space-3);
  font-size:     var(--font-size-sm);
  font-weight:   var(--font-weight-medium);
  border-radius: var(--radius-sm);
  display:       inline-flex;
  align-items:   center;
  gap:           var(--space-1);
}

.badge-success { background: #E8F5E9; color: #2E7D32; }
.badge-error   { background: #FFEBEE; color: #C62828; }
.badge-warning { background: #FFF8E1; color: #E65100; }
.badge-info    { background: #E3F2FD; color: #1565C0; }

/* Badge de estado en tablas (clase existente badge-estado) */
.badge-estado {
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  padding:         var(--space-1) var(--space-3);
  font-size:       var(--font-size-sm);
  font-weight:     var(--font-weight-medium);
  border-radius:   var(--radius-sm);
}

/* ============================================================
   FORMS
   ============================================================ */
.form-control {
  border:        1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding:       var(--space-2) var(--space-3);
  font-size:     var(--font-size-base);
  color:         var(--color-text-primary);
  background:    var(--color-surface);
  width:         100%;
  transition:    border-color 0.2s ease, box-shadow 0.2s ease;
  font-family:   var(--font-family);
}

.form-control:focus {
  border-color: var(--color-accent);
  outline:      none;
  box-shadow:   0 0 0 3px rgba(63, 81, 181, 0.12);
}

.form-pill {
  border-radius: var(--radius-pill);
}

.form-group {
  margin-bottom: var(--space-4);
}

.form-row {
  display:      flex;
  flex-wrap:    wrap;
  margin-right: -5px;
  margin-left:  -5px;
}

/* ============================================================
   TOASTS
   ============================================================ */
#toasts {
  position: fixed;
  bottom:   var(--space-4);
  right:    var(--space-4);
  z-index:  9999;
  display:  flex;
  flex-direction: column;
  gap:      var(--space-2);
}

.toast {
  min-width:     300px;
  border-radius: var(--radius-md) !important;
  box-shadow:    var(--shadow-dropdown) !important;
  border:        none !important;
  overflow:      hidden;
}

.toast.bg-success {
  background:  var(--color-surface) !important;
  border-left: 4px solid var(--color-success) !important;
  color:       var(--color-text-primary) !important;
}

.toast.bg-danger {
  background:  var(--color-surface) !important;
  border-left: 4px solid var(--color-error) !important;
  color:       var(--color-text-primary) !important;
}

.toast-header.bg-success,
.toast-header.bg-danger {
  background:    transparent !important;
  color:         var(--color-text-primary) !important;
  border-bottom: 1px solid var(--color-border) !important;
}

.toast-header strong {
  font-weight: var(--font-weight-semibold);
  font-size:   var(--font-size-sm);
}

.toast-body p {
  margin:    0;
  font-size: var(--font-size-sm);
  color:     var(--color-text-secondary);
}

/* ============================================================
   TOOLBARS
   ============================================================ */
.grid-toolbar {
  display:         flex;
  justify-content: flex-end;
  margin-bottom:   var(--space-4);
}

.table-toolbar {
  display:       flex;
  align-items:   center;
  gap:           var(--space-3);
  flex-wrap:     wrap;
  margin-bottom: var(--space-4);
}

.table-toolbar-main {
  justify-content: space-between;
}

.table-search-input {
  max-width: 320px;
  flex:      1;
}

/* ============================================================
   PASSWORD INPUT
   ============================================================ */
.password-wrapper {
  position: relative;
  display:  flex;
}

.password-wrapper input {
  width:         100%;
  padding-right: 45px;
}

.toggle-password {
  position:   absolute;
  right:      12px;
  top:        50%;
  transform:  translateY(-50%);
  border:     none;
  background: none;
  cursor:     pointer;
  color:      var(--color-text-secondary);
  transition: color 0.2s ease;
}

.toggle-password:hover {
  color: var(--color-accent);
}
