/* =========================================
   Admin Custom Styles - Bolsa de Trabajo
   Bootstrap 5 → 4 compatibility + Modern UI
   ========================================= */

/* -----------------------------------------
   BS5 → BS4 Compatibility Layer
   ----------------------------------------- */

/* form-select doesn't exist in BS4, map it to custom-select look */
.form-select {
    display: block;
    width: 100%;
    height: calc(1.5em + 0.75rem + 2px);
    padding: 0.375rem 1.75rem 0.375rem 0.75rem;
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.5;
    color: #6e707e;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3e%3cpath fill='%235a5c69' d='M2 0L0 2h4zm0 5L0 3h4z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 8px 10px;
    border: 1px solid #d1d3e2;
    border-radius: 0.35rem;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
.form-select:focus {
    border-color: #bac8f3;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
}
.form-select[multiple] {
    height: auto;
    padding-right: 0.75rem;
    background-image: none;
}

/* form-label doesn't exist in BS4 */
.form-label {
    display: inline-block;
    margin-bottom: 0.3rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: #5a5c69;
}

/* g-3 gap utility - add spacing to form columns */
.g-3 > [class*="col"] {
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
}

/* form-control-sm for selects in headers */
select.form-control-sm {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3e%3cpath fill='%235a5c69' d='M2 0L0 2h4zm0 5L0 3h4z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 8px 10px;
    padding-right: 1.75rem;
}

/* -----------------------------------------
   Global Enhancements
   ----------------------------------------- */

/* Better form controls */
.form-control {
    font-size: 0.9rem;
    border-color: #d1d3e2;
    border-radius: 0.35rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
.form-control:focus {
    border-color: #bac8f3;
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
}
.form-control::placeholder {
    color: #b7b9cc;
    font-size: 0.85rem;
}

/* Cards */
.card {
    border: none;
    border-radius: 0.5rem;
}
.card-header {
    background-color: #f8f9fc;
    border-bottom: 1px solid #e3e6f0;
    padding: 0.85rem 1.25rem;
}
.card-body {
    padding: 1.5rem;
}

/* Page headings */
.h3.text-gray-800,
h1.h3.text-gray-800 {
    font-weight: 700;
    color: #3a3b45;
    margin-bottom: 1.25rem;
}

/* -----------------------------------------
   DataTables
   ----------------------------------------- */

.table thead th {
    background-color: #4e73df;
    color: #fff;
    border-color: #4568cb;
    font-size: 0.8rem;
    font-weight: 600;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.85rem 0.75rem;
}
.table thead th:first-child {
    border-radius: 0.35rem 0 0 0;
}
.table thead th:last-child {
    border-radius: 0 0.35rem 0 0;
}

.table tbody td {
    vertical-align: middle;
    font-size: 0.85rem;
    padding: 0.65rem 0.75rem;
    color: #5a5c69;
}
.table-hover tbody tr:hover {
    background-color: #eaecf4;
}

/* DataTables wrapper spacing */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 1rem;
}
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    margin-top: 1rem;
}

/* Action buttons in tables */
.table .btn-sm {
    padding: 0.3rem 0.55rem;
    font-size: 0.78rem;
    border-radius: 0.3rem;
    transition: all 0.15s ease;
}
.table .btn-sm:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

/* Badge in tables */
.badge-ciclo {
    font-size: 0.72rem;
    font-weight: 500;
    padding: 0.35em 0.65em;
    margin: 1px;
    display: inline-block;
    border-radius: 0.25rem;
}

/* -----------------------------------------
   Buttons
   ----------------------------------------- */

.btn {
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 0.35rem;
    transition: all 0.15s ease;
    letter-spacing: 0.02em;
}
.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.btn-primary {
    background-color: #4e73df;
    border-color: #4e73df;
}
.btn-primary:hover {
    background-color: #2e59d9;
    border-color: #2653d4;
}

/* -----------------------------------------
   Alerts
   ----------------------------------------- */

.alert {
    border: none;
    border-radius: 0.5rem;
    border-left: 4px solid transparent;
    font-size: 0.9rem;
}
.alert p {
    margin-bottom: 0;
}
.alert-success {
    border-left-color: #1cc88a;
    background-color: #e8f8f0;
    color: #155724;
}
.alert-danger {
    border-left-color: #e74a3b;
    background-color: #fdf0ef;
    color: #721c24;
}
.alert-info {
    border-left-color: #36b9cc;
    background-color: #e8f6f8;
    color: #0c5460;
}

/* -----------------------------------------
   Form Sections / Dividers
   ----------------------------------------- */

.card-body > form h6.text-primary.font-weight-bold {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-bottom: 0.35rem;
    border-bottom: 2px solid #4e73df;
    display: inline-block;
}

.card-body > form > hr {
    border-top: 1px solid #e3e6f0;
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
}

/* -----------------------------------------
   Form check / Radio buttons
   ----------------------------------------- */

.form-check-input {
    margin-top: 0.2rem;
}
.form-check-label {
    font-size: 0.9rem;
    color: #5a5c69;
    cursor: pointer;
}

/* Fieldset legend */
legend.col-form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #5a5c69;
}

/* -----------------------------------------
   Nav Pills (tabs)
   ----------------------------------------- */

.nav-pills .nav-link {
    font-size: 0.85rem;
    font-weight: 600;
    color: #5a5c69;
    border-radius: 0.35rem;
    padding: 0.5rem 1rem;
    transition: all 0.15s ease;
}
.nav-pills .nav-link:hover {
    background-color: #eaecf4;
    color: #4e73df;
}
.nav-pills .nav-link.active {
    background-color: #4e73df;
    color: #fff;
}

/* -----------------------------------------
   Progress bars (idiomas)
   ----------------------------------------- */

.progress {
    height: 1.25rem;
    border-radius: 0.35rem;
    background-color: #eaecf4;
}
.progress-bar {
    font-size: 0.72rem;
    font-weight: 600;
    background-color: #4e73df;
}

/* -----------------------------------------
   Row selected in Bolsa de trabajo
   ----------------------------------------- */

.row_selected {
    background-color: #d4edfa !important;
}
.row_selected:hover {
    background-color: #c0e2f7 !important;
}

/* List items in selection panel */
.list-group-item-select {
    text-decoration: none;
    color: inherit;
    cursor: default;
    border-radius: 0.35rem;
    margin-bottom: 2px;
    font-size: 0.9rem;
}
.list-group-item-select .badge {
    cursor: pointer;
    transition: all 0.15s ease;
}
.list-group-item-select .badge:hover {
    transform: scale(1.15);
}

/* -----------------------------------------
   Character counter colors
   ----------------------------------------- */

.char-count-ok { color: #666; }
.char-count-warning { color: #e6a817; }
.char-count-danger { color: #e74a3b; font-weight: bold; }

/* -----------------------------------------
   Detail cards (show views)
   ----------------------------------------- */

.card.border-left-primary,
.card.border-left-secondary,
.card.border-left-success,
.card.border-left-danger,
.card.border-left-warning,
.card.border-left-info,
.card.border-left-dark {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card.border-left-primary:hover,
.card.border-left-secondary:hover,
.card.border-left-success:hover,
.card.border-left-danger:hover,
.card.border-left-warning:hover,
.card.border-left-info:hover,
.card.border-left-dark:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.25rem 1rem rgba(0,0,0,0.12) !important;
}

/* Collapsible card headers */
a.d-block.card-header {
    text-decoration: none;
    transition: background-color 0.15s ease;
}
a.d-block.card-header:hover {
    background-color: #edf0f7;
}

/* -----------------------------------------
   WhatsApp chat styles
   ----------------------------------------- */

.whatsapp-chat {
    max-height: 500px;
    overflow-y: auto;
    background-color: #222e35;
    padding: 15px;
    border: 1px solid #333;
    border-radius: 0.5rem;
    color: white;
}

.wa-message {
    max-width: 60%;
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.wa-message.wa-sent {
    background-color: #005c4b;
    margin-left: auto;
    color: white;
}
.wa-message.wa-received {
    background-color: #343a40;
    margin-right: auto;
    color: white;
}
.wa-message-body { margin: 0; font-size: 0.9rem; }
.wa-message-timestamp {
    display: block;
    font-size: 0.78rem;
    margin-top: 4px;
    text-align: right;
    color: #adb5bd;
}

/* Chat list items */
.wa-chat-item {
    background-color: #2a2f32;
    padding: 12px 15px;
    margin: 4px 0;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    color: #E1E1E1;
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.wa-chat-item:hover {
    background-color: #3a4043;
}

/* WhatsApp pagination */
.wa-pagination {
    text-align: center;
    padding: 12px 0;
    color: #E1E1E1;
}
.wa-pagination button {
    background-color: #33383b;
    color: #fff;
    border: none;
    padding: 6px 14px;
    margin: 0 5px;
    border-radius: 0.35rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: background-color 0.2s ease;
}
.wa-pagination button:hover {
    background-color: #4e73df;
}
.wa-pagination button:disabled {
    background-color: #555;
    cursor: default;
}
.wa-pagination #current-page {
    font-size: 1.1em;
    font-weight: 700;
    color: #4e73df;
}

/* -----------------------------------------
   Misc / Utilities
   ----------------------------------------- */

/* Invalid feedback */
.invalid-feedback strong {
    font-weight: 500;
}

/* Smooth page transitions */
.container-fluid,
.container {
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
    from { opacity: 0.7; }
    to { opacity: 1; }
}

/* Scrollbar for tables */
.table-responsive::-webkit-scrollbar {
    height: 6px;
}
.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}
.table-responsive::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

/* Delete modal icon */
#deleteModal .modal-title i {
    font-size: 1.1rem;
}
