/* ----------------------------------------------------
   Estilos Modulares para el Historial de Campañas (WBC)
   ---------------------------------------------------- */

.campaigns-history-wrapper {
    margin-top: 15px;
}

.campaigns-history-card-panel {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 25px;
    color: #fff;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.campaigns-history-table-container {
    width: 100%;
    overflow-x: auto;
    margin-top: 15px;
}

.campaigns-history-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    color: #f1f5f9;
}

.campaigns-history-table th {
    background: rgba(255, 255, 255, 0.03);
    color: var(--wb-text-muted);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 14px 16px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.06);
    text-align: left;
}

.campaigns-history-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
    transition: background-color 0.15s ease;
}

.campaigns-history-table tbody tr {
    transition: all 0.2s ease;
}

.campaigns-history-table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Badges de Estado */
.history-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.history-status-badge.completed {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.history-status-badge.failed {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.history-status-badge.cancelled {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Barra de Progreso Compacta */
.history-progress-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 140px;
    max-width: 200px;
}

.history-progress-bar-bg {
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
    width: 100%;
}

.history-progress-bar-fill {
    height: 100%;
    background: var(--wb-accent-blue);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* ----------------------------------------------------
   Modal de Detalles del Historial (History Details)
   ---------------------------------------------------- */
#modal-campaigns-history-details.wb-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 12, 18, 0.75) !important;
    z-index: 100000 !important;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#modal-campaigns-history-details .wb-modal-content {
    background: rgba(30, 34, 45, 0.98) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 18px !important;
    width: 90% !important;
    max-width: 820px !important;
    padding: 30px !important;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
    font-family: 'Inter', sans-serif;
    animation: wbcModalFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.history-details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.history-details-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.history-search-wrapper {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.history-search-wrapper i {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    color: var(--wb-text-muted);
    font-size: 13px;
}

.history-search-input {
    width: 100%;
    padding: 8px 12px 8px 35px !important;
    background: rgba(0,0,0,0.2) !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    border-radius: 8px !important;
    color: #fff !important;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
}

.history-search-input:focus {
    border-color: var(--wb-accent-blue) !important;
}

.history-filter-tabs {
    display: flex;
    gap: 6px;
    background: rgba(0, 0, 0, 0.15);
    padding: 3px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.03);
}

.history-filter-btn {
    background: none;
    border: none;
    color: var(--wb-text-muted);
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.history-filter-btn:hover {
    color: #fff;
}

.history-filter-btn.active {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.history-details-table-wrapper {
    flex: 1;
    overflow-y: auto;
    max-height: 380px;
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 8px;
    background: rgba(0,0,0,0.12);
}

.history-details-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.history-details-table th {
    position: sticky;
    top: 0;
    background: #1f2535;
    z-index: 10;
    padding: 10px 14px;
    color: var(--wb-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    text-align: left;
}

.history-details-table td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    vertical-align: middle;
}

.history-details-table tbody tr:hover td {
    background: rgba(255,255,255,0.01);
}

.recipient-status-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 6px;
}

.recipient-status-dot.completed {
    background-color: #10b981;
    box-shadow: 0 0 6px #10b981;
}

.recipient-status-dot.failed {
    background-color: #ef4444;
    box-shadow: 0 0 6px #ef4444;
}

.recipient-status-dot.sending {
    background-color: #3b82f6;
    box-shadow: 0 0 6px #3b82f6;
}

.recipient-status-text {
    font-weight: 600;
}

.recipient-status-text.completed { color: #34d399; }
.recipient-status-text.failed { color: #fca5a5; }
.recipient-status-text.sending { color: #93c5fd; }

.error-message-text {
    color: #fca5a5;
    font-style: italic;
    background: rgba(239, 68, 68, 0.05);
    border-radius: 4px;
    padding: 2px 6px;
    display: inline-block;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.error-message-text:hover {
    white-space: normal;
    word-break: break-all;
    max-width: none;
}
