/* 
   VISTA DE CONEXIONES (CARDS)
   ---------------------------------------------------- */
.conexiones-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(320px, 420px)) !important;
    gap: 30px;
    padding: 30px;
    justify-content: center !important;
    width: 100%;
}

.cnx-card {
    border-radius: 20px;
    padding: 24px;
    position: relative;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    color: #fff;
    max-width: 420px;
    width: 100%;
    margin: 0 auto;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: var(--wb-bg-card);
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

.cnx-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.15);
}

.grad-purple { background: linear-gradient(145deg, #6c2d7c 0%, #1a1f2c 100%); }
.grad-blue   { background: linear-gradient(145deg, #2e4a91 0%, #1a1f2c 100%); }
.grad-green  { background: linear-gradient(145deg, #157347 0%, #1a1f2c 100%); }

.cnx-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 25px;
}

.cnx-icon {
    font-size: 36px;
    filter: drop-shadow(0 5px 10px rgba(0,0,0,0.3));
}

.cnx-info h3 {
    color: #fff;
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.cnx-info p {
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cnx-info p i { font-size: 11px; opacity: 0.6; }

.btn-edit-cnx {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    width: 100%;
    padding: 14px 20px;
    border-radius: 12px;
    margin-top: 25px;
    cursor: pointer;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.btn-edit-cnx:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    padding-left: 25px;
}

.btn-qr-direct {
    background: var(--wb-accent-blue);
    border: none;
    color: #fff;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.btn-qr-direct:hover {
    background: #4a80f0;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.3);
}

/* Status Badges */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.badge-status.connected {
    background: rgba(74, 222, 128, 0.15);
    border: 1px solid rgba(74, 222, 128, 0.4);
    color: #4ade80;
    box-shadow: 0 0 15px rgba(74, 222, 128, 0.1);
}

.badge-status.disconnected {
    background: rgba(248, 113, 113, 0.2);
    border: 1px solid rgba(248, 113, 113, 0.4);
    color: #f87171;
    animation: critical-pulse 2s infinite;
}

.badge-status.verifying {
    background: rgba(96, 165, 250, 0.15);
    border: 1px solid rgba(96, 165, 250, 0.4);
    color: #60a5fa;
    animation: verifying-pulse 2s infinite;
}

.badge-status.abandoned {
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid rgba(251, 191, 36, 0.4);
    color: #fbbf24;
}

/* 
   MODALES (ALTO CONTRASTE)
   ---------------------------------------------------- */
.wb-modal-content {
    background: #1e222d !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.wb-modal-content h2 {
    color: #ffffff !important;
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    margin-bottom: 25px !important;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 15px;
}

.modal-section-title {
    color: #4db6ff;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin: 25px 0 15px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-section-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.05);
}

.wb-modal-content label {
    color: #ffffff !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    margin-bottom: 8px !important;
    display: block !important;
    opacity: 0.95;
}

.dark-input, .dark-textarea {
    background-color: #0f121a !important;
    border: 1px solid #32394e !important;
    color: #eff2f7 !important;
    border-radius: 8px !important;
    padding: 12px 15px !important;
    width: 100% !important;
    font-size: 14px !important;
    transition: all 0.3s ease !important;
}

.dark-input:focus, .dark-textarea:focus {
    border-color: #556ee6 !important;
    box-shadow: 0 0 0 3px rgba(85, 110, 230, 0.15) !important;
    outline: none !important;
    background-color: #141824 !important;
}

/* Evitar que wp-admin forcé una altura de 30px y aplaste el texto de las opciones seleccionadas */
select.dark-input {
    height: 46px !important;
    line-height: 1.4 !important;
    box-sizing: border-box !important;
    padding-top: 12px !important;
    padding-bottom: 12px !important;
}

.help-text {
    font-size: 11px;
    color: #74788d;
    margin-top: 5px;
    line-height: 1.4;
}

/* Grilla de Botones de Acción */
.modal-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.btn-modal-action {
    padding: 12px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
    border: none;
    text-transform: uppercase;
}

.btn-sync {
    background: rgba(85, 110, 230, 0.1);
    color: #556ee6;
    border: 1px solid rgba(85, 110, 230, 0.2);
}
.btn-sync:hover { background: #556ee6; color: #fff; }

.btn-update-qr {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.2);
}
.btn-update-qr:hover { background: #fbbf24; color: #000; }

.btn-delete-full {
    background: rgba(244, 106, 106, 0.1);
    color: #f46a6a;
    border: 1px solid rgba(244, 106, 106, 0.2);
    grid-column: span 2;
}
.btn-delete-full:hover { background: #f46a6a; color: #fff; }

.btn-save-main {
    background: #34c38f;
    color: #fff;
    grid-column: span 2;
    padding: 15px;
    font-size: 14px;
    margin-top: 10px;
}
.btn-save-main:hover { background: #2cae7f; transform: translateY(-2px); }

/* Control de Modales (Arquitectura limpia) */
.wb-modal.is-active {
    display: flex !important;
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(6px);
    animation: fadeInModal 0.3s ease-out;
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ----------------------------------------------------
   MAQUETACIÓN TÁCTIL Y SCALED DESIGN CONEXIONES (v8.5)
   ---------------------------------------------------- */
@media (max-width: 768px) {
    .conexiones-grid {
        grid-template-columns: 1fr 1fr !important; /* Scaled 2-Column Design */
        gap: 12px !important;
        padding: 12px !important;
    }

    .cnx-card {
        padding: 12px !important;
        border-radius: 12px !important;
        margin-bottom: 0 !important;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2) !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
    }

    .cnx-header {
        gap: 8px !important;
        margin-bottom: 12px !important;
    }

    .cnx-icon {
        font-size: 24px !important;
    }

    .cnx-info h3 {
        font-size: 13px !important;
        margin: 0 0 2px 0 !important;
    }

    .cnx-info p {
        font-size: 10px !important;
        gap: 4px !important;
    }

    .cnx-info p i {
        font-size: 9px !important;
    }

    .btn-edit-cnx {
        padding: 8px 12px !important;
        border-radius: 8px !important;
        font-size: 11px !important;
        margin-top: 10px !important;
    }

    .btn-edit-cnx:hover {
        padding-left: 15px !important;
    }

    .btn-qr-direct {
        font-size: 9px !important;
        padding: 4px 8px !important;
        width: 100% !important;
        justify-content: center !important;
        margin-left: 0 !important;
        margin-top: 6px !important;
    }

    .badge-status {
        font-size: 9px !important;
        padding: 4px 10px !important;
        width: 100% !important;
        justify-content: center !important;
        box-sizing: border-box !important;
    }

    /* Modal Configuración Scaled Design */
    .wbc-modal-main-content {
        padding: 15px !important;
    }

    .wbc-modal-main-content .wbc-field-group {
        margin-bottom: 12px !important;
    }

    .wbc-modal-main-content label {
        font-size: 11px !important;
        margin-bottom: 4px !important;
    }

    .wbc-modal-main-content .dark-input,
    .wbc-modal-main-content .dark-textarea {
        padding: 8px 12px !important;
        font-size: 12px !important;
    }

    .wbc-modal-main-content select.dark-input,
    select.dark-input {
        height: 36px !important;
        line-height: 1.4 !important;
        box-sizing: border-box !important;
        padding-top: 8px !important;
        padding-bottom: 8px !important;
    }

    .wbc-modal-main-content .wbc-section-title {
        font-size: 10px !important;
        margin: 15px 0 10px 0 !important;
    }
}

@media (max-width: 480px) {
    /* Mínimo espacio extremo en celulares muy pequeños */
    .conexiones-grid {
        grid-template-columns: 1fr !important; /* Stack simple solo por debajo de 480px */
    }
}
