/* Estilos generales del dashboard */
.wpwc-dashboard {
    background: #f5f7fa;
    padding: 20px;
}

.wpwc-title {
    color: #25D366;
    font-size: 24px;
    margin-bottom: 20px;
    border-bottom: 2px solid #25D366;
    padding-bottom: 10px;
}

.wpwc-content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.wpwc-main-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.wpwc-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.wpwc-card {
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    padding: 15px;
    transition: transform 0.3s ease;
}

.wpwc-card:hover {
    transform: translateY(-5px);
}

.wpwc-subtitle {
    color: #333;
    font-size: 18px;
    margin-bottom: 10px;
    border-left: 4px solid #25D366; /* Will be overridden by inline CSS */
    padding-left: 10px;
}

.wpwc-chart-container {
    height: 200px;
    position: relative;
}

.wpwc-table-container {
    overflow-x: auto;
}

.wpwc-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
}

.wpwc-table th,
.wpwc-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.wpwc-table th {
    background: linear-gradient(90deg, #25D366 0%, #1da851 100%);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wpwc-table tr:hover {
    background: #f9f9f9;
}

.wpwc-consolidated-report {
    background: linear-gradient(135deg, #ffffff 0%, #f0f9f4 100%);
    border-left: 6px solid #25D366;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.wpwc-report-item {
    display: flex;
    justify-content: space-between;
    margin: 10px 0;
    padding: 8px;
    background: #fff;
    border-radius: 5px;
    border-left: 3px solid #25D366;
}

.wpwc-label {
    font-weight: 500;
    color: #444;
}

.wpwc-value {
    font-weight: 600;
    color: #25D366;
}

.wpwc-top-agents {
    list-style: none;
    padding: 0;
    margin: 0;
}

.wpwc-top-agents li {
    padding: 8px;
    background: #f0f9f4;
    margin: 5px 0;
    border-radius: 5px;
    border-left: 3px solid #25D366;
    transition: background-color 0.3s ease;
}

.wpwc-top-agents li:hover {
    background: #e0f7e9;
}

.wpwc-filter-panel {
    background: #ffffff;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.wpwc-filter-form {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.wpwc-filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wpwc-select,
.wpwc-input {
    padding: 10px 15px;
    font-size: 14px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #fff;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.wpwc-select:focus,
.wpwc-input:focus {
    border-color: #25D366;
    box-shadow: 0 0 8px rgba(37, 211, 102, 0.4);
    outline: none;
}

.wpwc-button {
    padding: 10px 20px;
    background: linear-gradient(90deg, #25D366 0%, #1da851 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.wpwc-button:hover {
    background: linear-gradient(90deg, #1da851 0%, #169b44 100%);
    transform: translateY(-2px);
}

.wpwc-button-secondary {
    background: linear-gradient(90deg, #e74c3c 0%, #c0392b 100%);
}

.wpwc-button-secondary:hover {
    background: linear-gradient(90deg, #c0392b 0%, #a93226 100%);
}

/* Estilos existentes para el botón de WhatsApp */
.wpwc-whatsapp-container {
    position: fixed;
    z-index: 1000;
}

.wpwc-whatsapp-button,
.wpwc-whatsapp-button.wpwc-direct-link {
    cursor: pointer;
    animation: pulse 2s infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Prevenir estilos de temas de WordPress */
    border: none !important;
    outline: none !important;
    text-decoration: none !important;
    border-bottom: none !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
    text-underline-offset: 0 !important;
}

/* Prevenir estilos en hover, focus y active */
.wpwc-whatsapp-button:hover,
.wpwc-whatsapp-button.wpwc-direct-link:hover,
.wpwc-whatsapp-button:focus,
.wpwc-whatsapp-button.wpwc-direct-link:focus,
.wpwc-whatsapp-button:active,
.wpwc-whatsapp-button.wpwc-direct-link:active,
.wpwc-whatsapp-button:visited,
.wpwc-whatsapp-button.wpwc-direct-link:visited {
    border: none !important;
    outline: none !important;
    text-decoration: none !important;
    border-bottom: none !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
    box-shadow: none !important;
}

.wpwc-whatsapp-button img,
.wpwc-whatsapp-button.wpwc-direct-link img {
    transition: transform 0.3s ease;
}

.wpwc-whatsapp-button img:hover,
.wpwc-whatsapp-button.wpwc-direct-link img:hover {
    transform: scale(1.1);
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7); }
    50% { transform: scale(1.05); box-shadow: 0 0 0 15px rgba(37, 211, 102, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

/* Department selector */
.wpwc-agent-selector {
    display: none;
    position: absolute;
    width: 320px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.08);
    padding: 20px;
    border-left: 0px solid #25D366; /* Overridden by inline CSS with primary color */
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.wpwc-agent-selector.wpwc-show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wpwc-selector-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
}

.wpwc-selector-header h3 {
    margin: 0 0 10px 0;
    padding-bottom: 10px;
    font-size: 17px;
    font-weight: 600;
    color: #1a1a1a;
    border-bottom: 2px solid #25D366; /* Overridden by inline CSS with primary color */
}

.wpwc-selector-header p {
    margin: 0;
    font-size: 13px;
    color: #6c757d;
    font-weight: 400;
}

.wpwc-department-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wpwc-department-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 18px;
    margin-bottom: 0;
    border-radius: 8px;
    background-color: #ffffff;
    border: 1px solid #e9ecef;
    border-left: 3px solid #25D366; /* Overridden by inline CSS with primary color */
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-height: 60px;
}

/* Cuando hay descripción, alinear arriba */
.wpwc-department-list li.has-description {
    align-items: flex-start;
}

.wpwc-department-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: transparent; /* Color applied via parent hover with primary color */
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.wpwc-department-list li:hover::before {
    width: 100%;
    opacity: 0.08;
}

.wpwc-department-list li:hover {
    /* background-color and border-left-color overridden by inline CSS with primary color */
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.wpwc-department-list li:active {
    transform: translateX(3px) scale(0.98);
}

.wpwc-agent-info {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
    flex: 1;
    min-width: 0;
    max-width: calc(100% - 40px);
    padding-right: 10px;
}

/* Cuando hay descripción, alinear arriba */
.wpwc-department-list li.has-description .wpwc-agent-info {
    align-items: flex-start;
}

.wpwc-agent-avatar {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    max-width: 32px !important;
    max-height: 32px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    border: 2px solid #e9ecef !important;
    transition: all 0.3s ease !important;
    flex-shrink: 0; /* Evita que la imagen se encoja */
    display: block !important;
    background-color: #f8f9fa; /* Color de fondo mientras carga */
}

.wpwc-department-list li:hover .wpwc-agent-avatar {
    transform: scale(1.1);
    /* border-color y box-shadow se aplican dinámicamente desde PHP con el color primario */
}

.wpwc-agent-name-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
    max-width: 100%;
}

.wpwc-agent-name {
    font-size: 15px;
    font-weight: 700;
    color: #1a202c;
    line-height: 1.3;
}

.wpwc-agent-description {
    font-size: 12px !important;
    font-weight: 400 !important;
    color: #718096 !important;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    opacity: 0.95;
}

/* Eliminar regla genérica que sobreescribe los estilos */

.wpwc-department-icon {
    width: 24px;
    height: 24px;
    min-width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.wpwc-department-icon i {
    font-size: 18px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .wpwc-content-grid {
        grid-template-columns: 1fr;
    }
    .wpwc-sidebar {
        order: -1;
        margin-bottom: 20px;
    }
    .wpwc-filter-form {
        flex-direction: column;
        align-items: stretch;
    }
    .wpwc-date-fields {
        flex-direction: column;
        gap: 10px;
    }
    .wpwc-input {
        width: 100%;
    }
}

/* ===================================
   BADGE Y TOOLTIP
   =================================== */

/* Badge de respuesta rápida */
.wpwc-response-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background: linear-gradient(135deg, #FF6B6B 0%, #EE5A6F 100%);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
    white-space: nowrap;
    z-index: 10001;
    animation: wpwc-badge-pulse 2s ease-in-out infinite;
    pointer-events: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@keyframes wpwc-badge-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Tooltip personalizado */
.wpwc-whatsapp-button[title]:hover::after,
.wpwc-whatsapp-button.wpwc-direct-link[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    right: 0;
    background: #2c3e50;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    white-space: nowrap;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 10002;
    opacity: 0;
    animation: wpwc-tooltip-fade-in 0.3s ease forwards;
    pointer-events: none;
}

.wpwc-whatsapp-button[title]:hover::before,
.wpwc-whatsapp-button.wpwc-direct-link[title]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    right: 20px;
    border: 6px solid transparent;
    border-top-color: #2c3e50;
    margin-bottom: 4px;
    z-index: 10002;
    opacity: 0;
    animation: wpwc-tooltip-fade-in 0.3s ease forwards;
}

@keyframes wpwc-tooltip-fade-in {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive badge */
@media (max-width: 768px) {
    .wpwc-response-badge {
        font-size: 10px;
        padding: 4px 10px;
        top: -8px;
        right: -8px;
    }
}
